4Devs: NoteStateTracking (Example) v1.0

Shows how to implement note state tracking to enable functions acting on active notes only. Double NoteOn / NoteOff inputs are easily detected and filtered out to not disturb processing.

Instead of for instance sending note-offs to all notes of all channels, this method allows to only mute the currently active notes.
The traditional ‘brute force’ muting would send
NoteOffs for all 128 notes on all 16 channels – a loop over 102r entries causing not only a CPU spike with the possibility of crackles, but also floods the midi port and the receiving instrument.

Additionally to using the NoteState array feature of Mozaic, a numNotes array is used to track active channels to speedup the active note check.

One can of course store more complicated data in the note state array than a YES/NO value – to still serve the purpose of note tracking, define a EMPTY constant with a value outside your data range.

576 PM
  • Platform:
  • Category: Utility
  • Revision: 1.0
  • Views: 73
  • Modified: 4 days ago
Chat about this patch on Discord! Download (4)

Leave a Reply