Build with this node

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

Ask Studio

@maruaudio/dsp/oscillators/lissajous-duo is a stereo pair of oscillators whose frequencies hold an exact integer ratio. One f32 master accumulator advances by f32(baseFreq / (sampleRate × ratioDen)) per sample, and both channel phases are pure functions of it: X (left) is frac(master × ratioDen) at baseFreq, Y (right) is frac(master × ratioNum + phaseOffset) at baseFreq × ratioNum / ratioDen. Because neither channel has its own accumulator, the X:Y ratio is exactly ratioDen:ratioNum and the traced figure closes on itself instead of precessing. Saw and square use the shared PolyBLEP stage functions.

Parameters

PathSetterRange as codedDefaultUnit
waveformsetLissajousDuoNodeWaveformRounded, then 0..2: sine, saw, square0index
baseFreqsetLissajousDuoNodeBaseFreq0 to 20000220Hz (X)
ratioNum, ratioDensetLissajousDuoNodeRatioEach rounded, then 1 to 641, 1integer
ampsetLissajousDuoNodeAmp0 to 10.8linear
phaseOffsetsetLissajousDuoNodePhaseOffset0 to 10cycles (Y)

Lifecycle

initLissajousDuoNode(sampleRate) → setters → per sample, lissajousDuoXSample and lissajousDuoYSample, then lissajousDuoAdvance → resetLissajousDuoNode, which zeroes the master accumulator only.

When to use it

Drawing just-intonation intervals on an oscilloscope or XY display, where a 3:2 fifth should hold one still figure. An equal-tempered interval is irrational and cannot be expressed here.

Limits

  • Stereo, sample tick. The channel reads do not apply amp; the caller does, as the Graph node lissajous-duo does for both channels.
  • The master accumulator is f32, so a closed figure carries the f32 residual the tests pin (7.15 × 10⁻⁷ after 96 samples at 100 Hz, 4.8 kHz, 3:2).
  • Waveform indices outside 0..2 read as sine in lissajousDuoWaveSample.
  • Conditional clamps: a NaN setting passes through.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Waveform waveformfloatsetLissajousDuoNodeWaveform
Base freq baseFreqfloatsetLissajousDuoNodeBaseFreq
Amp ampfloatsetLissajousDuoNodeAmp
Phase offset phaseOffsetfloatsetLissajousDuoNodePhaseOffset

Dependencies

Dependents

Used by