Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: FxChain class
name
code content
FxChain { classvar <>numSpeakers=2; classvar <>server; var <>fadeInTime,<>level, <>fadeOutTime, <>out, <>group; var <in, <fx, bus, <gain; var fxGroup, gainGroup; *new {|fadeInTime=1, level=1.0, fadeOutTime=1, out=0, group| ^super.newCopyArgs(fadeInTime, level, fadeOutTime, out, group).init; } init { server = server ? Server.default; bus = List.new(); fx = List.new(); group = group ? Group.new; bus.add(Bus.audio(server, numSpeakers)); in = bus[0]; } add {|... args| var synth, p, name, params, inbus, outbus; name = args[0]; bus.add(Bus.audio(server, numSpeakers)); inbus = bus[bus.size-2]; outbus = bus.last; params = args[1]; p = [ \in, inbus, \out, outbus ] ++ params; synth = Synth.tail(group, name, p); fx.add(synth); } addPar {|... fxList| var inbus, outbus, synths; bus.add(Bus.audio(server, numSpeakers)); inbus = bus[bus.size-2]; outbus = bus.last; fxList.postln; fxList.do({|i, idx| var synth; if (i.class==Symbol) { var name = i, params, p; if (fxList[idx+1].isArray){ params = fxList[idx+1]; }; p = [ \in, inbus, \out, outbus] ++ params; synth = Synth.tail(group, name, p); synths = synths.add(synth); }; }); fx.add(synths); } play { var gainBus; if(fx.isEmpty){ gainBus = in }{ gainBus = bus.last }; gain = NodeProxy.new(server, \audio, numSpeakers, gainBus); gain.play(out, numSpeakers, group, vol: level, fadeTime: fadeInTime); } free { gain.clear(fadeOutTime); SystemClock.sched(fadeOutTime, { group.free; bus.do(_.free); in.free; }); } }
code description
A relatively lightweight way for me to quickly add effects. Not very advanced, but it gets the job done. The effect synths are supposed to do the job of mixing wet/dry signal and so forth. Usage: create an instance of FxChain, and then start addding effects in the required sequence. One nifty feature is the ability to add also effects in parallel. Handy for f.x. multitap delays. When all the effects are added, call .play. TODO: make it possible to add and remove effects while running. This is not a high priority though, as I'm not in the live coding business (yet).
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