Build with this node

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

Ask Studio

@maruaudio/dsp/processors/midi-note-map turns each incoming note into zero to four output pitches from a prepared map, without evaluating a program or opening a device. It keeps a held-note ledger so that repeated presses of a held key extend it instead of retriggering, distinct keys mapped to the same output share one sounding note until the last of them is released, and a panic releases every sounding output once. It is an event-only block Processor: no audio in or out.

Lifecycle

createState (fixed typed arrays) → prepare (positive finite rate, integer maximum block, no input or output channels) → loadResource slot 0 → handleMidi / handleEvent → process / emitEvents; panic; reset. The map is a 641-float packet: version 1, then 128 rows of [count, pitch0, pitch1, pitch2, pitch3]. isPreparedNoteMapValid and loadPreparedNoteMap take an explicit offset for a map nested in a larger packet. setParameter accepts nothing: the composing module owns the control schema. Reset clears held ownership and the queue and keeps the map.

When to use it

A chord trigger, harmoniser or remapping step between a MIDI source and an instrument, where the module prepares the map from its own controls and the DSP node only applies it to events.

Limits

  • Counts 0 to 4; used pitches distinct integers 0 to 127; unused fields 0. The whole packet is checked before it replaces the old map. A zero-count row is silent. Keys already held keep the chord captured at their first note-on.
  • Raw note bytes keep their channel; decoded note-on and note-off (kinds 2 and
  1. use channel 1. Other MIDI messages, identified notes and expression events are refused.
  • A held key's press depth is capped at 65,535; a saturated press is refused without changing ownership.
  • The 1,024-event queue admits each chord whole or not at all. When the caller's output has too little room, emitEvents refuses and keeps the whole queue for a later drain.
  • After panic, the 2,048 channel and pitch outputs are released over at most two empty-queue blocks, and new attacks are refused until that finishes.
  • The leaf does not keep the host's buffer view.

Algorithm properties and proofs

No Lean 4 proof is mapped to this node.

Explore proofs alongside performance

Dependencies

Dependents

No other node imports this one.

Used by