Route MIDI notes by velocity

max's icon

Hello list,

I would like to route incoming MIDI notes by velocity. For exemple, with 4 zones (0-30,30-59,60-99,100-127), each notes coming with a velocity of 20 outs from the first output.

Could I achieve this with just one line in a "If" object?

Thanks

M

TFL's icon

Yes If is limited to two outputs.

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


But maybe it's not the most pratical way, especially if you want, for example, to dynamically change the zones. I would use a combination of [split] and [gate] instead.

TFL's icon

This is what I would do instead.

Max Patch
Copy patch and select New From Clipboard in Max.
max's icon

very clever !

Thank you TFL,

Roman Thilenius's icon

such use of if for list elements scare me. but you could introduce a $i3 to make it dynamic.

you usually need to split note events between vel 0 and vel non 0 anyway, just saying.

max's icon

Ah, I would like also the note off (the "0") of the incoming notes goes out through the same output. In fact, it is a little patch to send notes to different midi channel according to their velocities.

TFL's icon

A bit convoluted, but it works: using a coll to keep track of the channel of each note.

Maybe there is more simple approach, however!

Max Patch
Copy patch and select New From Clipboard in Max.
Source Audio's icon

that should not be a big deal, or ?

if midi input is a real one, then you can not produce same Note On

number without sending Note Off in between.

I use here multisplit jasch object, but you can also make abstraction

instead to dinamically change split ranges.

Note number gets ID prepended, depending on velocity split,

stored into coll, and next note Off of same pitch recalls it's ID ....

Simple, or ?

You can use ID to route to different channels or devices , whatever.

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

max's icon

Great, thank you guys !

Ronen Shloosh's icon

Yes, you can totally do that with just one line using the "If" object in your MIDI routing setup.