Search code examples
supercollider

SuperCollider access sample rate in a synthdef


how to find/get the samplerate number that SuperCollider is running into a patch as a variable?


Solution

  • Use the SampleRate.ir ugen, which always returns the current sample rate.

    Note that using s.sampleRate is not the best answer - it gets you the sample rate at the time the synthdef is compiled, not the sample rate at the time the synth is running...