> On 30.12.2017, at 21:08, ovaltinevortex@xxxxxxxxx wrote:
>
> In sclang, my understanding is that the UGen graph function that you use in a SynthDef needs to return a single UGen object.
…
> If I wanted to express two separate graphs of UGens, I think I would need to create two separate SynthDefs.
No, that’s not how it works. One SynthDef can have multiple UGen graphs.
// e.g.
(
SynthDef(\x, {
Out.ar(8, SinOsc.ar(1871));
Out.ar(0, SinOsc.ar(1919));
}).add
)
You can even have UGen graphs that do not write to an output bus.
> So I'm wondering - is there a way to express disconnected graphs of UGens in a single SynthDef in sclang? Are there any benefits or pitfalls that I should be aware of when creating SynthDefs like this?
When a SynthDef calls the UGen function, it first makes itself available globally through the class variable “buildSynthDef”. All Ugens add themselves to this SynthDef. After this, the SynthDef optimizes the graph, and sets the buildSynthDef back to nil.
Just have a look into SynthDef class definition, you can see the steps there.
Attachment:
signature.asc
Description: Message signed with OpenPGP using GPGMail