@maruaudio/dsp/voices/mono-performance turns note presses and releases into mono and legato decisions: which held note sounds, under last, lowest or highest priority, and whether the instrument should attack, glide to the new note, release, or do nothing. Actions are integers so the same policy compiles on every Processor target. Envelope and oscillator state stay with the instrument. The source header says it was extracted from Vocoder's mono note handling; the repeated-press behavior follows Phase 7.
Parameters
setVoicePerformanceParameter(state, path, value) returns false for a non-finite value or an unknown path and changes nothing.
| Path | Clamp as coded | Default |
|---|---|---|
voice.mode | Rounded, 0 to 2 | 0 |
voice.notePriority | Rounded, 0 to 2 (0 last, 1 lowest, 2 highest) | 0 |
portamento.mode | Rounded, 0 to 2 | 0 |
portamento.time | 0 to 2 s | 0.08 s |
Lifecycle
initMonoPerformance() allocates a @maru/voices-note-stack and sets the factory controls → on each note event call monoPerformancePress(state, note, velocity, mode, priority) or monoPerformanceRelease(state, note, priority, mode), or the identified monoPerformancePressId / monoPerformanceReleaseId, which read state.mode and state.priority → apply the returned MONO_UNCHANGED 0, MONO_ATTACK 1, MONO_RETARGET 2 or MONO_RELEASE 3 to the instrument's own voice. resetMonoPerformance clears held notes and keeps the controls; resetMonoPerformanceConfiguration restores the factory controls.
When to use it
A monophonic synth that needs retriggered (mode 1) or legato (mode 2) play with note priority and a fallback to the previous held key. Pair it with @maru/voices-portamento, whose portamentoFrames takes the same glide mode and time.
Limits
- A press returns retarget only in mode 2 with a note already held; otherwise attack.
- A release that changes the selected note returns attack in mode 1 and retarget in any other mode; releasing a key that is not sounding changes nothing.
- Pitch-only events assume notes 0 to 127; identified events keep separate entries for equal pitches.
- No audio output.