Build with this node

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

Ask Studio

@maruaudio/dsp/processors/division-clock is a port of the CHOMPI TEMPO firmware's clock manager. It drives two division lanes and a fixed eighth-note lane, either from a free-running 24 ppqn hardware timer (FREE) or from counted external MIDI clock bytes (SYNC), and estimates the sync tempo with an f32 moving average. The timer is integrated in whole microseconds, and edges are observed once per 48-frame block (1000 µs at 48 kHz), so step edges match the device whatever the host block size.

Parameters

SetterRange as codedDefault
changeDivisionClockTempo(turns)Relative, clamped 160 to 480 (tempo is 2 × BPM)320
setDivisionClockTempo(tempo)Truncated, unclamped; the CC path sends 160 to 480320
changeDivisionClockDiv(turns, lane)Encoder count 0 to 60 over five 12-detent rows; FREE {24, 18, 12, 8, 6} ticks, SYNC {48, 24, 12, 6, 3} clocksposition 2, an eighth
setDivisionClockDiv(lane, div)Scene recall: FREE defers a position; SYNC writes the raw value as the clock countnone
toggleDivisionClockModeFREE ↔ SYNCFREE
divisionClockTap(nowMs, encoder)Taps within 750 ms set tempo 120000 / interval, at most 480none

Lifecycle

createDivisionClock allocates fixed typed arrays → per block divisionClockAdvance(1000), UI setters, divisionClockRealtime(status, transportIn) per MIDI realtime byte, divisionClockHead → read edges → resetDivisionClock (power-on state). Realtime bytes return START or STOP.

When to use it

Clocking @maru/processors-pattern-arpeggiator or another CHOMPI TEMPO port whose step timing must match the hardware, quirks included. Beat-based timing at any rate belongs to @maru/control-musical-clock.

Limits

  • Fixed 1000 µs blocks, an emulated-timer exception to rate independence.
  • Kept firmware behaviour: a period lowered below the running counter runs to 0xFFFF first; SYNC setDiv writes a position as a clock count; the sync delay boost uses the overflowed 32-bit square; division by zero yields 0. Out-of-range positions read the last table row.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Parameters

ParameterTypeSetter
Tempo tempo

`setTempo(t)`: absolute tempo in 2× BPM, unclamped (the CC path passes 160..480).

floatsetDivisionClockTempo

Dependencies

Dependents

No other node imports this one.

Used by