Sensitivity


A macro UGen that emulates the sensitivity control on many hardware synthesizers.


The input control is assumes to fall in the range 0..1. If the sensitivity is 1, the control value is passed unchanged. If 0, the output value is always 1 -- that is, the output has become completely insensitive to the input value. Other sensitivity values scale the input value, and adjust so that the top of the output range is always 1.


Sensitivity == 1.0, input range 0..1 --> output range 0..1

Sensitivity == 0.0, input range 0..1 --> output range 1..1

Sensitivity == 0.2, input range 0..1 --> output range 0.8..1


The formula is (input - 1) * sensitivity + 1


Sensitivity.ar(scaler, value, sense)

Sensitivity.kr(scaler, value, sense)


scaler = value by which to multiply the output after sensitivity adjustment

value = input value to be adjusted for sensitivity

sense = sensitivity factor


Example:


// sensitivity-controlled amplitude


a = { |sense = 0.2|

var amp = Sensitivity.kr(1, MouseY.kr(0, 1), sense);

SinOsc.ar(440, 0, amp) ! 2

};


a.set(\sense, 0);

a.set(\sense, 1); // you can make the sound silent by taking mouseY to 0

a.set(\sense, 0.4); // now you can't make it silent anymore


a.free;