7: SuperCollider - SynthDefs


Zie hieronder de presentatie uit de les:

Sysbas1B les 8 - SuperCollider - SynthDef.pdf

En hier de code uit de les:

Server.default.options.sampleRate = 44100;
Server.default.options.outputs = 4;
s.boot;
s.quit;
(
SynthDef(\myfirstsynth,{ |amp = 0.5, freq = 330|
  var sig, mod, env, verb;
  env = EnvGen.ar(Env.perc(0.001,2,amp), 1);
  sig = LFSaw.ar(freq.lag(1),0,1);
  mod = SinOsc.ar(0.5,0,100,500);
  sig = BLowPass.ar(sig,mod,0.5);
  sig = sig * env;
  verb = FreeVerb.ar(sig,0.5,0.95,0.3);
  DetectSilence.ar(verb,doneAction:2);
  Out.ar(0,verb!2);
}).add;
)

~synth = Synth(\myfirstsynth,[\freq,300,\amp,0.3]);
~synth.set(\amp,0.1,\freq,1);
~synth.free;

EnvGen.ar(Env)