Wrap a UGen in a Function?

so {SinOsc.ar(400)} is a function that returns a UGen…

is there any method I can call on a UGen that wraps it in a function?

I want to write something like a = SinOsc.ar(300).wrap and then for example a.play

My efforts to define such a method have not been successful!


That won’t be supported. The UGen creation must occur within the SynthDef function. There is no way to create a UGen object outside of a SynthDef function and then import it into a SynthDef.

Edit: Maybe you could add a play method to the Message class, e.g. Message(SinOsc, \ar, [400]).