1 /*******************************************************************************
2 "Spacelab" -- Kraftwerk
3 old school exercise -- jy
4 *******************************************************************************/
12 SynthDef(\bd, { | out=0 |
15 env = EnvGen.kr(Env.perc(0, 0.05), doneAction: 2);
16 Out.ar(out, Pan2.ar(osc, 0, env));
19 SynthDef(\sd, { | out=0 |
22 osc2 = FSinOsc.ar(200);
23 env = EnvGen.kr(Env.perc(0, 0.05), doneAction: 2);
24 Out.ar(out, Pan2.ar(LPF.ar(Mix([osc1, osc2]), 12000), 0, env));
27 SynthDef(\hat, { | out=0 |
30 env = EnvGen.kr(Env.perc(0, 0.01), doneAction: 2);
31 Out.ar(out, Pan2.ar(osc1, 0, env));
34 SynthDef(\res, { | out=0 gate=1 freq fltBus |
36 aEnv = EnvGen.kr(Env.perc(0, 0.7), gate, doneAction: 2);
37 osc = Mix([Saw.ar(freq), Pulse.ar(freq / 2, 0.5)]);
38 flt = RLPF.ar(osc, In.kr(fltBus, 1), 0.1, aEnv);
39 Out.ar(out, Pan2.ar(flt, 0));
42 SynthDef(\resControl, { | fltBus |
43 ReplaceOut.kr(fltBus, LFNoise1.kr(0.3, 1000, 1500));
46 SynthDef(\poly, { | out=0 gate=1 freq |
47 var aEnv, fEnv, osc1, osc2, flt;
48 aEnv = EnvGen.kr(Env.asr(0.2, 1, 0.1), gate, doneAction: 2);
49 fEnv = EnvGen.kr(Env.asr(7, 1, 0.2), levelScale: 12000);
50 osc1 = Pulse.ar(freq * [1, 1.007], LFCub.kr(2, 0, 0.3, 0.5));
51 osc2 = Pulse.ar(freq / 2, 0.3);
52 flt = RLPF.ar(osc1 + osc2, fEnv, 0.9, aEnv);
56 SynthDef(\solo, { | out=0 gate freq |
57 var aEnv, fEnv, osc, flt;
58 aEnv = EnvGen.kr(Env.asr(0.2, 1, 2), gate);
59 fEnv = EnvGen.kr(Env.adsr(0.4, 1.2, 0.7, 2), gate, 800);
60 osc = Saw.ar(Lag.kr(freq, 0.1) * [1, 1.005]);
61 flt = LPF.ar(osc, fEnv + 600, aEnv);
65 SynthDef(\soloControl, { | gateBus freqBus gate=1 freq |
66 ReplaceOut.kr(gateBus, gate);
67 ReplaceOut.kr(freqBus, freq);
68 EnvGen.kr(Env.asr(0,1,0), gate, doneAction: 2);
71 SynthDef(\string, { | out=0 gate=1 freq=1000 |
73 aEnv = EnvGen.kr(Env.asr(0.2, 1, 0.5), gate, doneAction: 2);
74 osc = Saw.ar([LFCub.kr(0.3, Rand(0, 1), freq * 0.003, freq), freq, LFCub.kr(0.7, Rand(0, 1), freq * 0.001, freq)]);
75 flt = LPF.ar(osc, 1500, aEnv);
79 SynthDef(\bass, { | out=0 gate=1 freq |
80 var aEnv, fEnv, osc, flt;
81 aEnv = EnvGen.kr(Env.asr(0, 1, 1), gate, doneAction: 2);
82 fEnv = EnvGen.kr(Env.perc(0, 3), levelScale: 6000);
83 osc = Mix([Saw.ar(freq * [1, 1.005]), Pulse.ar(freq / 2, 0.5)]);
84 flt = LPF.ar(osc, fEnv + 100, aEnv);
88 SynthDef(\intro, { | out=0 |
89 var trig, div, freq, oct, reps, env, osc, flt;
90 oct = [0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3];
91 trig = Impulse.kr(EnvGen.kr(Env([1.75, 120], [30], 6.5)));
92 div = PulseDivider.kr(trig, 16, 16);
93 reps = PulseCount.kr(div);
94 env = EnvGen.kr(Env.perc(0, 3), trig, 0.5);
95 freq = (Stepper.kr(trig, div, 42, 74, 2, 42) + (12 * Select.kr(reps, oct))).midicps;
96 osc = Saw.ar(freq * [1, 1.01], env);
97 flt = RLPF.ar(osc, freq * 2, 0.7);
101 SynthDef(\delay, { | bus in mix |
104 delay = CombL.ar(sig, 0.25, [0.25, 0.24], 2);
105 ReplaceOut.ar(bus, XFade2.ar(sig, delay, mix));
108 SynthDef(\fader, { | out=0 in mute=1 amp=1 |
109 Out.ar(out, In.ar(in, 2) * mute * amp)
112 SynthDef(\line, { | bus val time |
113 ReplaceOut.kr(bus, Line.kr(In.kr(bus), val, time, doneAction: 2))
116 SynthDef(\sinenv, { | bus val time |
117 ReplaceOut.kr(bus, EnvGen.kr(Env([In.kr(bus), val], [time], \sin), doneAction: 2))
126 ~master = Bus.audio(s, 2);
127 ~masterAmp = Bus.control(s, 1);
129 ~numChannels.do { | i |
130 ("ch" ++ i).asSymbol.envirPut(Bus.audio(s, 2));
131 ("chAmp" ++ i).asSymbol.envirPut(Bus.control(s, 1));
134 ~resFlt = Bus.control(s, 1);
135 ~soloGate = Bus.control(s, 1);
136 ~soloFreq = Bus.control(s, 1);
142 ~mixGroup = Group.new;
143 ~fxGroup = Group.new;
144 ~synthGroup = Group.new;
146 ~masterFader = Synth(\fader, [\out, 0, \in, ~master], ~mixGroup);
147 ~numChannels.do { | i |
148 ("fader" ++ i).asSymbol.envirPut(Synth(\fader, [\out, ~master, \in, ("ch" ++ i).asSymbol.envirGet], ~mixGroup));
151 ~ch3ins01 = Synth(\delay, [\bus, ~ch3, \mix, -0.8], ~fxGroup);
152 ~ch4ins01 = Synth(\delay, [\bus, ~ch4, \mix, -0.9], ~fxGroup);
153 ~ch5ins01 = Synth(\delay, [\bus, ~ch5, \mix, -0.6], ~fxGroup);
154 ~ch6ins01 = Synth(\delay, [\bus, ~ch6, \mix, 0.0], ~fxGroup);
155 ~ch7ins01 = Synth(\delay, [\bus, ~ch7, \mix, -0.8], ~fxGroup);
156 ~ch8ins01 = Synth(\delay, [\bus, ~ch8, \mix, -0.5], ~fxGroup);
158 ~masterFader.map(\amp, ~masterAmp);
159 ~numChannels.do { | i | ("fader" ++ i).asSymbol.envirGet.map(\amp, ("chAmp" ++ i).asSymbol.envirGet) };
161 ~masterAmp.value = 1;
164 ~chAmp2.value = 0.15;
165 ~chAmp3.value = 0.04;
166 ~chAmp4.value = 0.02;
168 ~chAmp6.value = 0.07;
169 ~chAmp7.value = 0.03;
170 ~chAmp8.value = 0.075;
173 ~soloFreq.value = 1000;
174 ~soloSynth = Synth(\solo, [\out, ~ch5], ~synthGroup);
175 ~soloSynth.map(\gate, ~soloGate, \freq, ~soloFreq);
176 ~resControlSynth = Synth(\resControl, [\fltBus, ~resFlt], ~synthGroup);
186 \group, ~synthGroup.nodeID
193 \group, ~synthGroup.nodeID
199 [\freq, \dur], Pseq([
200 Pseq([[\, 1], [1, 1]], 6),
201 Pseq([[\, 1], [1, 1], [\, 1], [1, 0.5], [1, 0.25], [1, 0.25]])
203 \group, ~synthGroup.nodeID
209 [\freq, \dur], Pseq([
210 Pseq([[\, 1], [0, 1]], 15),
212 Pseq([[\, 1], [0, 0.5], [0, 0.25], [0, 0.25]]),
213 Pseq([[\, 0.5], [0, 0.25], [0, 0.25], [0, 0.5], [0, 0.25], [0, 0.25]]),
214 Pseq([[\, 0.5], [0, 0.5], [0, 0.5], [0, 0.5]]),
215 Pseq([[0, 0.25], [0, 0.25], [0, 0.5], [0, 0.25], [0, 0.25], [0, 0.5]])
218 \group, ~synthGroup.nodeID
224 \dur, Pseq([0.25], 64),
225 \group, ~synthGroup.nodeID
231 \dur, Pseq([0.25], 128),
232 \group, ~synthGroup.nodeID
239 \scale, [0, 2, 3, 5, 7, 8, 10],
240 \degree, Pseq([Pseq([2], 16), Pseq([0], 16)], 2),
241 \octave, Pseq([4, 5], inf),
243 \group, ~synthGroup.nodeID
250 \scale, [0, 2, 3, 5, 7, 8, 10],
251 \degree, Pseq([Pseq([2], 16), Pseq([0], 16)], 4),
252 \octave, Pseq([4, 5], inf),
254 \group, ~synthGroup.nodeID
261 \scale, [0, 2, 3, 5, 7, 8, 10],
262 \degree, Pseq([Pseq([0], 32), Pseq([3], 14), Pseq([6], 2), Pseq([0], 16)], 2),
263 \octave, Pseq([4, 5], inf),
265 \group, ~synthGroup.nodeID
272 \scale, [0, 2, 3, 5, 7, 8, 10],
273 \degree, Pseq([Pseq([2], 32), Pseq([0], 32)]),
274 \octave, Pseq([4, 5], inf),
276 \group, ~synthGroup.nodeID
282 \scale, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
283 \degree, Pseq([[3, 8, 12, 15], [0, 5, 9, 12], [8, 12, 15], [5, 9, 12]]),
287 \group, ~synthGroup.nodeID
290 ~poly_chorus = Pbind(
293 \scale, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
294 \degree, Pseq([[8, 12, 15], [5, 9, 12]], 4),
298 \group, ~synthGroup.nodeID
302 \instrument, \soloControl,
305 \scale, [0, 2, 3, 5, 7, 8, 10],
306 \degree, Pseq([\, 2, 3, 0]),
308 \dur, Pseq([8, 3.5, 0.5, 4]),
310 \group, ~synthGroup.nodeID
313 ~solo_chorus = Pbind(
314 \instrument, \soloControl,
317 \scale, [0, 2, 3, 5, 7, 8, 10],
318 \degree, Pseq([\, 2, 3, 0, \, 2, 3, 7]),
320 \dur, Pseq([8, 3.5, 0.5, 4], inf),
322 \group, ~synthGroup.nodeID
326 \instrument, \soloControl,
329 \scale, [0, 2, 3, 5, 7, 8, 10],
331 5, 6, 7, 6, 5, 4, 5, 6, 3, 4, 5, 4, 3, 2, 3, 4,
332 5, 6, 7, 6, 5, 4, 5, 6, 3, 4, 5, 4, 3, 2, -1, 0
335 \dur, Pseq([1, 0.5, 1.5, 0.5, 0.5, 1, 0.5, 2.5], inf),
337 \group, ~synthGroup.nodeID
340 ~solo_break1 = Pbind(
341 \instrument, \soloControl,
344 \scale, [0, 2, 3, 5, 7, 8, 10],
345 \degree, Pseq([2, 3, 0]),
347 \dur, Pseq([7, 1, 8], inf),
349 \group, ~synthGroup.nodeID
352 ~solo_break2 = Pbind(
353 \instrument, \soloControl,
356 \scale, [0, 2, 3, 5, 7, 8, 10],
357 \degree, Pseq([2, 3, 7]),
359 \dur, Pseq([7, 1, 8], inf),
361 \group, ~synthGroup.nodeID
365 \instrument, \soloControl,
368 \scale, [0, 2, 3, 5, 7, 8, 10],
370 5, 6, 7, 8, 9, 4, 5, 6, 3, 4, 5, 4, 3, 2, 3, 4
373 \dur, Pseq([1, 0.5, 1.5, 0.5, 0.5, 1, 0.5, 2.5], inf),
375 \group, ~synthGroup.nodeID
379 \instrument, \soloControl,
382 \scale, [0, 2, 3, 5, 7, 8, 10],
384 5, 6, 7, 8, 9, 4, 5, 6, 3, 4, 5, 4, 3, 2, 3, 4
387 \dur, Pseq([1, 0.5, 1.5, 0.5, 0.5, 1, 0.5, 2.5], inf),
389 \group, ~synthGroup.nodeID
392 ~string_intro = Pbind(
393 \instrument, \string,
395 \scale, [0, 2, 3, 5, 7, 8, 10],
400 \group, ~synthGroup.nodeID
403 ~string_chorus = Pbind(
404 \instrument, \string,
406 \scale, [0, 2, 3, 5, 7, 8, 10],
411 \group, ~synthGroup.nodeID
414 ~string_verse = Pbind(
415 \instrument, \string,
417 \scale, [0, 2, 3, 5, 7, 8, 10],
418 \degree, Pseq([7, 6, 5, 4], 2),
419 \octave, Prand([Pseq([7], 4), Pseq([6], 4)], inf),
422 \group, ~synthGroup.nodeID
425 ~string_break = Pbind(
426 \instrument, \string,
428 \scale, [0, 2, 3, 5, 7, 8, 10],
429 \degree, Pseq([7], 16),
430 \octave, Pseq([6, 7], inf),
433 \group, ~synthGroup.nodeID
436 ~string_vamp1 = Pbind(
437 \instrument, \string,
439 \scale, [0, 2, 3, 5, 7, 8, 10],
440 \degree, Pseq([Prand([0, 7]), 2, 3, 0, 2, 3, 7], 2),
442 \dur, Pseq([4, 1, 0.5, 6.5, 1, 0.5, 2.5], inf),
444 \group, ~synthGroup.nodeID
447 ~string_vamp2 = Pbind(
448 \instrument, \string,
450 \scale, [0, 2, 3, 5, 7, 8, 10],
451 \degree, Pseq([Prand([0, 7]), 2, 3, 0, 2, 3, 7], 2),
453 \dur, Pseq([4, 1, 0.5, 6.5, 1, 0.5, 2.5], inf),
455 \group, ~synthGroup.nodeID
461 \scale, [0, 2, 3, 5, 7, 8, 10],
462 \degree, Pseq([0, 0, 3, 6, 7], 2),
464 \dur, Pseq([7.5, 0.5, 3.5, 0.5, 4], inf),
465 \group, ~synthGroup.nodeID
471 \scale, [0, 2, 3, 5, 7, 8, 10],
472 \degree, Pseq([2, 0]),
475 \group, ~synthGroup.nodeID
479 ~intro1 = Ppar([~poly_intro, ~solo_intro]);
480 ~intro2 = Ppar([~hat_intro, ~res_intro]);
481 ~intro3 = Ppar([~bd_intro, ~sd_intro, ~hat_intro, ~res_intro, ~string_intro ]);
482 ~chorus = Ppar([~bd, ~sd, ~hat, ~res_chorus, ~poly_chorus, ~solo_chorus, ~string_chorus]);
483 ~verse = Ppar([~bd, ~sd, ~hat, ~res_verse, ~solo_verse, ~string_verse, ~bass_verse]);
484 ~break1 = Ppar([~string_break, ~bass_break]);
485 ~break2 = Ppar([~solo_break1, ~string_break, ~bass_break]);
486 ~break3 = Ppar([~hat_intro, ~res_break, ~string_break]);
487 ~break4 = Ppar([~bd_intro, ~sd_intro, ~hat_intro, ~res_break, ~solo_break2, ~string_break]);
488 ~vamp1 = Ppar([~bd, ~sd, ~hat, ~res_verse, ~solo_vamp1, ~string_vamp1]);
489 ~vamp2 = Ppar([~bd, ~sd, ~hat, ~res_verse, ~solo_vamp2, ~string_vamp2, ~bass_verse]);
493 \instrument, \sinenv,
495 [\freq, \dur, \val, \time], Pseq([[\, 12, 0, 0], [0, 530, 0, 16], [0, 1, 0.05, 8]]),
496 \group, ~mixGroup.nodeID
499 ~masterFaderAuto = Pbind(
500 \instrument, \sinenv,
502 [\freq, \dur, \val, \time], Pseq([[\, 560, 0, 0], [0, 1, 0, 16]]),
503 \group, ~mixGroup.nodeID
510 ~tc = TempoClock.default;
511 ~introSynth = Synth(\intro, [\out, ~ch8], ~synthGroup);
512 SystemClock.sched(30, {
514 //~beat = 0; ~tc.schedAbs(~tc.beats.ceil, { ~beat = ~beat + 1; ~beat.postln; 1 });
515 ~tc.sched(16, { ~tc.tempo = 118 / 60 });
541 Ppar([~fader8auto, ~masterFaderAuto])
546 ~masterFader.set(\mute, 0);
547 ~masterFader.set(\mute, 1);