@maruaudio/dsp/tables/tape-loop is the CHOMPI TAPE firmware's stereo looper. The first pass records at 1× and sets the loop length; then the loop plays and overdubs at a slewed varispeed, with a trailing write head, dub-gain feedback through a hard limiter, a paused scrub, a reset fade and an automatic close when the buffer fills. Samples are the firmware's int16 codes (f2s16) held as exact integers in one interleaved f32 buffer, in the firmware's float32 order.
Parameters
| Path | Setter | Range as coded | Default | Unit |
|---|---|---|---|---|
tapeSlew | initTapeLoop, setTapeLoopTapeSlew | 0 or 1 (non-zero is 1): speed slew 0.01 or 0.0001 per sample | from init | flag |
speed | setTapeLoopVarispeed | Stored as f32; the slewed tape speed is clamped to −2..2 | 1 | × |
| dub gain | tapeLoopIncrementDubGain(increment) | Target clamped 0..1 with floatClamp; slews while overdubbing, set at once while empty | 1 | linear |
| scrub | tapeLoopAddScrubTurns(turns) | Accumulated; each 6000-sample period sets the paused scrub | 0 | turns |
Lifecycle
initTapeLoop(capacityFrames, tapeSlew) allocates that many stereo frames (floored, at least 1) in the power-on state. When tapeLoopBlockStarting returns 1 (every 24 frames, the firmware callback), apply queued transport calls (tapeLoopToggleRecord, tapeLoopTogglePlaying, tapeLoopReset, tapeLoopJumpToStart), call tapeLoopCheckRecordReady, then the owner's button logic or tapeLoopReleaseResetLatch. Then tapeLoopTick(state, l, r) per frame writes outputLeft/outputRight, the bus plus the loop. tapeLoopOpenStored installs a loop written into buffer; resetTapeLoop restores power-on state without reallocating or clearing it.
When to use it
A live looper matching the TAPE pedal, driven by the product's own buttons.
Limits
- Stereo, sample tick; the 24-frame virtual block is internal, so output does not depend on host block size. While empty and idle a block passes the bus through unchanged. Button-hold gestures are the owner's.
- Rates are per sample, as upstream: slews, the 6000-sample scrub period and the 480-element loop-end fade assume 48 kHz. Every loop has a compile-time bound.