Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: Real-time pattern morphing with Ndef
name
code content
( ~name = "saw"; SynthDef(~name, { arg out=0, amp=0.1, gate=1, pan=0, spread=0.8, freq=200, doneAction=2, ffreq=300, rq=0.3; var sig; sig = LFSaw.ar(freq); sig = RLPF.ar(sig, ffreq, rq); sig = sig * EnvGen.ar(\adsr.kr(Env.adsr(0.01,0.1,0.8,0.1)),gate,doneAction:doneAction); sig = Splay.ar(sig, spread, amp, pan); Out.ar(out, sig); }).add; ~morph = { arg mainkey, lagtime, pat; var base = pat.asStream.next(()); var bind = List.new; var proxy; base.keysValuesDo { arg key, val; var ndefkey = "%.%".format(mainkey, key).asSymbol; Ndef(ndefkey, { Line.kr(Ndef(ndefkey).kr, val, lagtime) }); proxy = Ndef(ndefkey); bind.add(key); bind.add(proxy.bus.asMap); }; Pbind(*bind) }; ) Pdef(~name).play; ( // preset 1 ~a = Pdef(~name, ~morph.(\bla, 2.1, Pbind( \freq, 100, \ffreq, 1300, )) <> Pbind( \instrument, ~name, \dur, 1, )); ); ( // preset 2 ~a = Pdef(~name, ~morph.(\bla, 1, Pbind( \freq, 1500, \ffreq, 200, )) <> Pbind( \instrument, ~name, \dur, 1, )); );
code description
When you understand that Ndef can be used to modulate pattern keys, it opens a whole new world
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