Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: fast fm windchimes 4 fealty
name
code content
( var fm,tuner,dist,t=0.08,sine,fx,reverb,weights; fm={ |freq=440, cmRatio=1, index=1, mul=1| var m=freq/cmRatio,d; d=index*m; SinOsc.ar(freq+SinOsc.ar(m,0,d),0,mul) }; tuner={ |key,octave,transpose,detune| (key+(12*octave)+transpose).max(0).midicps+detune }; reverb={ |in,trFB,trFilt| var amp,local; amp = Amplitude.kr(Mix.ar(in)); in = in * (amp > 0.04); in = in * 0.5; local = LocalIn.ar(2) * trFB; local = OnePole.ar(local, trFilt); local = Rotate2.ar(local[0], local[1], 0.237); local = AllpassN.ar(local, 0.05, { Rand(0.01,0.05) }!2); local = DelayN.ar(local, 0.3, { Rand(0.15,0.33) }!2); local = AllpassN.ar(local, 0.05, { Rand(0.03,0.15) }!2); local = LeakDC.ar(local); local = local + in; 4.do({ var t; t={ Rand(0.005,0.02) }!2; local = AllpassN.ar(local, t, t, 1); }); LocalOut.ar(local); local }; SynthDef(\fm, { |key=4,oct=5,cmrDur=1,ndxDur=1,i_dur=1,amp=1,pan=0| Out.ar(0,Pan2.ar(fm.(tuner.(key,oct,0,0),XLine.kr(0.102,0.405,cmrDur), XLine.kr(2.021,0.098,ndxDur),Line.ar(amp,0,i_dur,doneAction:2)),pan)) }).send(s); SynthDef(\reverb,{ |trFB=0.5,trFilt=0.5,wetDry=0.5| XOut.ar(0,wetDry,RLPF.ar(HPF.ar(reverb.(In.ar(0),trFB,trFilt),10000),15000)) }).send(s); SynthDef(\fx,{ |dt1,dec1,dt2,dec2,dt3,dec3,trFB,trFilt,rcSpeed, rcLo,rcHi,rcPhase,rcWidth,fftBuf1,fftBuf2,wetDry| var in=In.ar(0,2),local,amp,chain,rverb; local=in; local=CombN.ar(local,4,Lag.kr(dt2,dt2),dec2); local=CombN.ar(local,4,dt3,dec3); local=CombN.ar(local,4,dt1,dec1); rverb=reverb.(local,trFB,trFilt); chain = FFT([fftBuf1,fftBuf2],local); chain = PV_RectComb(chain,SinOsc.ar(rcSpeed).range(rcLo,rcHi),rcPhase, Lag.kr(rcWidth,t*64)); local = IFFT(chain); XOut.ar(0,wetDry,local+rverb/8) }).send(s); dist={ |lo,hi,dist| (lo+(dist.windex/dist.size*(hi-lo))).clip(lo,hi).asInt }; play(r({ var buf1,buf2; buf1=Buffer.alloc(s,1024); buf2=Buffer.alloc(s,1024); s.sync; fx=Synth(\fx, [ \dt1,t*16, \dec1,t*4, \dt2,t/8, \dec2,t, \dt3,t*8, \dec3,t*4, \trFB,0.5, \trFilt,0.1, \rcSpeed,1/t/128, \rcLo,0, \rcHi,1, \rcPhase,0.999, \rcWidth,0.01, \fftBuf1,buf1.bufnum, \fftBuf2,buf2.bufnum, \wetDry,1 ]); Synth.after(fx,\reverb, [\trFB,1,\trFilt,0.5,\wetDry,0.8]); })); weights=[ [ 0, 0.021, 0.034, 0, 0.944, 0 ], [ 0, 0, 0.236, 0, 0.115, 0.649 ], [ 0.288, 0.696, 0.015, 0.001, 0.001, 0 ], [ 0, 0, 0.647, 0, 0, 0.353 ] ]; Task({ var keyw,div,octHi,octLo; var env=Env([0.0392,1,-0.0196],[0.5,0.5],\sine); var dst={ |i| env[1/32*i] }!32,switch=32,times=3,up=1; dst=dst.normalizeSum; inf.do({ if(up<0,{ up=1; octHi=4; octLo=1; },{ up=1.neg; octHi=8; octLo=6; }); switch=[64,32,16,8,4].choose; (switch*times).do({ |i| var key,oct,cmr,ndx,dur,amp; if(i%switch==0,{ if(coin(0.8), { keyw=weights.choose }, { keyw=normalizeSum({ 1.0.rand }!5) }); div=2.8.rand; octHi=octHi+up; octLo=octLo+up; if(up.isPositive, {t=t*1.3}, {t=t/1.3}) }); key=[ 0,2,5,0,7,10].wchoose(keyw); oct=dist.(octLo,octHi,dst); cmr=[ 0.002, 0.001 ].choose/div; ndx=[ 0.102, 0.051 ].choose*div* [0.06,0.5,0.8,1.2].wchoose([0.5,0.25,0.2,0.025]); dur=[0.3,0.4,0.2,1.6].wchoose([ 0.25, 0.25, 0.25, 0.125])*(9/(i+1)); amp=[ 0.04, 0.313, 0.111 ].choose; s.makeBundle(s.latency,{ Synth(\fm,[\key,key,\oct,oct,\cmrDur,cmr, \ndxDur,ndx,\i_dur,dur,\amp,amp*26,\pan,0.2.rand2 ]); if(i%switch==0,{ fx.set(\dt1,t*[8,1,2,4].wchoose([0.1,0.1,0.4,0.4]), \rcWidth,0.2.rand) }) }); wait(t) }) }) }).play )
code description
oldpatch
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change