List storage & queries
Hello C74 community! I’m relatively new to Max, but not to programming.
After extensive research and tests, I feel I’m overlooking a simple way to store a list of two integers that can be queried, and if found, removed from the list. I’ve looked into coll, qlist and table… But I’m not sure if they’re what I’m looking for?
I’ve built a virtual MIDI keyboard, analog synth, and sequencer. In a patcher, I have two separate inlets recieving unique, equal KEYDOWN and KEYUP values, and a third inlet recieving velocity information (to be ignored in case of a KEYUP message).
All that’s left to do (in order to make the connection between the PC keyboard and sequencer/synth) is to take the keydown messages, store them in a list, and wait for a corresponding keyup message to remove the keydown from the list (firing a noteoff). This list will then be sent to an outlet, at which point will be converted to raw midi data. I need to store it like this so that I can mimic my own "flush" object, in case a note gets stuck in the noteon position.
Any ideas? Perhaps there’s a better way to go about this entirely?
[zl sub] can find matches in a list, but for your purposes, you could probably just use [makenote]. Maybe look to [borax] depending on what you eventually want to happen, it’ll give you the current status of the notes it’s holding.
you can use [sel] for basic number matching as well, use multiple ones to get "polyphony". And the [kslider] has some storage/flush features built-in…you don’t have to have it interactive (or even visible) to use these. They can be very handy.
And when working with anything MIDI, always have a
[ctlout 123 1]
…sending this a "1" will turn off all MIDI notes on channel 1, "2" for channel 2, etc. [uzi 16 1] into it will be an All Notes Off for all 16 channels. tie it to your ESC key so you don’t let stuck notes drive you crazy…stuck notes require a corresponding note-off, a channel notes-off, or quitting Max to shut them up!
Thanks a million! Borax seems to suit my needs perfectly.
I’ll include a ctlout failsafe once I have everything else in working order.
Hrmm… ok so borax was working fine a bit ago, but after messing with an onslaught of noteons it’s not outputting any data? It’s rendered completely unresponsive to anything I plug into it…
I’ve tried sending a bang to the rightmost inlet (to reset borax and release noteons), but that didn’t seem to do the trick. Neither did a bang to the leftmost inlet. Neither did the ctlout trick (if I’m doing it right). I’ve even tried restarting Max, as well as my laptop, to no avail!
I’m not hearing any audio, and when I open my sequencer patcher (contained in the same project), it seems to output to midiout just fine. So it’s just something wrong within my keynote patch. Everything in the patch works fine until it reaches borax, though…
I’ll include the patch here:
Nevermind, I figured it out… It was actually a problem with my keymapping patch. Fixed!
And thanks again!
Forums > MaxMSP