«9/8 drum'n strings» by bernhard

on 15 Apr'20 16:07 in drumspluckeuclidian98stringspersianturkgipsy

An experiment with euclidian patterns, sampled drums and synthesized strings. Inspired by middle eastern 9/8 rhythms. Replace the samples in the dictionary with whatever percussion sounds you have.

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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
//An experiment with euclidian patterns, sampled drums and synthesized strings. Inspired by middle eastern 9/8 rhythms. Replace the samples in the dictionary with whatever percussion sounds you have.


/// creating a dictionary with samples.

(
d = Dictionary.new;
d.add(\tam -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/tamsolo/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););

d.add(\kranz2 -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/kranz2/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););

d.add(\wood1 -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/wood1/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););


d.add(\wood5 -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/wood5/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););

d.add(\drum1 -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/drum1/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););


d.add(\kuerbis -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/kuerbis/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););

d.add(\rassel4 -> PathName("/Users/bernhardzitz/Music/SUPERCOLLIDER/buffers/rassel4/").entries.collect({
	arg sf;
	Buffer.read(s, sf.fullPath);
}););

)

// Masterbus with reverb and limiter. Must be the first SynthDef for correct node order.

(
SynthDef.new(\revlimit, {
	arg in=50, out=0;
	var sig;
	sig = In.ar(in,2);
	sig = GVerb.ar(sig,24,0.25,0.15,0.17,15,1,0.1,0.02);
	sig = Limiter.ar(sig, 0.8,0.02);
	Out.ar(out, sig);
}).play;
)

// Sampleplayer for mono samples with panning and two channel ouput. Sends to bus 50 (Masterbus).

(
SynthDef.new(\bufplay, {
	arg buf=0, rate=1, pan=0, amp=1;
	var sig;
	sig = PlayBuf.ar(1, buf, BufRateScale.ir(buf) * rate, doneAction:2);
	sig = Pan2.ar(sig,pan,amp);
	sig = sig.tanh * 0.7;
	Out.ar(50, sig);
}).add;
)

// Stringinstrument with extra reverb. Sends to bus 50 (Masterbus)

(
SynthDef(\stringemil, {arg out = 0, hit = 0.1, amp = 1, freq = 440, decay = 5, pan=0,coef = 0.1;
	var env, snd;
	env = EnvGen.kr(Env.linen(0, decay, 0), doneAction: 2);
	snd = Pluck.ar(
		in: PinkNoise.ar(hit),
		trig: Impulse.kr(0),
		maxdelaytime: 0.1,
		delaytime: freq.reciprocal,
		decaytime: decay,
		coef: coef);
	snd = Pan2.ar(snd,pan,amp);
	snd = GVerb.ar(snd,34,0.55,0.25,0.27,55,1,0.25,0.2);
	snd = LeakDC.ar(snd).clip2;
	Out.ar(out, snd * env);
}).add;

)

// records to "/Users/admin/Music/SuperCollider Recordings/"
s.record;

s.stopRecording;

// the Pdefs for percussion

(
Pdef(
	\rhythm,
	Pbind(
		\instrument, \bufplay,
		\dur, 1/8,
		\buf, Prand(d[\kuerbis], inf),
		\rate, Pexprand(3.3,3.301, inf),
		\amp, Pseq([1,0.3,0.2,2,0.3,0.3,0.5,0.3,0.4],inf),
		\pan, 0.1,
	)
)
)

Pdef(\rhythm).stop;
Pdef(\rhythm).play(quant:1);


(
Pdef(
	\rhythm0,
	Pbind(
		\instrument, \bufplay,
		\dur, Pseq((Bjorklund2.new(7,9).rotate(0)/8), inf),
		\buf, Prand(d[\drum1], inf),
		\rate, Pexprand(0.70,0.704, inf),
		\amp, Pseq((Bjorklund.new(4,9).rotate(0)*1.5)+0.6,inf),
		\pan, 0,
	)
)
)

Pdef(\rhythm0).stop;
Pdef(\rhythm0).play(quant:1);


(
Pdef(
	\rhythm1,
	Pbind(
		\instrument, \bufplay,
		\dur, Pseq(
			[Pseq((Bjorklund2.new(7,12).rotate(0)/8),3),Pseq((Bjorklund2.new(5,9).rotate(2)/8),1)],inf),
		\buf, Prand(d[\kranz2],inf),
		\rate, Pexprand(4.7,4.71, inf),
		\amp, Pseq((Bjorklund.new(5,9).rotate(3)*1.2)+0.6,inf),
		\pan, -0.1,
	);
)
)

Pdef(\rhythm1).stop;
Pdef(\rhythm1).play(quant:1);


(
Pdef(
	\rhythm2,
	Pbind(
		\instrument, \bufplay,
		\dur, Pseq(Bjorklund2.new(7,12).rotate(2)/8, inf),
		\buf, Prand(d[\tam], inf),
		\rate, Pexprand(0.6,0.601,inf),
		\amp, Pseq((Bjorklund.new(2,9).rotate(5)*1.5)+0.6,inf),
		\pan, -0.3,
	);
)
)

Pdef(\rhythm2).stop;
Pdef(\rhythm2).play(quant:1);

(
Pdef(
	\rhythm3,
	Pbind(
		\instrument, \bufplay,
		\dur, Pseq(Bjorklund2.new(11,12).rotate(0)/8, inf),
		\buf, Prand(d[\rassel4]++d[\kuerbis], inf),
		\rate, 2.5,
		\amp, Pseq([Pseq((Bjorklund.new(4,9).rotate(1)+0.5),3),Pseq((Bjorklund.new(7,9).rotate(0)),1)],inf),
		\pan, 0.3,
	);
)
)

Pdef(\rhythm3).stop;
Pdef(\rhythm3).play(quant:1);


(
Pdef(
	\wood,
	Pbind(
		\instrument, \bufplay,
		\dur, Pseq(Bjorklund2.new(9,15).rotate(0)/8, inf),
		\buf, Prand(d[\wood1]++d[\wood5], inf),
		\rate, 0.7,
		\amp, Pseq([Pseq((Bjorklund.new(2,9).rotate(3)*1.3)+0.7,3),Pseq((Bjorklund.new(4,9).rotate(0)*1.8),1)],inf),
		\pan, Pseq([-0.3,0,0.3,0],inf),

	);
)
)


Pdef(\wood).stop;
Pdef(\wood).play(quant:1);


// the Pdef for the stringinstrument

(
Pdef(\hackbrett,

Pbind(
	\instrument, \stringemil,
	\out, 50,
	\scale, Scale.rast,
	\octave, 4,

				//\degree, Pseq([Pwrand([0,1,2,3,4,5,6,7,8,9],[3,1,2,2,1,1,2,3,2,1].normalizeSum,47),Prand([0,2,3,4,7],40),Pseq([7,8,9,10,11,12,13],1)],inf),

		\degree, Pseq([Pwrand([0,2,3,-1,5,6,7,8,9],[3,2,2,1,1,1,2,3,1].normalizeSum,47),Prand([-1,0,2,3,4,6,7,9,10],40),Pseq([6,7,8,9,10,11,12,13],1),Prand([6,0,2,3,7,6,7,9,10],40),Pseq([6,7,9,10,11,13,14].reverse,1)],inf),

		\dur, Pseq([Pseq(Bjorklund2.new(5,9).rotate(0)/8, 8),Pseq(Bjorklund2.new(2,9).rotate(0)/24, 1),Pseq(Bjorklund2.new(1,9).rotate(0)/24, 1),Pseq(Bjorklund2.new(4,9).rotate(3)/24, 1)],inf),

	\coef, Pseq((Bjorklund.new(11,16).rotate(7)*(0.1.neg))+0.8,inf),
	\decay, Pseq((Bjorklund.new(5,12).rotate(5)*2)+1,inf),
	\hit, Pseq((Bjorklund.new(7,12).rotate(3)*0.4)+0.6,inf),
	\amp, 0.7,
	\pan, 0,

	);
)
)

Pdef(\hackbrett).stop;
Pdef(\hackbrett).play(quant:1);
raw 5698 chars (focus & ctrl+a+c to copy)
reception
comments