Build with this node

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

Ask Studio

@maruaudio/dsp/distortion/octave-divider is a monophonic waveform octave divider authored in Maru. A Schmitt detector arms when the input falls below −threshold and counts a crossing when it rises above +threshold; every division crossings it flips the polarity of a square wave, giving one (division 1) or two (division 2) octaves down. The square is scaled by an amplitude envelope of the input (5 ms attack, 100 ms release), then a 10 Hz DC blocker (@maru/filters-dc-block), a one-pole tone filter (@maru/filters-tone) and an output trim.

Parameters

configureOctaveDivider(state, division, threshold, toneHz, outputDb) uses clampFiniteWithFallback (@maru/math-range):

ArgumentRangeFallback
division2 when ≥ 1.5, otherwise 1
threshold0.0001 to 0.1 hysteresis0.01
toneHz50 Hz to min(8 kHz, 0.45 × rate)1 kHz
outputDb−24 to 0 dB (@maru/math-decibels)0 dB

Before the first configure, division is 1, threshold 0.01, tone 1 kHz and gain 1.

Lifecycle

initOctaveDivider(rate) (8 to 192 kHz, fallback 48 kHz) → configureOctaveDivider → octaveDividerTick → resetOctaveDivider, which clears the detector, counter, polarity, envelope and both filters. Ticks allocate nothing and do no I/O.

When to use it

A sub-octave under a single-note bass or guitar line, mixed with the dry signal outside this DSP node.

Limits

  • Mono sample tick, wet only. There is no pitch estimator: chords, noise and complex crossings can mistrigger.
  • Division changes need a caller fade or reset.
  • Input is clamped to ±16 (non-finite → 0).

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Ports

  • In ininput · audio · mono
  • Out outoutput · audio · mono

One sample per octaveDividerTick call.

Dependencies

Dependents

Used by