// title: alarms // author: redFrik // description: // i wrote this for a sleeping bag concert in stockholm nov 2010. never set it off in the end as planned. // code: //--set alarms ( ~num= 25; //number of alarms ~fadeTime= 10; //fade in time in seconds ~num.do{|i| Ndef(("alarm"++i).asSymbol, {|amp= 0, lag= 5| var src= Pulse.ar( ExpRand(300, 3000)+LFPulse.kr(ExpRand(3, 30), 0, Rand(0.4, 0.6), Rand(-100, 100)), Rand(0.4, 0.6), LFPulse.kr(LinRand(0.05, 2), 0, LinRand(0.1, 0.5), 0.5) ); Pan2.ar(src, Rand(-0.95, 0.95), amp.lag(lag)); }); }; Ndef.all; //list them ) //--start alarms (takes a while) ( ~task.stop; ~task= Task({ ~num.do{|i| Ndef(("alarm"++i).asSymbol).play(fadeTime: ~fadeTime).set(\amp, 7/~num).postln; i.linlin(0, ~num-1, ~fadeTime*2, ~fadeTime/2).wait; }; }).play; ) //--stop alarms ( ~task.stop; ~task= Task({ ~num.do{|i| Ndef(("alarm"++i).asSymbol).stop(fadeTime: 1/~fadeTime); i.linlin(0, ~num-1, 1/~fadeTime, 10/~fadeTime).wait; }; }).play; )