💾 Archived View for heavysquare.com › noise › 2018-12-01-redFrik-tweet-expansion.sc.txt captured on 2021-12-03 at 14:04:38.

View Raw

More Information

-=-=-=-=-=-=-

// expansion of https://twitter.com/redFrik/status/1066351458646409216
// [quote]
// play{f={|...a|LFTri.perform(\ar,*a)};g=DelayN.perform(\ar,_);c=Splay ar:GVerb.perform(\ar,Splay ar:HPF.perform(\ar,f.(2/b=8.fib.mirror)>f.(1/b),f.(1/b/2)+1.03*3e3),b,5,*f.(1/6.fib/12)+1/2);c+f.(54,[0,1],RLPF.perform(\ar,d=g.(c),999))+RHPF.perform(\ar,g.(d),99)/8}// #SuperCollider
// [/quote]

s.quit
s.options.memSize=65536
s.boot

(
SynthDef(\synth,{|gate=1,out=0,amp=1,vmain=1,vdelayam=1,vdelay2=1|
        // some trigger frequencies, this is [1,1,2,3,5,8,13,21]
        b=8.fib;
        // toggle signals derived as comparison of two triangle signals
        t=LFTri.ar(2/b)>LFTri.ar(1/b);
        // converting toggles into audible clicks w/ HPF (sudden jumps in a signal
        // have high frequency content around them, stationary parts don't);
        // some variance added in register, by varying cutoff frequencies
        a=HPF.ar(t,LFTri.ar(1/b/2)+1.03*3e3);
        // merging the signals so that the less frequent the click, the
        // more volume it gets.. slightly skewed off of mono due to _.mirror
        // gives you an odd number of result elements; nearly mono though bc
        // of the symmetry of _.mirror
        f=Splay.ar(a.mirror);
        
        // feeding a click into a reverb, GVerb here, gives the click a nice
        // tail in time, expanding the event a bit; because of b.mirror below,
        // you can imagine this step as putting the whole series of clicks
        // into rooms of varying size and then mixing the results together with Splay
        c=Splay.ar(GVerb.ar(f,
                roomsize:b.mirror, // array, merged by outer Splay
                revtime:5,
                // below is the expansion of the original *f.(1/6.fib/12)+1/2,
                // which is extremely scary in
                // its original form.. basically you generate an array of signals and you
                // have to know how long it expands into the parameters and what values the
                // elements can get.. otherwise you could easily end up with something
                // unstable and damage your ears (!!) -- I did the error of evaluating
                // *f.(1/6.fib/12+1/2) at some phase of this expansion and nearly got a heart
                // attack.. don't try this at any volume ;)
                damping:LFTri.ar(1/12)+1/2,
                inputbw:LFTri.ar(1/12)+1/2,
                spread:LFTri.ar(1/6)+1/2, 
                drylevel:LFTri.ar(1/4)+1/2,
                earlyreflevel:LFTri.ar(5/12)+1/2,
                taillevel:LFTri.ar(2/3)+1/2
        ));
        // delay lines.. mixing some signal with delayed+filtered[*] versions of it helps
        // building up the sense of cause and effect, so your brain interprets
        // sound as imaginary/abstact things making noise
        d=DelayN.ar(c);
        e=DelayN.ar(d);
        Out.ar(out,
                // the main signal
                (vmain * c)+
                // [*]amplitude modulation (AM), w/ low frequencies
                (vdelayam * LFTri.ar(54,[0,1],RLPF.ar(d,999)))+
                // [*]a second delay/echo w/ the low end cut off
                (vdelay2 * RHPF.ar(e,99))
                /8*amp*EnvGen.kr(Env.asr(releaseTime:0.1),gate,doneAction:2)
        )
}).add;

// 10 seconds of the original playing, then 10-10 seconds of each layer separate
Pdef(\pat,Pmono(\synth,
        \legato,1,
        \amp,1,
        \dur,Pseq([10],4),
        \vmain,  Pseq([1,1,0,0]),
        \vdelaym,Pseq([1,0,1,0]),
        \vdelay2,Pseq([1,0,0,1])
));
)

Pdef(\pat).record("/tmp/2018-12-01.wav",headerFormat:"WAV")