home/ atoms/ sc-exprange-range-ugen-mapping

UGen .range and .exprange map a -1 to 1 signal to a custom output range (linear or exponential)

Most SuperCollider UGens output values in the range -1 to 1 by default. The .range(min, max) method linearly maps this to a new range. .exprange(min, max) maps exponentially, which is perceptually appropriate for frequency (since we hear octaves as equal intervals) and amplitude (loudness is logarithmic). Using .exprange for frequency control gives equal musical spacing; using .range produces more high-frequency values perceptually. Both methods conflict with explicit mul/add arguments — don’t combine them.

Examples

freq = LFNoise0.kr(8).exprange(200, 1000); // exponential distribution across 200-1000 Hz amp = LFNoise1.kr(12).exprange(0.02, 1); // exponential amplitude control

Assessment

A noise UGen controls oscillator frequency with .range(200, 2000). A musician complains the high frequencies dominate. What mapping should be used instead, and why?

“Since humans perceive frequency exponentially, it's usually more desirable to specify an exponential distribution for a range of frequency values, using the 'exprange' message.”
corpus · supercollider-tutorials-full-transcripts-and-code-eli-fields · chunk 5