2021-11-18a_event-control.scd 1.52 KB
Newer Older
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
// Making a gated reverb
(
s.options.memSize_(2.pow(16));

t = TempoClock(66/60).permanent_(true);

~makeev = {
	~more = Dictionary.new;
~more.add(
	\p1 -> {~noi = Pbind(
		\instrument, \noisySaw,
		\scale, Scale.minorPentatonic(\werckmeister),
		\octave, Pwrand([3, 4, 5, 6], [1, 4, 3, 2].normalizeSum, inf),
		\degree, Pxrand((0..6), inf),
		\amp, Pwhite(0.3, 0.5),
		\dur, Pwhite(0.66, 2)
	).play;
	};
);
~more.add(
	\p2 -> {~noi.stop};
);
};

/*
~p1 = ~drum.play(t);
~p1.stop;*/

~cleanup = {
	"see you!".postln;
	Window.closeAll;
	s.newBusAllocators;
	ServerBoot.removeAll;
	ServerTree.removeAll;
	ServerQuit.removeAll;
};

//////////// register functions
ServerBoot.add(~makeev);
ServerQuit.add(~cleanup);

s.waitForBoot({
	s.plotTree;
	s.meter.window.alwaysOnTop_(true);

SynthDef(\bd, {
	var sig, env;
	env = Env.perc(0.0001, 1.2).kr(2);
	sig = AnalogBassDrum.ar(
		Impulse.kr(0),
		0,
		0.7,
		50,
		0.33,
		0.75,
		0.4,
		0.33
	);

	sig = Pan2.ar(sig * \amp.kr(0.95) * env, 0);
	Out.ar(0, sig);
}).add;

SynthDef(\noisySaw, {
	arg dry = 1;
	var sig, freq, env;
	env = Env.perc(\atk.ir(0.12), \rel.ir(4)).kr(2);
	freq = \freq.kr(220, 0.5);
	sig = VarSaw.ar(
		freq,
		0,
		0.45,
		0.2
	);

	sig = sig + BrownNoise.ar(0.01);
	sig = sig.softclip;

	sig = HPF.ar(sig, 50);
	sig = LPF.ar(sig, 2400);

	sig = sig * env * \amp.kr(0.45);
	sig = Pan2.ar(sig);

	Out.ar(0, sig);
}).add;

});
)

// first part: figure out
MIDIClient.init;
MIDIIn.connectAll;

MIDIFunc.trace(true);

Synth(\noisySaw);

~more[\p1].value;
~more[\p2].value

// kthxbye!
s.quit;