@maruaudio/dsp/oscillators/z ports DaisySP's ZOscillator, a phase-distortion oscillator in the style of the Casio CZ series. A carrier contour is multiplied by a formant sine whose phase resets twice per carrier cycle; the reset is a discontinuity, band-limited with BLEP residuals at its sub-sample time. Shape bends the carrier contour (below 0.5 it scales a ramp-down, above it offsets the contour sine) and mode picks one of three offset and phase-shift branches (below 0.333, below 0.666, above). State and arithmetic are f32, and the output is one sample late.
Parameters
| Path | Setter | Range as coded | Default | Unit |
|---|---|---|---|---|
carrierFrequency | setZOscillatorCarrierFrequency | frequency / sampleRate clamped to 0..0.25 | 220 | Hz |
formantFrequency | setZOscillatorFormantFrequency | Same 0..0.25 normalized clamp | 550 | Hz |
shape | setZOscillatorShape | 0 to 1, stored as the pending shape | 1 | morph |
mode | setZOscillatorMode | 0 to 1, stored as the pending mode | 0 | morph |
gain | setZOscillatorGain | 0 to 1 | 1 | linear |
Lifecycle
initZOscillatorNode(sampleRate) sets current and pending shape and mode together, so the first tick reads defined values (upstream Init sets only the pending ones). Then setters → zOscillatorNodeTick per sample → resetZOscillatorNode, which clears phases and residuals and adopts the pending shape and mode. prepareZOscillatorNodeSampleRate re-derives both increments from the stored Hz values.
When to use it
A one-oscillator voice with a second, independent formant frequency, where shape and mode are the modulation targets.
Limits
- Mono sample tick, one sample of latency. The tick does not apply
gain; the Graph node multiplies by it. - Pending shape and mode become current at the end of every tick; at a discontinuity the tick blends current and pending by the reset time.