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.

3 comments on “4Devs: NoteStateTracking (Example) v1.0
  • Bellows on said:

    Hi, your script sounds like it would improve many other scripts. I am interested in creating a script that will take certain chords and play a single note from them. I know this sounds crazy but I want to be able to remap accordion chords to play a wider bass range. Any ideas would be appreciated. I am a very beginner with Mozaic but experienced with industrial controls programming. Thanks.

  • mikewillstew on said:

    Hello-ki, Just used this in my latest script. It would have taken me at least an afternoon to come up with something similar but nowhere near as elegant. Does what it says on the tin. Thank you.
    Cheers,
    Mike

  • Leave a Reply

      1941 PM
    • Platform:
    • Category: Utility
    • Revision: 1.0
    • Modified: 4 years ago
    • Views: 126
      Likes: 1
      Downloads: 32
    Download
    Chat