File: Theremin.scd

package info (click to toggle)
supercollider 1%3A3.4.5-1wheezy1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,972 kB
  • sloc: cpp: 116,645; lisp: 64,914; ansic: 10,725; python: 3,548; perl: 766; ruby: 487; sh: 152; makefile: 117; xml: 13
file content (38 lines) | stat: -rw-r--r-- 631 bytes parent folder | download | duplicates (2)
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;