Build with this node

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

Ask Studio

@maruaudio/dsp/processors/clip-player plays one host-prepared stereo clip on the sample clock. It resamples from the clip's own rate (8 to 384 kHz) to the host rate with 4-point, third-order Hermite (Catmull-Rom) interpolation over a fractional source-frame cursor, runs as a one-shot or a loop, seeks to a normalised position, and passes start, stop and gain through one 5 ms one-pole declick ramp. It is a zero-input, stereo-output block Processor.

Parameters

PathAcceptsDefault
player.run≥ 0.5 runs, below stops; running from the end restarts at 0stopped
player.loop≥ 0.5 loopsoff
player.positionClamped to 0 to 1 of the clip length0
master.gainClamped to 0 to 1, linear1

A non-finite value or an unknown path returns false. handleEvent takes note-on (kind 2: restart from 0, run when velocity > 0) and note-off (kind 3: stop) as gates on the same transport.

Lifecycle

createState → prepare → loadResource → setParameter / handleEvent → process → visualize; reset. Prepare accepts a host rate of 8 to 384 kHz, an integer maximum block of 1 to 128 frames, no input and two outputs. The host packs slot 0 outside realtime as one in-place f32 view, [sourceRate, frames, L0..L(n-1), R0..R(n-1)] (clipPlayerElementCount), duplicating a mono file into both channels; a load of length 0 clears the clip. Reset returns the transport to rest, master.gain to 1, and keeps the clip. visualize writes [position 0..1, run, seconds] and advances its revision only when a value changes.

When to use it

A backing track, loop or one-shot sample that a module plays at the host rate whatever rate the file was recorded at, started by a transport control or a note.

Limits

  • Header source rate an integer 8000 to 384000 Hz; frames an integer 1 to 16,777,215; every sample finite. Any other packet is refused without change.
  • Outside a one-shot clip the read is silence; a loop wraps. At equal rates on an integer cursor the output is the stored sample, bit for bit.
  • A stop freezes the transport at once and fades the audio that was playing from a moving tail cursor. Gain ramps settle exactly on their target.
  • The leaf keeps a reference to the loaded view; it does not copy it.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

None: this node imports no other node.

Dependents

No other node imports this one.

Used by