1 //////////////////////////////////////////////////////////////////////////
6 f = LFSaw.kr(0.4, 0, 24, LFSaw.kr([8,7.23], 0, 3, 80)).midicps; // glissando function
7 CombN.ar(SinOsc.ar(f, 0, 0.04), 0.2, 0.2, 4) // echoing sine wave
10 //////////////////////////////////////////////////////////////////////////
13 // LFO modulation of Pulse waves and resonant filters
16 RLPF.ar(LFPulse.ar(FSinOsc.kr(0.05,0,80,160),0,0.4,0.05),
17 FSinOsc.kr([0.6,0.7],0,3600,4000), 0.2),
21 //////////////////////////////////////////////////////////////////////////
26 RLPF.ar(LFPulse.ar(SinOsc.kr(0.2, 0, 10, 21), 0.1), 100, 0.1).clip2(0.4)
29 //////////////////////////////////////////////////////////////////////////
33 play({ RHPF.ar(BrownNoise.ar([0.5,0.5], -0.49).max(0) * 20, 5000, 1) })
36 //////////////////////////////////////////////////////////////////////////
41 BPZ2.ar(WhiteNoise.ar(LFPulse.kr(LFPulse.kr(0.09, 0, 0.16, 10, 7), 0, 0.25, 0.1)))
46 BPZ2.ar(WhiteNoise.ar(LFPulse.kr(MouseX.kr(0.2,50), 0, 0.25, 0.1)))
49 //////////////////////////////////////////////////////////////////////////
55 f = 50; // fundamental frequency
56 p = 20; // number of partials per channel
57 z = 0.0; // start of oscil daisy chain
58 offset = Line.kr(0, -0.02, 60); // causes sound to separate and fade
61 f * (i+1), // freq of partial
63 max(0, // clip negative amplitudes to zero
65 6 + [4.0.rand2, 4.0.rand2], // amplitude rate
66 0.02, // amplitude scale
67 offset // amplitude offset
76 //////////////////////////////////////////////////////////////////////////
82 f = 80; // fundamental frequency
83 p = 10; // number of partials per channel
84 z = 0.0; // start of oscil daisy chain
85 trig = XLine.kr([10,10], 0.1, 60); // trigger probability decreases over time
88 f * (i+1), // freq of partial
93 0.02 // trigger amplitude
95 0.005, // grain attack time
96 0.5.rand // grain decay time
104 //////////////////////////////////////////////////////////////////////////
108 // Klank - bank of resonators excited by impulses
110 n = 5; // number of simultaneous instruments
111 p = 15; // number of partials per instrument
112 z = `[ // filter bank specification :
113 Array.fill(p, { 80 + 10000.0.linrand} ), // frequencies
114 Array.fill(p, { 1.0.rand2 }), // amplitudes
115 Array.fill(p, { 0.2 + 8.0.rand } ) // ring times
118 Klank.ar(z, Dust.ar(0.7, 0.04)),
124 //////////////////////////////////////////////////////////////////////////
128 // Klank - excited by noise bursts
131 n = 5; // number of simultaneous instruments
132 p = 8; // number of partials per instrument
133 exciter = Decay.ar(Dust.ar(0.6, 0.001), 3.1, WhiteNoise.ar);
134 spec = Array.fill(2, {
136 Array.fill(p, { 80 + 10000.0.linrand} ),
138 Array.fill(p, { 0.2 + 4.0.rand } )
141 Klank.ar(spec, exciter)
145 //////////////////////////////////////////////////////////////////////////
148 // what was I thinking?
152 max( SinOsc.kr(4, 0, 1, 80),
153 Decay.ar(LFPulse.ar(0.1, 0, 0.05, Impulse.ar(8, 0, 500)), 2)
155 LFNoise1.kr(0.157, 0.4, 0.5),
157 LFNoise1.kr(0.2, 2000, 2400),
161 CombL.ar(y, 0.06, LFNoise1.kr(0.3.rand, 0.025, 0.035), 1)
162 + CombL.ar(y, 0.06, LFNoise1.kr(0.3.rand, 0.025, 0.035), 1)
164 CombL.ar(y, 0.06, LFNoise1.kr(0.3.rand, 0.025, 0.035), 1)
165 + CombL.ar(y, 0.06, LFNoise1.kr(0.3.rand, 0.025, 0.035), 1)
170 //////////////////////////////////////////////////////////////////////////
175 n = 4; // number of sirens
181 SinOsc.kr(0.1.rand + 0.02, 2pi.rand, 600.rand, 1000 + 300.rand2),
183 LFNoise2.ar(100 + 20.0.rand2, 0.1)
188 + LFNoise2.ar(LFNoise2.kr([0.4,0.4], 90, 620), LFNoise2.kr([0.3,0.3], 0.15, 0.18)),
192 //////////////////////////////////////////////////////////////////////////
199 p = 15; // number of partials per channel per 'cymbal'.
200 f1 = 500 + 2000.0.rand;
203 `[ // sine oscil bank specification :
204 y = Array.fill(p, { f1 + f2.rand} ), // frequencies
205 nil, // amplitudes default to 1.0
206 Array.fill(p, { 1.0 + 4.0.rand }) // ring times
209 Klank.ar(z, Decay.ar(Impulse.ar(3.0.rand + 0.5), 0.004, WhiteNoise.ar(0.03)));
213 //////////////////////////////////////////////////////////////////////////
218 n = 6; // number of keys playing
220 Mix.ar(Array.fill(n, { // mix an array of notes
221 var delayTime, pitch, detune, strike, hammerEnv, hammer;
223 // calculate delay based on a random note
224 pitch = (36 + 54.rand);
225 strike = Impulse.ar(0.1+0.4.rand, 2pi.rand, 0.1); // random period for each key
226 hammerEnv = Decay2.ar(strike, 0.008, 0.04); // excitation envelope
228 // array of 3 strings per note
229 Mix.ar(Array.fill(3, { arg i;
230 // detune strings, calculate delay time :
231 detune = #[-0.05, 0, 0.04].at(i);
232 delayTime = 1 / (pitch + detune).midicps;
233 // each string gets own exciter :
234 hammer = LFNoise2.ar(3000, hammerEnv); // 3000 Hz was chosen by ear..
235 CombL.ar(hammer, // used as a string resonator
236 delayTime, // max delay time
237 delayTime, // actual delay time
238 6) // decay time of string
240 (pitch - 36)/27 - 1 // pan position: lo notes left, hi notes right
246 //////////////////////////////////////////////////////////////////////////
249 var a, c, d, s, z, y;
250 // reverberated sine percussion
251 d = 6; // number of percolators
252 c = 5; // number of comb delays
253 a = 4; // number of allpass delays
256 // sine percolation sound :
257 s = Mix.ar(Array.fill(d, { Resonz.ar(Dust.ar(2/d, 50), 200 + 3000.0.rand, 0.003)}) );
259 // reverb predelay time :
260 z = DelayN.ar(s, 0.048);
262 // 7 length modulated comb delays in parallel :
263 y = Mix.ar(CombL.ar(z, 0.1, LFNoise1.kr(Array.fill(c,{0.1.rand}), 0.04, 0.05), 15));
265 // chain of 4 allpass delays on each of two channels (8 total) :
266 a.do({ y = AllpassN.ar(y, 0.050, [0.050.rand,0.050.rand], 1) });
268 // add original sound to reverb and play it :
272 //////////////////////////////////////////////////////////////////////////
275 // reverberated noise bursts
276 var a, c, d, s, z, y;
278 // pink noise percussion sound :
279 s = Decay.ar(Dust.ar(0.6, 0.2), 0.15, PinkNoise.ar);
281 // reverb predelay time :
282 z = DelayN.ar(s, 0.048);
284 // 6 modulated comb delays in parallel :
285 y = Mix.ar(CombL.ar(z, 0.1, LFNoise1.kr(Array.fill(6,{0.1.rand}), 0.04, 0.05), 15));
287 // chain of 4 allpass delays on each of two channels (8 total) :
288 4.do({ y = AllpassN.ar(y, 0.050, [0.050.rand,0.050.rand], 1) });
290 // add original sound to reverb and play it :
294 //////////////////////////////////////////////////////////////////////////
297 // sample and hold liquidities
298 // mouse x controls clock rate, mouse y controls center frequency
300 var clockRate, clockTime, clock, centerFreq, freq, panPos, patch;
302 clockRate = MouseX.kr(1, 200, 1);
303 clockTime = clockRate.reciprocal;
304 clock = Impulse.kr(clockRate, 0.4);
306 centerFreq = MouseY.kr(100, 8000, 1);
307 freq = Latch.kr(WhiteNoise.kr(centerFreq * 0.5, centerFreq), clock);
308 panPos = Latch.kr(WhiteNoise.kr, clock);
314 Decay2.kr(clock, 0.1 * clockTime, 0.9 * clockTime)
324 //////////////////////////////////////////////////////////////////////////
327 // sweepy noise - mouse controls LFO
329 var lfoDepth, lfoRate, freq, filtered;
330 lfoDepth = MouseY.kr(200, 8000, 'exponential');
331 lfoRate = MouseX.kr(4, 60, 'exponential');
332 freq = LFSaw.kr(lfoRate, 0, lfoDepth, lfoDepth * 1.2);
333 filtered = RLPF.ar(WhiteNoise.ar([0.03,0.03]), freq, 0.1);
334 CombN.ar(filtered, 0.3, 0.3, 2, 1, filtered);
338 //////////////////////////////////////////////////////////////////////////
342 var a, a0, a1, b, c, pan;
343 a0 = 200.0.rand + 40;
347 c = [a0 + 1.0.rand2, a1 + 1.0.rand2];
348 SinOsc.ar(SinOsc.ar(a, 0, 1.0.rand * b, b), 0, SinOsc.kr(c, 0, 0.05, 0.05))
352 //////////////////////////////////////////////////////////////////////////
357 // mouse x controls density
360 var amp, density, dmul, dadd, signal;
362 density = MouseX.kr(0.01,1); // mouse determines density of excitation
364 // calculate multiply and add for excitation probability
365 dmul = density.reciprocal * 0.5 * amp;
366 dadd = dmul.neg + amp;
368 signal = Mix.ar( // mix an array of 4 instruments
370 var excitation, freq;
372 excitation = PinkNoise.ar(
373 // if amplitude is below zero it is clipped
374 // density determines the probability of being above zero
375 max(0, LFNoise1.kr(8, dmul, dadd))
378 freq = Lag.kr( // lag the pitch so it glissandos between pitches
379 LFNoise0.kr( // use low freq step noise as a pitch control
380 [1, 0.5, 0.25].choose, // choose a frequency of pitch change
381 7, // +/- 7 semitones
382 66 + 30.rand2 // random center note
383 ).round(1), // round to nearest semitone
385 ).midicps; // convert to hertz
387 Pan2.ar( // pan each intrument
388 CombL.ar(excitation, 0.02, freq.reciprocal, 3), // comb delay simulates string
389 1.0.rand2 // random pan position
393 // add some reverb via allpass delays
394 5.do({ signal = AllpassN.ar(signal, 0.05, [0.05.rand,0.05.rand], 1) });
395 LeakDC.ar( signal, 0.995); // delays build up a lot of DC, so leak it out here.
399 ////////////////////////////////////////////////////////////////////////////////////////////////
404 r = LFNoise0.kr(rrand(0.2,1.0), 1,1).squared * MouseX.kr;
407 Array.fill(n, { exprand(1.0,20.0) }),
409 Array.fill(n, { 0.2.rand })
411 Blip.ar(r, [rrand(2,5),rrand(2,5)], 0.1)
412 ).fold2(0.2).cubed * 12;
413 mix = Mix.arFill(3, { CombL.ar(mix, 0.1, 0.03.linrand, 4.0.linrand) });
414 out = mix.distort * 0.5;
415 6.do({ out = AllpassN.ar(out, 0.05, [0.05.rand, 0.05.rand], 3) });
416 out = LeakDC.ar(out);
420 ////////////////////////////////////////////////////////////////////////////////////////////////
427 var trig, p, exc, x, freq, s;
429 scale = #[0,2,4,5,7,9,11];
431 freq = (scale.choose + #[24,36,48,60,72,84].choose + root).midicps;
434 Impulse.kr(#[0.125,0.25,0.375,0.5,0.75,1,1.5,2,3,4].choose,0,[0.05,0.05]
437 Array.series(16, freq, freq),
438 Array.geom(16,1,rrand(0.7,0.999)),
439 Array.fill(16, {rrand(0.1,2.5)})
440 ], exc) * 0.1).softclip;
444 ///////////////////////////////////////////////////////////////////////////////////////////////
450 var trig, p, n, exc, x, base, range;
453 scale = #[0,2,4,5,7,9,11];
455 exc = BrownNoise.ar([0.007,0.007]) * max(0, LFNoise1.kr(exprand(0.125,0.5), 1.25, -0.25));
456 s = (Klank.ar(`[Array.fill(n, {(scale.choose + #[36,48,60,72,84].choose + root).midicps}),nil,Array.fill(n, {rrand(0.1,2.0)})], exc) * 0.1).softclip;
460 ///////////////////////////////////////////////////////////////////////////////////////////////
466 var trig, s, p, n, exc, x, base, range;
468 base = exprand(60,4000);
469 range = rrand(500.0,8000.0);
470 exc = BrownNoise.ar([0.007,0.007]) * max(0, LFNoise1.kr(exprand(0.125,0.5), 0.75, 0.25));
471 s = (Klank.ar(`[Array.fill(n, {linrand(range)+base}),nil,Array.fill(n, {rrand(0.1,2.0)})], exc) * 0.1).softclip;
475 ///////////////////////////////////////////////////////////////////////////////////////////////
481 var trig, p, s, exc, x, freq;
484 scale = #[0,2,4,5,7,9,11];
485 freq = (scale.choose + #[24,36,48,60,72,84].choose + root).midicps;
486 exc = BrownNoise.ar([0.007,0.007]) * max(0, LFNoise1.kr(exprand(0.125,0.5), 0.6, 0.4));
488 Array.series(12, freq, freq),
489 Array.geom(12,1,rrand(0.7,0.9)),
490 Array.fill(12, {rrand(1.0,3.0)})
491 ], exc) * 0.1).softclip;
495 ///////////////////////////////////////////////////////////////////////////////////////////////
501 var trig, p, exc, x, freq;
503 scale = #[0,2,4,5,7,9,11];
504 freq = (scale.choose + #[84,96].choose + root).midicps;
505 exc = BrownNoise.ar([0.05,0.05]) * max(0, SinOsc.kr(exprand(0.125,0.5), 2pi.rand));
510 ], exc) * 0.1).softclip;
514 ///////////////////////////////////////////////////////////////////////////////////////////////
520 var trig, p, exc, x, s;
521 exc = BrownNoise.ar(Decay2.kr(Impulse.kr(#[0.125,0.25,0.375,0.5,0.75,1,1.5,2].choose,0,[0.04,0.04]), 0.005, 0.05));
522 s = (Klank.ar(`[Array.fill(16, {linrand(8000.0)+60}),nil,Array.fill(16, {rrand(0.1,2.0)})], exc) * 0.1).softclip;
526 ///////////////////////////////////////////////////////////////////////////////////////////////
532 LFSaw.ar((LFPulse.kr(0.06,0,0.5,2,34 + {0.1.rand2}.dup)).midicps, 0, 0.01)
534 r = MouseY.kr(0.1,0.7);
535 f = LinExp.kr(SinOsc.kr(0.07),-1,1,300,5000);
536 x = RLPF.ar(x, f, r).softclip;
537 x = RLPF.ar(x, f, r).softclip;
544 SinOsc.ar(rrand(24,108).midicps, 2pi.rand,
546 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.1)).max(0)
547 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.1)).abs
557 HPZ1.ar(LFTri.ar(rrand(24,128).midicps, 2pi.rand,
559 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.04)).max(0)
560 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand])).abs
569 LPZ2.ar(LFPulse.ar(80 * rrand(1,32), 2pi.rand, 0.1,
571 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.04)).max(0)
572 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand])).abs
575 2.do({ x = AllpassN.ar(x, 0.05, [0.05.rand,0.05.rand], 3.0.rand, 2); });
585 LPZ2.ar(LFPulse.ar(80 * (1 + 32.linrand), 2pi.rand, 0.1,
587 Mix.ar(SinOsc.ar(0.125 * [2**rrand(0,6),2**rrand(0,6)], [2pi.rand,2pi.rand], 0.04)).max(0)
588 * Mix.ar(SinOsc.ar(4 * [rrand(1,6),rrand(1,6)], [2pi.rand,2pi.rand])).abs
591 2.do({ x = AllpassN.ar(x, 0.05, [0.05.rand,0.05.rand], 4.0.rand, 2); });
601 BPZ2.ar(LFPulse.ar(120 * 100.rand, 2pi.rand, 0.5,
603 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.04)).max(0)
604 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand])).abs
613 Resonz.ar(LFPulse.ar(exprand(50,600), 2pi.rand, 0.5,
615 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.1)).max(0)
616 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand])).abs
617 ), exprand(100,2000), 0.2), 1.0.rand2);
625 RLPF.ar(LFPulse.ar(exprand(50,600), 2pi.rand, 0.5,
627 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.1)).max(0)
628 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand])).abs
629 ), exprand(100,2000), 0.2), 1.0.rand2);
633 { SinOsc.ar(exprand(100,6000), 0, LFNoise2.ar(exprand(4,24),[0.07,0.07])) }.play;
639 RLPF.ar(LFPulse.ar(exprand(50,600), 2pi.rand, 0.5,
641 Mix.ar(SinOsc.ar(exprand(0.3,8) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand], 0.1)).max(0)
642 * Mix.ar(SinOsc.ar(exprand(6,24) * [rrand(0.7,1.3),1], [2pi.rand,2pi.rand])).abs
643 ), exprand(100,2000), 0.2), 1.0.rand2);
647 /////////////////////////////////////////////////////////////////////////////////
653 freq = LFPulse.kr(20.0.rand, 0, 1.0.rand,
654 LFPulse.kr(4.0.rand, 0, 1.0.rand, 8000.rand, 2000.rand));
655 freq = freq + LFPulse.kr(20.0.rand, 0, 1.0.rand,
656 LFPulse.kr(4.0.rand, 0, 1.0.rand, 8000.rand, 2000.rand));
657 x = LFPulse.ar(freq+[0.5,0.5].rand2, 0, 0.5, 0.15, -0.05);
658 AllpassN.ar(x, 0.05, [0.05,0.05].rand, 0.3);
664 var out, lfoDepth, lfoRate, freq, filtered;
665 lfoDepth = MouseY.kr(200, 8000, 1);
666 lfoRate = MouseX.kr(4, 60, 1);
667 freq = LFSaw.kr(lfoRate, 0, lfoDepth, lfoDepth * 1.2);
668 filtered = RLPF.ar({WhiteNoise.ar(0.03)}.dup, freq, 0.1);
669 out = CombN.ar(filtered, 0.3, 0.3, 2, 1, filtered);
674 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
677 // adding many things to the top level spawn.
681 amp = LFPulse.kr(4,0,0.1,0.002);
682 exc = LPZ1.ar(GrayNoise.ar([amp,amp]));
683 Klank.ar(`[FloatArray.fill(4, { rrand(80.0,400.0) }),
685 FloatArray[1, 1, 1, 1]], exc);
692 amp = LFPulse.kr(8,0,0.1,0.002);
693 exc = LPZ1.ar(GrayNoise.ar([amp,amp]));
694 Klank.ar(`[FloatArray.fill(4, { rrand(80.0,400.0) }),
696 FloatArray[1, 1, 1, 1]], exc).abs;
702 CombN.ar(LPF.ar(LFNoise0.ar(MouseX.kr([300,2200])*[1,1.1],LFPulse.kr(1,0,0.3,0.1)), 800).abs, 0.2, [0.2,0.17], 5);
709 amp = LFPulse.kr(0.5,0,0.5);
710 my = MouseY.kr(400,3200);
713 x = Formlet.ar(Dust.ar(12,[0.05,0.05]) * amp, my * exprand(0.5,2.0), 0.005, 0.1);
714 AllpassN.ar(x, 0.05,0.05.rand, 8);