2 summary:: Mark Polishook tutorial
3 categories:: Tutorials>Mark_Polishook_tutorial
4 related:: Tutorials/Mark_Polishook_tutorial/00_Introductory_tutorial
8 Use the SynthDef class to build the engines for synths that will run on the server. The engines, which can be saved to disk and reused, are analogous to presets on commercial hardware and software synthesizers.
10 When notated as code in client programs, the engines have two essential parts: a name and a function. In the jargon of SuperCollider, the function is called a ugenGraphFunc.
12 The term ugenGraphFunc derives from the notion of a graph, which is the data structure that SuperCollider uses to organize unit generators. SuperCollider constructs the graph for you from the code it finds in your function which means that don't have to know how a graph works or that it even exists.
14 If you wish to know more about graphs, visit the Wikipedia at
16 http://en.wikipedia.org/wiki/Graph_(data_structure)
20 http://www.nist.gov/dads/HTML/graph.html
24 Here's a template for a synthdef showing that it consists of a name and a ugenGraphFunc
28 "aSynthDef", // the 1st argument is the name
29 { .... i am a ugenGraphFunc ... } // the 2nd argument is the ugenGraphFunc
33 To make the template functional
36 ## put code into the ugenGraphFunc
37 ## send a .load message to the synthdef
43 "aSynthDef", // the name of the synthdef
44 { // the ugenGraphFunc with actual code
48 SinOsc.ar(freq, 0, 0.1)
55 section::The .load message and the variable 's'
57 The .load message writes synthdefs to disk and also sends them to the default server. The default server is defined by SuperCollider at startup time (as the localhost server) at which point it's also assigned to the variable 's'.
59 section::The .send message and a remote server
61 On the other hand, .send message,
64 SynthDef( .... ).send(s);
67 instead of a .load message
70 SynthDef( .... ).load(s);
73 is another way to get a synthdef to a server. The .send message, unlike the .load message, doesn't first write the synthdef to disk; instead it just transmits the synthdef directly to the server. This is therefore the message to use to define a synthdef on one computer but send it to another.
80 "aRemoteServerOnAnotherMachine",
81 NetAddr("... an ip # ...", 57110) // a server on another computer
83 SynthDef( .... ).send(aServer);
88 Since this tutorial was written, another general purpose method was added to SynthDef. It is called strong::.add:: and will be the new recommended standard instead of .load and .send.
91 section::SynthDef browsers
93 Use the synthdef browser to examine synthdefs that have been written to disk.
97 // a synthdef browswer
98 SynthDescLib.global.read;
99 SynthDescLib.global.browse;
103 The middle box (in the top row) shows the names of synthsdefs. Each name, when selected, causes the other boxes to display the ugens, controls, and inputs and outputs for a particular synthdef.
105 The box labeled "SynthDef controls" is useful because it shows the arguments that can be passed to a given synthdef.
107 The browser shows that the synthdef defined above - "aSynthDef" - is composed from four ugens, one control, no inputs, and one output. The four ugens include instances of Control, SinOsc, BinaryOpUGen, and Out classes.
109 The one control is "freq". A control is an argument that a synth can use when it is created or at any time while it (the synth) exists on the server. The browser also shows that "aSynth" has no inputs (which means that it doesn't use data from audio or control buses) and that it sends one channel of audio out to an audio Bus.
111 ////////////////////////////////////////////////////////////////////////////////////////////////////
113 For further context, see the link::Classes/SynthDef::, link::Classes/In::, link::Classes/Out::, link::Classes/SinOsc::, link::Classes/Control::, link::Classes/BinaryOpUGen:: files in the SuperCollider help system.
116 ////////////////////////////////////////////////////////////////////////////////////////////////////
118 go to link::Tutorials/Mark_Polishook_tutorial/08_Rates::