Basic Midi Note Off/Flush/Hanging Note versus loss of velocity value issue

clairerobot's icon

Hi, I'm stuck with a very basic issue, best to look at the patch.

Either I use 'flush' and then it works fine but I loose the original note-in velocity value.

Or I use the original velocity and am stuck with hanging- notes.

The solution must be very basic, I'm just a bit rusty with Max.

Thanks!!

midinoteoffissue.maxpat
Max Patch
Luke Stark's icon

Can you share a bit more detail about your goal? I'm confused why you're converting from midi to frequency and back to midi. :)

clairerobot's icon

It's for microtonal pitch scales.... that part is working fine...

The issue is where/when to flush the midi notes so that all note-off messages are send

Luke Stark's icon

Let me make sure I understand. Midi note comes in, you stash the velocity, calculate a new note value plus pitchbend value to get your microtonal combined value (note + pb). Why do you have to flush? Each note could be taken as a discrete event right?

Max Patch
Copy patch and select New From Clipboard in Max.

Maybe like this? Use a buddy to make sure they stay together?

Peter McCulloch's icon

To offer an alternative take, I like to take a decentralized approach for problems like this using poly~. For me, I'd rather send the bend messages to a bendout that's dedicated to the particular needed channel. The reason for this is that it requires a lot less coordination, since you never have to worry about what channel the bendout/noteout/etc. is set to, and this results in less stuck notes or complex logic. This also makes it easy to support things like pitch randomization without having to set up a way of remembering what output pitch corresponds to what input pitch, since the pitch will correspond with the voice.

Here's an example based on the original post using poly~. Using multiple voices will let you have overlapping notes without the tails getting changed. If you set voices = 1, you'll get one that will release each time.

NoteTransformVox.maxpat
Max Patch
NoteTransformPlayer.maxpat
Max Patch
Luke Stark's icon

I assumed it was monophonic, but the poly~ object is certainly fascinating!

clairerobot's icon

Thanks!! The buddy option works fine... I need to test some more, on fast notes the pitch bend lags and is less effective, but the problem with hanging notes is solved.

Will check out the poly options as well!

Peter McCulloch's icon

The poly option may help for fast notes since it's distributing them over more channels. (so you should have fewer problems provided that there's not a large amount of overlap)