How can I get the current sample rate?

pfeff's icon

Hi,
I think this should be an easy thing to do, but I can't seem to find the answer. I'm using hostsync to get transport info from rewire. It outputs the tempo in samples per beat. I need to use the current sample rate in order to calculate the BPM tempo, but I don't know how to retrieve the sample rate in Max. Is is possible?

Thanks,
Joe

Tim Lloyd's icon

[dspstate~]

pfeff's icon

Perfect. Thanks:)

Noob4Life's icon

I prefer [adstatus sr] because it reports the 'correct' sampling rate even while DSP is off(example, start up Max, and in a blank new patcher create both objects: one [dspstate~] and one [adstatus sr]. change your sampling rate to 48000 without turning audio on, send a bang to [dspstate~] and also to [adstatus sr] still without turning audio on. result: on my computer [dspstate~] sends incorrectly the sample-rate of 44100(default? i don't know why) but [adstatus sr] will show the correct value of 48000). [adstatus] help file also shows that how [adstatus] can give you much more access to other things good to learn.

________________________________
*Never fear, Noob4Life was never here!*

Tim Lloyd's icon

Aha...that is good to know! Although I think [dspstate~] will spit out the correct info as soon as audio processing is turned on even without a bang, which must be why I've never had a problem with it :)

Noob4Life's icon

true, but then [adstatus sr] does the same thing when audio processing is turned on even without a bang as well.

(i wonder what is dspstate~ good for then if it simply duplicates adstatus functionality but... somewhat poorly)

________________________________
*Never fear, Noob4Life was never here!*

Tim Lloyd's icon

I have homework I should be doing......

Noob4Life's icon

:D ^ (this forum is just so much more interesting than cs homework)

but raja, it's saturday, eat my signature:
________________________________
*Never fear, Noob4Life was never here!*

Tim Lloyd's icon

as do I :p

I may have to start using [adstatus] now

seejayjames's icon

if only all our homework was max-based.