@maruaudio/dsp/delays/clocked-glitch is the CHOMPI TEMPO firmware's tempo-synced stereo glitch delay. An f32 ring takes the input plus 0.975·feedback; two read voices follow interval_us · 0.192 · division samples (slewed) with 960/480-frame tap offsets. On clock edges a newlib rand() draw against 0.5·alt may re-voice the next repeat (retrigger, reverse, pitch up or down, or pitch up with random pan), with 1024-sample crossfades. Freeze loops the wet output from a second ring, restarting every division-dependent number of pulses. All arithmetic is f32 in firmware order.
Parameters
| Setter | Value as coded | Init | Unit |
|---|---|---|---|
setClockedGlitchDelayClock(state, tempo, intervalUs, divPos) | Floored; the clock manager's 2× BPM, µs interval and division position | 320, 187500, 0 | — |
setClockedGlitchDelayFeedback | Stored as 0.975·value, not clamped | 0.3 | linear |
setClockedGlitchDelayMain | Below 0.45 event delay, above 0.55 pitch/pan delay, wet ramps 0.40–0.45 and 0.55–0.60; the centre switches off once wet is below 0.01 | 0.5 (off) | normalized |
setClockedGlitchDelayAlt | Event probability 0.5·alt and pan width | 0 | normalized |
setClockedGlitchDelayFreeze / …ToggleFreeze | Immediate, or a through-zero fade when the delay is on | Off | flag |
setClockedGlitchDelayMuteOption | Mutes for one delay time after unfreezing | init argument | flag |
Lifecycle
initClockedGlitchDelay(frames = 480000, muteOption, sampleRate = 48000) allocates two frames × 2 f32 rings (7,680,000 bytes at the default) and a sine table → setters → clockedGlitchDelayClockEdge and clockedGlitchDelayClockPulse (24 ppqn) as the clock arrives → clockedGlitchDelayTick(state, random, l, r), which writes then reads (outLeft, outRight) → resetClockedGlitchDelay, which clears the rings and restores the power-on state, keeping the clock inputs and mute option.
When to use it
Tempo-locked stutters, reversed and pitched repeats and frozen loops that follow a sequencer clock.
Limits
- Stereo, wet only. Tempo-derived lengths convert at
sampleRatethrough@maru/control-musical-clock; sample-count constants are not rescaled. - The
rand()state is passed in, so the owner shares one stream with other consumers in upstream call order. Firmware quirks are kept, such as an edge staying pending while frozen.