Hello Phausto
Lesson 1 The minimal Phausto program. A sine wave oscillator at 440 Hz (A4), wrapped in a DSP object and started.
In Phausto, every sound is built from Unit Generators (UGens). To hear a UGen, you must wrap it in a DSP object, initialise it, and start it. Evaluate these lines one at a time in a Playground:
"Create a new SineWave Oscillator — default frequency is 440 Hz (A4)"
sine := SineOsc new.
"Wrap it in a DSP object"
dsp := sine asDsp.
"Initialise the DSP (compiles the FAUST code to native audio)"
dsp init.
"Start playback — you should now hear the tone"
dsp start.
"Stop the sound"
dsp stop.
The DSP Lifecycle
Every Phausto patch follows the same four-step lifecycle:
asDsp to get a DSP object.dsp init compiles the FAUST DSP to native code and allocates audio buffers.dsp start begins audio output. The DSP runs on a separate audio thread.dsp stop halts audio. Call dsp destroy to free native resources when done.| Message | Effect |
|---|---|
| asDsp | Wrap UGen chain in a DSP object (mono) |
| stereo asDsp | Wrap with stereo output |
| dsp init | Compile and allocate |
| dsp start | Begin audio playback |
| dsp stop | Halt audio output |
| dsp destroy | Free native resources |
Hello Stereo
Lesson 2 Most instruments need a stereo output. Add stereo before asDsp to duplicate the signal to both channels.
"Create a Sawtooth oscillator"
saw := SawOsc new.
"Create a STEREO DSP — notice 'stereo' before 'asDsp'"
dsp := saw stereo asDsp.
dsp init.
dsp start.
dsp stop.
stereo for instruments you plan to run through effects chains. Effects like GreyHole and Freeverb expect stereo input.
Unit Generators 101
Lesson 3 Unit Generators are the atoms of synthesis in Phausto — oscillators, noise generators, envelopes, filters, effects, physical models. All UGens share a common interface.
"White noise is the simplest signal source"
noise := Noise new.
dsp := noise stereo asDsp.
dsp init.
dsp start.
"All UGens have a 'uLevel' parameter — linear volume control"
"Open its UI to see the knob"
dsp displayUI.
dsp stop.
UGen categories
| Category | Examples |
|---|---|
| Oscillators | SineOsc, SawOsc, TriOsc, SquareOsc, PulseOsc |
| Noise | Noise |
| Envelopes | ADSREnv |
| Filters | MoogVcf, PhSvfLp, PhModeFilter |
| Effects | GreyHole, Freeverb |
| Physical Models | Djembe, Marimba, ElecGuitar |
| LFOs | LFOTriPos, LFORandomPos |
| Pulse generators | Pulse, Pulsen |
| FM operators | Dx7Op |
uLevel: setter for linear amplitude. Human loudness perception is logarithmic, so small uLevel changes sound more dramatic at lower values.
At the Controls
Lesson 4 Change UGen parameters in real time with setValue:parameter:, or inspect what parameters are available with traceAllParams.
"PulseOsc is a square oscillator with a variable duty cycle"
pulse := PulseOsc new.
dsp := pulse asDsp.
dsp init.
dsp start.
"Change the duty cycle while running"
dsp setValue: 0.2 parameter: 'PulseOscDuty'.
"Change the frequency"
dsp setValue: 120 parameter: 'PulseOscFreq'.
"See all available parameters for this DSP"
dsp traceAllParams.
dsp stop.
"Set a named DSP parameter in real time.
aNumber — the new value.
aString — exact FAUST parameter label (check traceAllParams or class comments)."
dsp setValue: 440 parameter: 'SineOscFreq'.
"Print all parameter labels and current values to the Transcript."
dsp traceAllParams.
dsp traceAllParams after init.
Display the UI
Lesson 5 FAUST generates a UI automatically from the slider and button definitions in each module. Call displayUI to open it as a Pharo window.
"Djembe — a physical model of the West African goblet drum"
perc := Djembe new.
dsp := perc asDsp.
dsp init.
dsp start.
"Open the auto-generated UI — press DjembeTrigger to trigger the drum"
dsp displayUI.
"Try substituting Djembe with Marimba for a different timbral character"
dsp stop.
UI parameter types
| FAUST element | Phausto class | Use |
|---|---|---|
| hslider | PhHSlider | Horizontal slider (range + step) |
| nentry | PhNumEntry | Numerical entry (integer or float) |
| button | auto-generated | Trigger (pulse on click) |
| knob | auto-generated | Rotary control |