home/ atoms/ sc-ugen-rate-ar-kr-ir

SuperCollider UGens run at audio rate (ar), control rate (kr), or initialization rate (ir)

Every UGen method selects its computation rate. .ar runs at the server sample rate (typically 44100 Hz) — use it for audible signals or high-resolution waveforms. .kr runs at one value per 64 audio samples (~689 Hz at 44100), using less CPU; use it for modulators that shape other UGens (amplitude, frequency control). .ir runs once at Synth instantiation and never again — useful for static configuration values. Mismatching rates is a common source of confusing behavior; for instance, using a .ar oscillator directly as an amplitude envelope is technically valid but wasteful.

Examples

{SinOsc.ar(440) * LFNoise1.kr(8).range(0,1)}.play — audio-rate sine modulated by control-rate noise.

Assessment

Given a Synth that needs a tremolo effect (amplitude oscillation at 7 Hz), should the tremolo LFO use .ar or .kr? Why? At what rate would you run the audio oscillator whose amplitude it controls?

“Audio rate UGens output values at the sample rate, and in this case that means 44100 samples per second. If you want to hear the output of a UGen, or if you want a high-resolution waveform, you should use .ar.”
corpus · supercollider-tutorials-full-transcripts-and-code-eli-fields · chunk 4