What lies underneath UGens

Hello everyone!
I’d like to see what is running inside some of the most basic UGens like SinOsc or WhiteNoise and some more complicated extention like PV_Morph, but how can I do it?
In the UGens help I can only find partial information, for example SinOsc’s help refer to:

Source: Osc.sc

but if I try to open the file Osc.sc I can only see:

Osc : PureUGen {
	*ar {
		arg bufnum, freq=440.0, phase=0.0, mul=1.0, add=0.0;
		^this.multiNew('audio', bufnum, freq, phase).madd(mul, add)
	}
	*kr {
		arg bufnum, freq=440.0, phase=0.0, mul=1.0, add=0.0;
		^this.multiNew('control', bufnum, freq, phase).madd(mul, add)
	}
}

SinOsc : PureUGen {
	*ar {
		arg freq=440.0, phase=0.0, mul=1.0, add=0.0;
		^this.multiNew('audio', freq, phase).madd(mul, add)
	}
	*kr {
		arg freq=440.0, phase=0.0, mul=1.0, add=0.0;
		^this.multiNew('control', freq, phase).madd(mul, add)
	}
}
etc..

And that they implement methods from the upperclass PureUGen that points me to Source: UGen.sc but I can’t see anything that let me understand how SinOsc produce sound (the same apply to the other UGens).
The goal of this research is to find out what lies underneath the PV_Morph UGen and try to understand it :sweat_smile:
Thank you

Ugen sources are C++ - find them here:

PV Ugen :

1 Like

^^ semiquaver is right :+1:

Probably the easiest way to find which source file contains a specific UGen is to go to https://github.com/supercollider/supercollider and use the search box at top left – look for “UGenName_Ctor” – e.g.

1 code result in supercollider/supercollider or view all results on GitHub
server/plugins/NoiseUGens.cpp

SC help includes http://doc.sccode.org/Guides/WritingUGens.html – but this is more a high-level overview. If you can get ahold of The Supercollider Book, IIRC there’s a chapter about writing UGens that goes into more detail.

hjh

1 Like

Thank you both! I’ll dig deep into these :smiley: