SynthDefs
Sending a SynthDef to a Server
SynthDefs are templates for Synths, which are sent to a server:
// define a SynthDef and send it to the server ( SynthDef(\sine_example, { // define arguments of the SynthDef |f = 100, a = 1| // calculate a sine wave with frequency and amplitude var x = a * SinOsc.ar(f); // send the signal to the output bus '0' Out.ar(0, x); }).send(s); )
Create a Synth from a SynthDef
Once a SynthDef has been sent to the server, instances can be created:
// create a synth from the SynthDef ~my_synth = Synth(\sine_example, [\f, 1000, \a, 1]); // create another synth from the SynthDef ~another_synth = Synth(\sine_example, [\f, 1100, \a, 1]);
Changing Synth Parameters
All parameters defined in the SynthDef of running synths can be changed, using the associated variable on the client side:
// set a parameter ~my_synth.set(\f,900);