3 //////////////////////////////////////////////////////////////////////////
6 // analog bubbles - with mouse control
10 MouseY.kr(0.1,10,'exponential'), // lfo 1 rate
11 24, // lfo 1 depth in semitones
12 // lfo 2 in lfo 1's add input :
14 MouseX.kr(2,40,'exponential'), // lfo 2 rate
15 -3, 80 // lfo 2 depth & offset in semitones
17 ).midicps; // convert to frequency
18 CombN.ar(SinOsc.ar(freq, 0, 0.04), 0.2, 0.2, 2) // echoing sine wave
22 //////////////////////////////////////////////////////////////////////////
23 //////////////////////////////////////////////////////////////////////////
26 // sample and hold liquidities
27 // mouse x controls clock rate, mouse y controls center frequency
29 var clockRate, clockTime, clock, centerFreq, freq, panPos, patch;
31 clockRate = MouseX.kr(1, 200, 'exponential');
32 clockTime = clockRate.reciprocal;
33 clock = Impulse.kr(clockRate, 0.4);
35 centerFreq = MouseY.kr(100, 8000, 'exponential');
36 freq = Latch.kr(WhiteNoise.kr(centerFreq * 0.5, centerFreq), clock);
37 panPos = Latch.kr(WhiteNoise.kr, clock);
43 Decay2.kr(clock, 0.1 * clockTime, 0.9 * clockTime)
53 //////////////////////////////////////////////////////////////////////////
56 //////////////////////////////////////////////////////////////////////////
62 gain = MouseX.kr(1,100,'exponential'); // mouse x controls gain into distortion
63 AudioIn.ar([1,2], gain).distort * 0.4
66 //////////////////////////////////////////////////////////////////////////
69 //////////////////////////////////////////////////////////////////////////
72 // ring modulate input
75 input = AudioIn.ar([1,2]);
76 modulator = SinOsc.ar(
77 MouseX.kr(10,4000,'exponential'), // mouse x controls ring mod freq
78 [0,0.5pi] // offset phase ofone osc by 90 degrees
84 //////////////////////////////////////////////////////////////////////////
87 //////////////////////////////////////////////////////////////////////////
90 // ring modulate input using ring1
93 input = AudioIn.ar([1,2], 0.5);
94 modulator = SinOsc.ar(
95 MouseX.kr(10,4000,'exponential'), // mouse x controls ring mod freq
96 [0,0.5pi] // offset phase ofone osc by 90 degrees
98 input ring1: modulator
102 //////////////////////////////////////////////////////////////////////////
105 //////////////////////////////////////////////////////////////////////////
111 rQ = MouseY.kr(0.01, 1, 'exponential'); // bandwidth ratio = 1/Q
113 AudioIn.ar([1,2], 0.4 * rQ.sqrt), // attenuate to offset resonance
114 MouseX.kr(100, 12000, 'exponential'), // mouse x controls cutoff freq
120 //////////////////////////////////////////////////////////////////////////
129 MouseX.kr(0.01, 0.5), // threshold
130 1, // below threshold slope
131 0.1 // above threshold slope
136 //////////////////////////////////////////////////////////////////////////
137 //////////////////////////////////////////////////////////////////////////
143 input = AudioIn.ar([1,2]);
146 MouseX.kr(0.01, 0.5), // threshold
147 10, // below threshold slope
148 1 // above threshold slope
153 //////////////////////////////////////////////////////////////////////////
156 //////////////////////////////////////////////////////////////////////////
162 in = AudioIn.ar([1,2], 0.1);
165 0.5, // max delay time
166 MouseX.kr(0,0.5), // mouse x controls delay time
167 4, // echo 60 dB decay time in seconds
174 //////////////////////////////////////////////////////////////////////////
177 //////////////////////////////////////////////////////////////////////////
180 // ring modulate & echo input
183 in = AudioIn.ar([1,2], 0.4) * SinOsc.ar(MouseX.kr(10,2000,'exponential'), [0,0.5pi]);
187 MouseY.kr(0,0.5), // mouse y controls delay time
188 4, // echo 60 dB decay time in seconds
195 //////////////////////////////////////////////////////////////////////////
196 //////////////////////////////////////////////////////////////////////////
199 // ring modulated and resonant filtered input
201 var input, modulator;
202 input = AudioIn.ar([1,2],0.2);
203 modulator = SinOsc.ar(
204 MouseX.kr(10,4000,'exponential'), // mouse x controls ring mod freq
205 [0,0.5pi] // offset phase ofone osc by 90 degrees
208 input * modulator, // do ring modulation
209 MouseY.kr(100, 12000, 'exponential'), // mouse y controls cutoff freq
210 0.1) // bandwidth ratio = 1/Q
214 //////////////////////////////////////////////////////////////////////////
215 //////////////////////////////////////////////////////////////////////////
218 // distort, ring modulate & echo input - a real noise fest
221 in = AudioIn.ar([1,2], 20).distort.ring1(
222 SinOsc.ar(MouseX.kr(10,2000,'exponential'), [0,0.5pi])
227 MouseY.kr(0,0.5), // mouse y controls delay time
235 //////////////////////////////////////////////////////////////////////////
237 //////////////////////////////////////////////////////////////////////////
244 s = AudioIn.ar([1,2], 0.01) ;
246 // reverb predelay time :
247 z = DelayN.ar(Mix.ar(s), 0.048);
249 // 6 modulated comb delays in parallel :
250 y = Mix.ar(CombL.ar(z, 0.1, LFNoise1.kr(Array.fill(6,{0.1.rand}), 0.04, 0.05), 15));
252 // chain of 4 allpass delays on each of two channels (8 total) :
253 4.do({ y = AllpassN.ar(y, 0.050, [0.050.rand,0.050.rand], 1) });
261 //////////////////////////////////////////////////////////////////////////
264 // monastic resonance
265 // mouse controls size and reverb time
267 var s, z, y, decayTime, delayScale;
269 decayTime = MouseX.kr(0,16);
270 delayScale = MouseY.kr(0.01, 1);
272 s = AudioIn.ar([1,2], 0.005) ;
274 // reverb predelay time :
275 z = DelayN.ar(Mix.ar(s), 0.048);
277 // 8 comb delays in parallel :
278 y = Mix.ar(CombL.ar(z, 0.1, Array.fill(8,{0.04.rand2 + 0.05}) * delayScale, decayTime));
280 // chain of 5 allpass delays on each of two channels (10 total) :
281 5.do({ y = AllpassN.ar(y, 0.050, [0.050.rand,0.050.rand], 1) });
289 //////////////////////////////////////////////////////////////////////////
294 var lfoRate, amp, cfreq, filt;
296 lfoRate = MouseX.kr(10, 60, 'exponential');
297 amp = max(0, LFSaw.kr(lfoRate, -1));
298 cfreq = MouseY.kr(400, 8000, 'exponential');
299 cfreq = SinOsc.kr(0.2, 0, cfreq, 1.05 * cfreq);
300 Resonz.ar(WhiteNoise.ar(amp), cfreq, 0.1) ! 2;
304 //////////////////////////////////////////////////////////////////////////
310 // mouse x controls density
312 var amp, density, dmul, dadd, signal;
314 density = MouseX.kr(0.01,1); // mouse determines density of excitation
316 // calculate multiply and add for excitation probability
317 dmul = density.reciprocal * 0.5 * amp;
318 dadd = dmul.neg + amp;
320 signal = Mix.ar( // mix an array of 4 instruments
322 var excitation, freq;
324 excitation = PinkNoise.ar(
325 // if amplitude is below zero it is clipped
326 // density determines the probability of being above zero
327 max(0, LFNoise1.kr(8, dmul, dadd))
330 freq = Lag.kr( // lag the pitch so it glissandos between pitches
331 LFNoise0.kr( // use low freq step noise as a pitch control
332 [1, 0.5, 0.25].choose, // choose a frequency of pitch change
333 7, // +/- 7 semitones
334 66 + 30.rand2 // random center note
335 ).round(1), // round to nearest semitone
337 ).midicps; // convert to hertz
339 Pan2.ar( // pan each intrument
340 CombL.ar(excitation, 0.02, freq.reciprocal, 3), // comb delay simulates string
341 1.0.rand2 // random pan position
345 // add some reverb via allpass delays
346 5.do({ signal = AllpassN.ar(signal, 0.05, [0.05.rand,0.05.rand], 1) });
347 LeakDC.ar( signal, 0.995); // delays build up a lot of DC, so leak it out here.
355 //////////////////////////////////////////////////////////////////////
359 // use mouse to strum strings
361 var pitch, mousex, out;
363 pitch = [ 52, 57, 62, 67, 71, 76 ];
365 out = Mix.arFill(pitch.size, { arg i;
366 var trigger, pluck, period, string;
367 // place trigger points from 0.25 to 0.75
368 trigger = HPZ1.kr(mousex > (0.25 + (i * 0.1))).abs;
369 pluck = PinkNoise.ar(Decay.kr(trigger, 0.05));
370 period = pitch.at(i).midicps.reciprocal;
371 string = CombL.ar(pluck, period, period, 4);
372 Pan2.ar(string, i * 0.2 - 0.5);
382 //////////////////////////////////////////////////////////////////////
385 // strummable 12 string guitar
386 // use mouse to strum strings
388 var pitch, mousex, out;
390 pitch = [ 52, 57, 62, 67, 71, 76 ];
392 out = Mix.arFill(pitch.size, { arg i;
393 var pos, trigger1, trigger2, pluck1, pluck2, period, string1, string2;
394 // place trigger points from 0.25 to 0.75
395 pos = 0.25 + (i * 0.1);
396 period = pitch.at(i).midicps.reciprocal;
398 trigger1 = HPZ1.kr(mousex > pos).abs;
399 pluck1 = PinkNoise.ar(Decay.kr(trigger1, 0.05));
400 string1 = CombL.ar(pluck1, period, period, 4);
402 trigger2 = HPZ1.kr(mousex > (pos + 0.015)).abs;
403 pluck2 = PinkNoise.ar(Decay.kr(trigger2, 0.05));
404 string2 = CombL.ar(pluck2, period/2, period/2, 4);
406 Pan2.ar(string1 + string2, i * 0.2 - 0.5);
413 //////////////////////////////////////////////////////////////////////
416 //////////////////////////////////////////////////////////////////////
419 // bidirectional strummable guitar
420 // use mouse to strum strings
422 var pitch1, pitch2, mousex, out;
424 pitch1 = [ 52, 57, 62, 67, 71, 76 ];
427 out = Mix.arFill(pitch1.size, { arg i;
428 var trigger, pluck1, pluck2, period1, period2, string1, string2;
429 // place trigger points from 0.25 to 0.75
430 trigger = HPZ1.kr(mousex > (0.25 + (i * 0.1)));
432 pluck1 = PinkNoise.ar(Decay.kr(trigger.max(0), 0.05));
433 period1 = pitch1.at(i).midicps.reciprocal;
434 string1 = CombL.ar(pluck1, period1, period1, 4);
436 pluck2 = BrownNoise.ar(Decay.kr(trigger.neg.max(0), 0.05));
437 period2 = pitch2.at(i).midicps.reciprocal;
438 string2 = CombL.ar(pluck2, period2, period2, -4);
440 Pan2.ar(string1 + string2, i * 0.2 - 0.5);
447 //////////////////////////////////////////////////////////////////////
451 // use mouse to strum strings
453 var pitch, mousex, mousey, out, triggerSpacing, panSpacing;
455 pitch = [ 50, 53.86, 57.02, 59.69, 62, 64.04, 65.86, 67.51, 69.02, 71.69, 72.88, 74 ];
458 triggerSpacing = 0.5 / (pitch.size - 1);
459 panSpacing = 1.5 / (pitch.size - 1);
460 out = Mix.arFill(pitch.size, { arg i;
461 var trigger, pluck, period, string;
462 // place trigger points from 0.25 to 0.75
463 trigger = HPZ1.kr(mousex > (0.25 + (i * triggerSpacing))).abs;
464 pluck = PinkNoise.ar(Decay.kr(trigger, 0.05));
465 period = pitch.at(i).midicps.reciprocal;
466 string = CombL.ar(pluck, period, period, 8);
467 Pan2.ar(string, i * panSpacing - 0.75);
474 //////////////////////////////////////////////////////////////////////
478 // use mouse to strum strings
482 out = Mix.arFill(8, { arg i;
483 var trigger, pluck, period, metal, z, n=15;
484 // place trigger points from 0.25 to 0.75
485 trigger = HPZ1.kr(mousex > (0.25 + (i * 0.07))).abs;
486 pluck = PinkNoise.ar(Decay.kr(trigger, 0.05, 0.04));
488 z = `[ // filter bank specification :
489 y = Array.fill(n, { (300 * i) + 8000.0.linrand} ), // frequencies
490 nil, // amplitudes default to 1.0
491 Array.fill(n, { 1.0 + 4.0.rand }) // ring times
493 metal = Klank.ar(z, pluck);
494 //metal = SinOsc.ar(800, 0, 0.1);
495 Pan2.ar(metal, i * 0.2 - 0.5);
502 //////////////////////////////////////////////////////////////////////
509 out = Mix.arFill(8, { arg i;
510 var trigger, pluck, period, metal, z, n=15, freq;
511 // place trigger points from 0.25 to 0.75
512 trigger = HPZ1.kr(mousex > (0.25 + (i * 0.07))).abs;
513 pluck = PinkNoise.ar(Lag.kr(Trig.kr(trigger, 1), 0.2, 0.01));
514 freq = (#[0, 3, 5, 7, 10, 12, 15, 17].at(i) + 60).midicps;
515 z = `[ // filter bank specification :
516 y = Array.fill(n, { arg j; (j+1) * freq } ), // frequencies
517 nil, // amplitudes default to 1.0
518 Array.fill(n, { 0.2.rand }) // ring times
520 metal = Klank.ar(z, pluck);
521 //metal = SinOsc.ar(800, 0, 0.1);
522 Pan2.ar(metal, i * 0.2 - 0.5);
525 out = LeakDC.ar(out);
526 6.do({ out = AllpassN.ar(out, 0.1, [0.05.rand,0.05.rand], 4) });
531 //////////////////////////////////////////////////////////////////////