@maruaudio/dsp/processors/midi-timeline plays a prepared tape of MIDI note rows on the sample clock. Row times are authored in seconds and converted to frames at the prepared rate, rounded once from the lap origin rather than accumulated, so a looped tape with a fractional length keeps its authored timing on every lap. It runs, stops, loops and seeks; a seek chases the notes held at the new position, and stopping, seeking or replacing the tape releases the notes it holds. It is an event-only block Processor: no audio in or out.
Parameters
| Path | Accepts | Default |
|---|---|---|
player.run | ≥ 0.5 runs; a change restarts from 0, or from the seek position | stopped |
player.loop | ≥ 0.5 loops | off |
player.position | 0 to 1 of the tape length; while stopped it moves the cursor and emits nothing | 0 |
Any value outside 0 to 1, NaN included, returns false.
Lifecycle
createState (fixed typed arrays, including a 500,003-float tape) → prepare (no input, no output channels; any positive rate) → loadResource slot 0, or replacePreparedTimeline for a persistent tape from a parameter event → setParameter → process / emitEvents → reset. The tape is [rows, whole seconds, fraction], then per row whole seconds, fractional seconds, note, velocity (0 is note-off) and channel. Slot 1 installs a live replacement that keeps running and keeps the held-note ledger. isPreparedTimelineValid and loadPreparedTimeline take an offset so a composing module validates a larger packet before installing any of it. A re-prepare re-derives frames from seconds and keeps the playhead's time; reset stops, rewinds and clears the held-note ledger without emitting releases.
When to use it
A MIDI file player, a looping pattern or a region rendered from prepared note data, with tempo baked into the row times. A silent tape still advances, seeks, loops and completes.
Limits
- At most 100,000 rows and 21,600 s (six hours); times non-decreasing and within the duration, notes integer 0 to 127, velocity 0 to 1, channel integer 0 to 15. A malformed tape is refused with no state change.
- At most 256 events per block. Due rows past that leave on the next frames in order and are counted in
lateEventsandmaxLateFrames; the clock keeps its position.emitEventsdrops the block's events and returnsfalsewhen the caller's output has less room than they need.