Build with this node

Start with a prompt in Studio, or copy it into your own coding agent.

Ask Studio

@maruaudio/dsp/oscillators/variable-shape ports DaisySP's VariableShapeOscillator: a waveform that morphs from triangle (shape 0) through saw (0.5) to square (1), with pulse width and optional hard sync to a master frequency. Pulse edge, phase wrap and sync reset are band-limited with BLEP and integrated-BLEP residuals at their sub-sample times. State and arithmetic are f32; the output is one sample late.

Parameters

PathSetterRange as codedDefaultUnit
frequencysetVariableShapeOscillatorFrequencyfrequency / sampleRate clamped to 0..0.25220Hz
syncFrequencysetVariableShapeOscillatorSyncFrequencySame 0..0.25 normalized clamp440Hz
pulseWidthsetVariableShapeOscillatorPulseWidth2 × f to 1 − 2 × f (f the normalized frequency); 0.5 at the ceiling0.5fraction
shapesetVariableShapeOscillatorShape0 to 10morph
enabledsetVariableShapeOscillatorSync0 off, anything else on0flag
gainsetVariableShapeOscillatorGain0 to 11linear

Lifecycle

initVariableShapeOscillatorNode(sampleRate) sets the sync frequency, the frequency and then the pulse width (upstream Init sets the width first) → setters → variableShapeOscillatorNodeTick per sample → resetVariableShapeOscillatorNode, which clears phases and residuals only. prepareVariableShapeOscillatorNodeSampleRate re-derives both increments from the stored Hz values.

When to use it

A synth oscillator that morphs between triangle, saw and square, or a hard-sync voice whose sync frequency sets the pitch.

Limits

  • Mono sample tick, one sample of latency. The tick does not apply gain; the Graph node multiplies by it.
  • Set frequency before pulse width: the width clamp uses the frequency then stored, and only reaching the 0.25 ceiling resets the width (to 0.5).
  • At most two transitions (edge and wrap) per sample, as the 0.25 ceiling allows. Widths of exactly 0 and 1 use a finite slope, so 0 Hz stays finite.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Variable shape oscillator frequency variableShapeOscillatorFrequencyfloatsetVariableShapeOscillatorFrequency
Variable shape oscillator sync frequency variableShapeOscillatorSyncFrequencyfloatsetVariableShapeOscillatorSyncFrequency
Pulse width pulseWidthfloatsetVariableShapeOscillatorPulseWidth
Shape shapefloatsetVariableShapeOscillatorShape
Enabled enabledfloatsetVariableShapeOscillatorSync
Gain gainfloatsetVariableShapeOscillatorGain

Ports

  • Out outoutput · audio · mono

One sample per variableShapeOscillatorNodeTick call.

Dependencies

Dependents

No other node imports this one.

Used by

No plugin with a published composition uses this node yet.