home/ atoms/ sc-range-scaling

The .range(lo, hi) method rescales any UGen's output to a desired numeric range; mul/add provide equivalent lower-level control

.range(lo, hi) maps a UGen’s native output range to [lo, hi]. A bipolar UGen like SinOsc (-1..+1) with .range(200, 800) outputs 200–800 — suitable for frequency control. The equivalent using mul and add: for a bipolar UGen, mul = (hi - lo) / 2 and add = lo + mul. For a unipolar UGen, mul = hi - lo and add = lo. The .linlin, .linexp, .explin, .expexp methods generalize to arbitrary input/output ranges; linexp is essential when the target parameter (like frequency) is perceived logarithmically.

Examples

{SinOsc.ar(LFNoise0.kr(5).range(200,800),0,0.1)}.play;
// Equivalent with mul/add:
{SinOsc.ar(LFNoise0.kr(5, mul:300, add:500),0,0.1)}.play;

Assessment

Write a patch where LFPulse.kr controls filter cutoff, scaled 200–2000 Hz using .range. Rewrite equivalently using mul: and add: arguments.

“Themetho drangesimplyrescalestheoutputofaUGen.Rememb er,LFNoise0pro duces numb ersb etween-1and+1(itisabip olarUGen).”
corpus · a-gentle-introduction-to-supercollider-bruno-ruviaro · chunk 11