Method for Mutable Lists in Memory
The goal is simple -
MIDI Note In → Random MIDI Pitch Out, chosen from a user-defined list of allowed notes.
Additional Notes
Duration is preserved
list in memory must stay de-duped
Kslider in polyphonic mode is used to select the notes
current build uses strip-note from Keyslider to determine if the note should be added or removed from the list
velocity zero → remove element from list
velocity nonzero → add note to list and dedupe (zl.union)
Everything I tried failed
I'm implementing it in Max4Live but i have the standalone version too?
Nothing that I've tried worked. If ZL objects, Bags, and the Coll object don't work, do I need to move on to the bulkier Dict object? It seems like such a primitive function of programming, I'll be surprised if I'm not missing something completely obvious?
collwas tried first, but adding or removing an entry also caused output, which made list editing trigger unwanted MIDI events.zl.regwas tried as quieter storage, but it only remembers a complete list handed to it; it did not conveniently manage incremental note additions and removals.We then worked through
zl.union,zl.remove,bag, list lengths, random indices, and ordering problems. The add and remove paths were difficult to keep synchronized, especially because note and velocity output order fromkslidercomplicated the logic.
Ultimately, I abandoned the idea and simplified to one contiguous pitch range, just choosing random numbers in a range.
Is there a canonical way to do this?
adding and removing single entries from a bunch of numbers can done just fine in [coll].
get your list into coll - no output
//
changing/removing notes from coll more tricky with kslider in poly mode
adding note numbers and removing them from coll is a simple task
for live and ease of use , storage, you could use dict or pattr objects that can get directly stored into live set, just use appropriate messages to add or remove note numbers from list
