{{Short description|Basic formal unit in MUSIC-N-style programming languages}} '''Unit generators''' (or ''ugens'') are the basic formal units in many MUSIC-N-style computer music programming languages.<ref>{{Cite web |title=ChucK - [Language Specification] |url=https://chuck.stanford.edu/doc/language/ugen.html |access-date=2024-11-03 |website=chuck.stanford.edu}}</ref> They are sometimes called opcodes (particularly in Csound),<ref>{{Cite journal |last=Lazzarini |first=Victor |date=2017 |title=Supporting an Object-Oriented Approach to Unit Generator Development: The Csound Plugin Opcode Framework |url=https://mural.maynoothuniversity.ie/11607/ |journal=Applied Sciences |language=en |volume=7 |issue=10 |pages=970 |issn=2076-3417 |doi=10.3390/app7100970|doi-access=free }}</ref> though this expression is not considered accurate in that these are not written directly as machine-level instructions.{{cn|date=November 2024|reason=It would be good to have verification here because this reads more like original research or synth, but I'm not familiar enough with the tech to definitively say.}}

Unit generators form the building blocks for designing synthesis and signal processing algorithms in software.<ref name=supercollider-ugen>{{Cite web |title=UGen {{!}} SuperCollider 3.13.0 Help |url=https://docs.supercollider.online/Classes/UGen.html |access-date=2024-11-03 |website=docs.supercollider.online}}</ref> The unit generator theory of sound synthesis was first developed and implemented by Max Mathews<ref>{{Cite journal |last=Smith |first=Julius |date=2007 |title=Unit-generator architectures in computer music |url=https://www.researchgate.net/publication/252185943 |journal=Journal of the Acoustical Society of America |volume=122 |issue=5 |page=3080 |doi=10.1121/1.2943000}}</ref> and his colleagues at Bell Labs in the 1950s.<ref>{{Cite web |date=2000-04-07 |title=Bell Labs: Background: Bell Labs Text-to-Speech Synthesis: Then and Now |url=http://www.bell-labs.com/news/1997/march/5/2.html |archive-url=https://web.archive.org/web/20000407081031/http://www.bell-labs.com/news/1997/march/5/2.html |archive-date=2000-04-07 |access-date=2024-11-03 |website=bell-labs.com |url-status=dead}}</ref>

== Examples == A simple unit generator called OSC could generate a sinusoidal waveform of a specific frequency (given as an input or argument to the function or class that represents the unit generator). ENV could be a unit generator that delineates a breakpoint function. Thus ENV could be used to drive the amplitude envelope of the oscillator OSC through the equation OSC*ENV. Unit generators often use predefined arrays of values for their functions (which are filled with waveforms or other shapes by calling a specific generator function).

In the SuperCollider language, the .ar method in the SinOsc class<ref>{{Cite web |title=SinOsc {{!}} SuperCollider 3.13.0 Help |url=https://docs.supercollider.online/Classes/SinOsc.html |access-date=2024-11-03 |website=docs.supercollider.online}}</ref> inherits methods from an overarching unit generator class (UGen)<ref name=supercollider-ugen /> that generates a sine wave. The example below makes a sine wave at frequency 440, phase 0, and amplitude 0.5. :<pre><nowiki>SinOsc.ar(440, 0, 0.5);</nowiki></pre>

==See also== *Tuning generator

==References== {{reflist}}

Category:Acoustics software Category:Audio programming languages

{{music-software-stub}}