«Beatboxing and Bach» by aahrens

on 25 Oct'18 02:10 in bachinventionclassical

Taking inspiration from "Switched-On Bach", this is a supercollider rendition of Invention No. 13 in A Minor.

The melody is held in Pbinds, and I modified Bruno's percussion SynthDefs to sound like a person beatboxing.

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
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
(

// Basic drum kit
SynthDef("hihat", {arg out = 0, amp = 0.5, att = 0.01, rel = 0.2, ffreq = 6000, pan = 0;
	var env, snd;
	env = Env.perc(att, rel, amp).kr(doneAction: 2);
	snd = WhiteNoise.ar;
	snd = HPF.ar(in: snd, freq: ffreq, mul: env);
	Out.ar(out, Pan2.ar(snd, pan));
}).add;

SynthDef("snare", {arg out = 0, amp = 0.1, sinfreq = 180, att = 0.01, rel = 0.2, ffreq = 2000, pan = 0;
	var env, snd1, snd2, sum;
	env = Env.perc(att, rel, amp).kr(doneAction: 2);
	snd1 = HPF.ar(
		in: PinkNoise.ar,
		freq: ffreq,
		mul: env
	);
	snd2 = SinOsc.ar(freq: sinfreq, mul: env);
	sum = snd1 + snd2;
	Out.ar(out, Pan2.ar(sum, pan));
}).add;

SynthDef("kick", {arg out = 0, amp = 0.3, sinfreq = 60, glissf = 0.9, att = 0.01, rel = 0.45, pan = 0;
	var env, snd, ramp;
	env = Env.perc(att, rel, amp).kr(doneAction: 2);
	ramp = XLine.kr(
		start: sinfreq,
		end: sinfreq * glissf,
		dur: rel
	);
	snd = SinOsc.ar(freq: ramp, mul: env);
	snd = Pan2.ar(snd, pan);
	Out.ar(out, snd);
}).add;

// Basic saw synth for chords and bass
SynthDef("sawSynth", { arg freq = 440, amp = 0.1, att = 0.1, rel = 2, lofreq = 1000, hifreq = 3000;
    var env, snd;
    env = Env.perc(
		attackTime: att,
		releaseTime: rel,
		level: amp
	).kr(doneAction: 2);
    snd = Saw.ar(freq: freq * [0.99, 1, 1.001, 1.008], mul: env);
	snd = BPF.ar(
		in: snd,
		freq: LFNoise2.kr(1).range(lofreq, hifreq)
	);
    snd = Splay.ar(snd);
    Out.ar(0, snd);
}).add;

SynthDef("pulseSynth", { arg freq = 440, amp = 0.1, att = 0.1, rel = 2, lofreq = 1000, hifreq = 3000;
    var env, snd;
    env = Env.perc(
		attackTime: att,
		releaseTime: rel,
		level: amp
	).kr(doneAction: 2);
    snd = Pulse.ar(freq: freq * [0.99, 1, 1.001, 1.008], mul: env);
	snd = BPF.ar(
		in: snd,
		freq: LFNoise2.kr(1).range(lofreq, hifreq)
	);
    snd = Splay.ar(snd);
    Out.ar(0, snd);
}).add;

)

// Bach's Invention No. 13 in A Minor
(
Pbind(
	\instrument, "hihat",
	\dur, Pseq([

		Pseq([Rest(1/4), 1/4], 44), //bars 1-6(first half)
		Rest(2), //bar 6
		Pseq([Rest(1/4), 1/8, 1/8, 1/4, 1/4, Pn(1/4, 4)], 1),
		Pseq([Rest(1/4), 1/4], 4),
		Pseq([Rest(1/4), 1/8, 1/8, 1/4, 1/4, Pn(1/4, 4)], 1),
		Pseq([Rest(1/4), 1/4], 4), //bars 7-8
		Pseq([Rest(1/4), 1/4], 40), //bars 9-13
		Pseq([Rest(2), Pseq([Rest(1/4), 1/4], 4)], 4), //bars 14-17
		Pseq([Rest(1/4), 1/4], 62) //bars 18-end

	], 1),
	\att, 0.05,
	\rel, 0.1,
	\ffreq, 11000,
	\pan, 0,
	\amp, 0.3
).play;

Pbind(
	\instrument, "snare",
	\dur, Pseq([

		Pseq([Rest(1/2), 1/2], 52), //bars 1-13
		Pseq([Rest(3), Rest(1/2), 1/2], 4), //bars 14-17
		Pseq([Rest(1/2), 1/2], 31) //bars 18-end

	], 1),
	\att, 0.01,
	\rel, 0.1,
	\sinfreq, 180,
	\ffreq, 2000,
	\amp, 0.6

).play;

Pbind(
	\instrument, "kick",
	\dur, Pseq([

		Pn(1/2, 199) //bars 1-25

	], 1),
	\att, 0.01,
	\rel, 0.5,
	\sinfreq, 55,
	\glissf, 0.9,
	\amp, 0.4,
).play;


//Right hand
Pbind(
	\instrument, "pulseSynth",
	\midinote, Pseq([

		\rest, 64, 69, 72, 71, 64, 71, 74, 72, 76, 68, 76, //bar 1
		69, 64, 69, 72, 71, 64, 71, 74, 72, 69, \rest, //bar 2
		\rest, 76, 72, 76, 69, 72, 64, 67, 65, 69, 74, 77, //bar 3
		\rest, 74, 71, 74, 67, 71, 62, 65, 64, 67, 72, 76, //bar 4
		\rest, 72, 69, 72, 65, 74, \rest, 71, 67, 71, 64, 72, //bar 5
		\rest, 69, 65, 69, 62, 71, 72, \rest, //bar 6
		\rest, 67, 72, 76, 74, 67, 74, 77, 76, 79, 71, 79, //bar 7
		72, 67, 72, 76, 74, 67, 74, 77, 76, 72, 79, 76, //bar 8

		84, 81, 76, 81, 72, 76, 69, 72, 74, 78, 81, 84, //bar 9
		83, 79, 74, 79, 71, 74, 67, 71, 72, 76, 79, 83, //bar 10
		81, 78, 75, 78, 71, 75, 66, 69, 67, 79, \rest, 76, 72, 76, //bar 11
		69, 78, \rest, 74, 71, 74, 67, 76, \rest, 72, 69, 72, //bar 12
		66, 79, 78, 76, 75, 78, 71, 75, 76, \rest, \rest, \rest, //bar 13
		\rest,  79, 82, 79, 76, 79, 73, 76, 79, 76, 73, 76, 69, \rest, \rest, //bar 14
		\rest, 77, 81, 77, 74, 77, 71, 74, 77, 74, 71, 74, 67, \rest, \rest, //bar 15
		\rest, 76, 79, 76, 72, 76, 69, 72, 75, 72, 69, 72, 66, \rest, \rest, //bar 16

		\rest, 74, 77, 74, 71, 74, 68, 71, 74, 71, 68, 71, 64, \rest, \rest, //bar 17
		\rest, 64, 69, 72, 71, 64, 71, 74, 72, 69, 68, 64, //bar 18
		69, 72, 76, 72, 69, 72, 66, 69, 72, 69, 66, 69, 63, 72, 71, 69, //bar 19
		68, 71, 74, 71, 68, 71, 62, 65, 68, 65, 62, 65, 59, 65, 64, 62, //bar 20
		60, 64, 69, 64, 60, 64, 57, 60, 63, 60, 57, 60, 54, 60, 59, 57, //bar 21
		56, 71, 68, 64, \rest, 64, 69, 72, 71, 64, 71, 74, //bar 22
		72, 69, 72, 76, 74, 71, 74, 77, 76, 72, 76, 79, 77, 76, 74, 72, //bar 23
		71, 72, 74, 76, 77, 74, 80, 74, 83, 74, 72, 81, 77, 74, 71, 74, //bar 24
		68, 71, 72, 69, 64, 69, 71, 68, 69, 64, 60, 64, 57 //bar 25

	], 1),

	\dur, Pseq([

		Pn(1/4, 8), Pn(1/2, 4), //bar 1
		Pn(1/4, 8), Pn(1/2, 2), 1, //bar 2
		Pn(1/4, 8), Pn(1/2, 4), //bar 3
		Pn(1/4, 8), Pn(1/2, 4), //bar 4
		Pn(1/4, 4), Pn(1/2, 2), Pn(1/4, 4), Pn(1/2, 2), //bar 5
		Pn(1/4, 4), Pn(1/2, 3), 1.5, //bar 6
		Pn(1/4, 8), Pn(1/2, 4), //bar 7
		Pn(1/4, 8), Pn(1/2, 4), //bar 8

		Pn(1/4, 8), Pn(1/2, 4), //bar 9
		Pn(1/4, 8), Pn(1/2, 4), //bar 10
		Pn(1/4, 8), Pn(1/2, 2), Pn(1/4, 4), //bar 11
		Pn(1/2, 2), Pn(1/4, 4), Pn(1/2, 2), Pn(1/4, 4), //bar 12
		Pn(1/4, 8), Pn(1/2, 4), //bar 13
		Pn(1/4, 14), 1/2, //bar 14
		Pn(1/4, 14), 1/2, //bar 15
		Pn(1/4, 14), 1/2, //bar 16

		Pn(1/4, 14), 1/2, //bar 17
		Pn(1/4, 8), Pn(1/2, 4), //bar 18
		Pn(1/4, 16), //bar 19
		Pn(1/4, 16), //bar 20
		Pn(1/4, 16), //bar 21
		Pn(1/2, 4), Pn(1/4, 8), //bar 22
		Pn(1/4, 16), //bar 23
		Pn(1/4, 16), //bar 24
		Pn(1/4, 12), 1 //bar 25

	], 1),

	\att, 0.1,
	\rel, Pkey(\dur)+0.5,
	\amp, 0.3

).play;

//Left hand
Pbind(
	\instrument, "sawSynth",
	\midinote, Pseq([

		45, 57, 56, 57, 52, 57, 60, 59, 52, 59, 62, //bar 1
		60, 57, 56, 52, 57, 52, 57, 60, 59, 52, 59, 62, //bar 2
		60, 57, 60, 57, 62, 57, 53, 57, 50, 53, 45, 48, //bar 3
		47, 50, 55, 59, \rest, 55, 52, 55, 48, 52, 43, 47, //bar 4
		45, 48, 50, 53, 47, 50, 43, 47, 48, 52, 45, 48, //bar 5
		41, 38, 43, 55, 53, 55, 48, 55, 60, 64, 62, 55, 62, 65, //bar 6
		64, 60, 59, 55, 60, 55, 60, 64, 62, 55, 62, 65, //bar 7
		64, 60, \rest, \rest, \rest, 67, 64, 67, 60, 64, 55, 59, //bar 8

		57, 60, 64, 67, 66, 69, 62, 66, 57, 62, 54, 57, //bar 9
		55, 59, 62, 66, 64, 67, 60, 64, 55, 60, 52, 55, //bar 10
		54, 57, 59, 63, \rest, 64, 60, 64, 57, 60, 64, 67, //bar 11
		66, 62, 59, 62, 55, 59, 62, 66, 64, 60, 57, 60, 54, 57, 60, //bar 12
		\rest, 59, 60, 57, 59, 47, 52, 64, 59, 55, 52, 47, 43, 47, //bar 13
		40, 52, 55, 58, 49, \rest, \rest, 67, 65, 64, //bar 14
		62, 50, 53, 56, 47, \rest, \rest, 65, 64, 62, //bar 15
		60, 48, 52, 54, 45, \rest, \rest, 64, 63, 61, //bar 16

		59, 47, 50, 53, 44, \rest, \rest, 62, 60, 59, //bar 17
		60, 57, 56, 52, 57, 52, 57, 60, 59, 52, 59, 62, //bar 18
		60, 64, 69, 64, 60, 64, 57, 60, 54, 57, 60, 57, 54, 57, 51, 54, //bar 19
		52, 56, 59, 56, 52, 47, 44, 40, //bar 20
		45, 48, 52, 48, 45, 48, 39, \rest, //bar 21
		\rest, 59, 56, 52, 50, 59, 56, 50, 48, 52, 44, 52, //bar 22
		45, 54, 47, 56, 48, 57, 50, 58, //bar 23
		56, 53, 50, 47, 44, 45, 38, 40, //bar 24
		41, 39, 40, 52, 45 //bar 25

	], 1),

	\dur, Pseq([

		1/2, 1, 1/2, Pn(1/4, 8), //bar 1
		Pn(1/2, 4), Pn(1/4, 8), //bar 2
		Pn(1/2, 4), Pn(1/4, 8), //bar 3
		Pn(1/2, 4), Pn(1/4, 8), //bar 4
		Pn(1/2, 2), Pn(1/4, 4), Pn(1/2, 2), Pn(1/4, 4), //bar 5
		Pn(1/2, 2), Pn(1/4, 12), //bar 6
		Pn(1/2, 4), Pn(1/4, 8), //bar 7
		Pn(1/2, 4), Pn(1/4, 8), //bar 8

		Pn(1/2, 4), Pn(1/4, 8), //bar 9
		Pn(1/2, 4), Pn(1/4, 8), //bar 10
		Pn(1/2, 4), Pn(1/4, 8), //bar 11
		Pn(1/4, 14), 1/2, //bar 12
		Pn(1/4, 4), Pn(1/2, 2), Pn(1/4, 8), //bar 13
		Pn(1/2, 6), Pn(1/4, 4), //bar 14
		Pn(1/2, 6), Pn(1/4, 4), //bar 15
		Pn(1/2, 6), Pn(1/4, 4), //bar 16

		Pn(1/2, 6), Pn(1/4, 4), //bar 17
		Pn(1/2, 4), Pn(1/4, 8), //bar 18
		Pn(1/4, 16), //bar 19
		Pn(1/2, 8), //bar 20
		Pn(1/2, 8), //bar 21
		Pn(1/4, 8), Pn(1/2, 4), //bar 22
		Pn(1/2, 8), //bar 23
		Pn(1/2, 8), //bar 24
		Pn(1/2, 4), 2 //bar 25

	], 1),

	\att, 0.1,
	\rel, Pkey(\dur)+0.4,
	\amp, 0.5

).play;

)
raw 8207 chars (focus & ctrl+a+c to copy)
reception
comments