1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
//////// the theremin ////////
// playing only one instance:
(
play(
{
var f;
f = MouseY.kr(4000, 200, 'exponential', 0.8);
SinOsc.ar(
freq: f+ (f*SinOsc.ar(7,0,0.02)),
mul: MouseX.kr(0, 0.9)
)
}
)
)
// building a synthdef and spawning separate synths
(
SynthDef(\theremin, { arg mod = 7, detune = 0;
var f, a, z;
f = MouseY.kr(4000, 200, 'exponential', 0.8) + detune;
a = SinOsc.ar(f + (f * SinOsc.ar(mod,0,0.02)), mul: MouseX.kr(0, 0.9));
z = Mix.ar(a);
Out.ar(0, z) + Out.ar(1, z)
}).add
)
a = Synth(\theremin);
a.set(\mod, 12);
b = Synth(\theremin);
b.set(\mod, 5, \detune, 200);
a.free;
b.free;
|