// title: envio // author: vividsnow // description: // synthdef based on morphing cycled envelope // code: ( // synth SynthDef(\envio, {| out=0, freq=80, dur=1, atk=0.1, amp=0.8, curve= #[2,-3], blend=0.1, from=1, to=0, rot=0, rot_freq=0.5 | var ha = Harmonics((3,5..13).choose.debug('sub freq size')); var i = 6.exprand(26).asInteger.debug('oscillators'); var sig = Pan2.ar( EnvGen.ar( Env( [0] ++ SinOsc.kr( NamedControl.kr(\in_freq, Array.exprand(i-2,0.1,10)), NamedControl.kr(\in_phase, Array.rand(i-2,0,pi)), NamedControl.kr(\in_mul, Array.rand(i-2,0,1)), NamedControl.kr(\in_add, 0!(i-2)), ) ++ [0], NamedControl.kr(\in_step, Array.exprand(i-1, 0.1,1.0).normalizeSum), \sin ).circle, timeScale: freq.reciprocal * NamedControl.kr(\sub_freq, ha.formant(ha.size - 1 / 2, ha.size).pow(1.exprand(2))).reciprocal, levelScale: AmpCompA.kr(NamedControl.kr(\sub_freq) * freq) * NamedControl.kr(\sub_amp, ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3)).normalizeSum) // * Line.kr() ), NamedControl.kr(\sub_pan, Array.interpolation(ha.size,-1,1)) * Line.kr(from,to,dur) ).sum * EnvGen.kr(Env.perc(atk, dur-atk, amp, curve).blend(Env.sine(dur), blend), doneAction:2); sig = Rotate2.ar(sig[0],sig[1],rot*LFSaw.kr(rot_freq)); Out.ar(out, LPF.ar(HPF.ar(sig,20),2e4)); }).add.play ) ( // randomized usage var lib = SynthDescLib.global, size = lib.at(\envio).controls.detect({|i| i.name == \in_step }).numChannels, ha = Harmonics(lib.at(\envio).controls.detect({|i| i.name == \sub_freq }).numChannels), kind = [0,1,2].choose.debug('kind'); Synth(\envio,[ freq:(40 * (pi/2).pow((0.25,0.5..8)).choose).debug('base freq'), dur:5.rrand(20.1).debug('dur'), rot:[0,1,0.1.exprand(0.9)].choose, rot_freq:0.1.exprand(10), curve:[-2.rrand(2.0),-2.rrand(2.0)], from:[0,1].choose, to:[0,1].choose, sub_freq: [ ha.geom((1.05,1.06..1.3).choose.perform(0.5.coin.if({\reciprocal},{\value}))), // up or down ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3)).pow([1,-1].choose), // up or down ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3)).clump(ha.size + 1 / 2).pow([1,-1]).flatten // up and down ][kind].debug('sub freq scale'), sub_amp: [ha.decay].addAll(ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3))!2).at(kind).normalizeSum.debug('sub freq amp'), sub_pan:[ha.decay - 1 * [1,-1]].addAll(Array.interpolation(ha.size,-1,1)!2).at(kind), in_step:Array.exprand(size-1,0.05,0.3).normalizeSum, in_freq:Array.exprand(size, [0.1,0.5].choose, [1,5,20].choose), in_mul:Array.rand(size,0.1,0.3), //in_mull:0!size //in_add:Array.rand(size,-1.0,1) ]) ) ( // noise pattern usage or supernova server performance test ) var lib = SynthDescLib.global, size = lib.at(\envio).controls.detect({|i| i.name == \in_freq }).numChannels, ha = Harmonics(lib.at(\envio).controls.detect({|i| i.name == \sub_freq }).numChannels); PparGroup(Pbind(*[ instrument:\envio, in_freq:Ptuple({Pseq({Array.exprand(size, 1, 2)}!4,inf)}!2), in_mul:Ptuple({Pseq({Array.exprand(size, 0.1, 1)}!4,inf)}!2), in_step:Ptuple({Pseq({Array.exprand(size-1,0.05,0.3.rrand(1)).normalizeSum}!4,inf)}!2), sub_freq: Ptuple({Pseq([ ha.geom((1.05,1.06..1.3).choose.perform(0.5.coin.if({\reciprocal},{\value}))), // up or down ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3)).pow([1,-1].choose), // up or down ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3)).clump(ha.size + 1 / 2).pow([1,-1]).flatten // up and down ],inf)}!2), sub_amp: Ptuple({Pseq([ha.decay].addAll(ha.formant(ha.size - 1 / 2, ha.size).pow(1.0.exprand(3))!2).collect({ |i| i.normalizeSum }),inf)}!2), sub_pan: Ptuple({Pseq([ha.decay - 1 * [1,-1]].addAll(Array.interpolation(ha.size,-1,1)!2), inf)}!2), note:Ptuple([ Pseq(Array.rand(2.rrand(8),0,11), inf), Pseq(Array.rand(4.rrand(8),12,35), inf) ]), octave:Ptuple(Pseq((3..7).sputter.scramble.mirror2,inf)!2), delta:Prand([1/4,1,2,4,8].stutter.sputter.wrapExtend(16).scramble,inf), //delta:Pseq([4,8],inf), //delta:2, dur:Pfunc({ |e| e.delta * thisThread.clock.beatDur * 1.exprand(3) }), scale:Scale.choose, //curve:Ptuple(Pbrown(-2,2)!2), amp:Pseq([[0.4,0.4]],inf) * Pseq(Array.rand(16,0,1)/2+Array.rand(16,0.25,0.5),inf), rot:Ptuple(Pstutter(Pwhite(1,8), Prand([0,1],inf))!2), rot_freq:Ptuple(Pstutter(Pwhite(1,8), Pwhite(0.1,4))!2), blend:Ptuple(Pbrown(0.1,0.9)!2), from:Ptuple(Pstutter(Pwhite(1,8), Pwhite(0,1.0))!2), to:Ptuple(Pstutter(Pwhite(1,8), Pwhite(0,1.0))!2), curve:Ptuple(Ptuple(Pbrown(-2,2,0.3)!2)!2) ])).play(TempoClock(1)); )