Discussion:
UGens outside SynthDef: should we make this work?
Julian Rohrhuber
2014-10-22 21:22:03 UTC
Permalink
I've tried to make UGens work that have been created outside a SynthDefs. In such a way they can be used directly as graphs and then implanted into synth defs as needed.

It seems to work fine, but maybe I've overlooked something important. Any opinions about this? If this is a good idea, I'd also make the NamedControls work outside.

This works:

// two independent synths
a = SinOsc.ar(MouseX.kr(0, 100));
{ SinOsc.ar(a * 500 + 800) * 0.1 }.play;
{ SinOsc.ar(a * 800 + 900) * 0.1 }.play;


// also a ugen from inside one synth def...
(
{
a = SinOsc.ar(MouseX.kr(0, 100));
SinOsc.ar(a * 500 + 800) * 0.1

}.play;
)

// ... can be used in another without interference

{ SinOsc.ar(a * 800 + 900) * 0.1 }.play;


// this would need to be implemented:
a = SinOsc.ar(\freq.kr(100));
{ SinOsc.ar(a * 800 + 900) * 0.1 }.play;


////////////////////////////

// I've added this to UGen:

asUGenInput {
^if(synthDef === buildSynthDef) {
// we are in the same synth definition
this
} {
this.copy.recursivelyAddToSynth
}
}

recursivelyAddToSynth {
inputs = inputs.asUGenInput;
this.addToSynth
}



_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: http://www.listarc.bham.ac.uk/marchives/sc-dev/
search: http://www.listarc.bham.ac.uk/lists/sc-dev/search/

Loading...