«Pushing air» by coreyker

on 17 Dec'12 11:32 in disquietmorse code

code for disquiet 0050 project: http://disquiet.com/2012/12/13/disquiet0050-morsebeat/ listen here: http://soundcloud.com/inlet/pushing-air-disquiet0050

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
0050
"pushing air" => ".--. ..- ... .... .. -. --. / .- .. .-."
*/

~morsestr = ".--. ..- ... .... .. -. --. / .- .. .-. / ";

~ctlbus1 = Bus.control(s);
MIDIIn.connectAll;

(
SynthDef(\perc, {|freq=280|
	var ampEnv, snd, attack, release, sat, mod;
	release = 3;
	attack = ~ctlbus1.kr;
	sat = -2;
	mod = SinOsc.ar(4, 0, 2);
	ampEnv = EnvGen.ar(Env.perc(attack, release, 1), doneAction:2);
	snd = ampEnv * SinOsc.ar([freq, (1.005*freq)+mod], [Rand(0,3.14),Rand(0,3.14)]);
	snd = 2/(1 + (sat*snd).exp) - 1;
	Out.ar(0,snd);
}).add;
)

~t = TempoClock.new;
~t.tempo = 3;
Tdef(\morse).play(~t);


(
MIDIdef.cc(\attackTime, 
	{|val, num, chan, src| 
	var attackTime;

	attackTime = val.linlin(0,127,0,2);
	~ctlbus1.set(attackTime);
	("attackTime: " ++ attackTime).postln;
	},2);

MIDIdef.cc(\tempo, 
	{|val, num, chan, src| 
	var index;
	var tempoArray = [3,6,12];
	
	index = val.linlin(0,127,0,2);
	~t.tempo = val.linlin(0,127,1,12);//tempoArray[index];
	val.linlin(0,127,1,12).postln;//tempoArray[index].postln;
	},14);
)

(
Tdef(\morse,
{	
	inf.do{ |i|		
		
		var f0 = 180 * (2**(0/12));
		var freq = 2**(([-7,-3,0,2,5,9,12].choose)/12) * f0;
		var char = ~morsestr.wrapAt(i).asString;
		
		switch(char,
		".", { ".".post; 
				//x = Synth(\default); 
				x = Synth(\perc, [\freq, freq]); 
				1.wait;
				//x.release;
				},
		"-", { "-".post; 
				//x = Synth(\default); 
				x = Synth(\perc, [\freq, freq]); 			
				3.wait;
				//x.release;
				},
		" ", { " ".post;		
				1.wait;
			  },
		"/", { "/".post;
				3.wait;
		}, {});
	};
})
)

Tdef(\morse).reset;
Tdef(\morse).pause;
Tdef(\morse).stop;
raw 1685 chars (focus & ctrl+a+c to copy)
reception
comments
Schemawound user 17 Dec'12 15:02

Thanks!

sandrovale user 20 Dec'12 06:07

Beautiful...