Keep MIDI note on when value below a certain number, turn off when above a certain number.

verace's icon

I am trying to turn on a midi note when a value is above 127 and turn it off when it is above a certain value. I have only been able to do this with noteout which sends the off signal, resulting in short notes being played continuously instead of the note being held until the value reaches its threshold.

Adding an idea of the logic here:

  • We are mapping a slider from 0-254

  • when you go from 0-127 the midi value '76' is in the on state and the midi value '77' is on the off state

  • when you from from 128-254 the midi value '76' is on the off state and the midi value '77' is in the on state

this would work ramping the values up and ramping the values down

Bruce Alexander's icon

try routing the velocity to a logic gate.
If notein velocity is == 0(zero) && A >= a certain value then 0.
or just
If A >= a certain value then zero.

verace's icon

Here is an example of this using makenote

76_77_OnOff.maxpat
text/plain 3.65 KB

Sébastien Gay's icon

Would adding a [change], in order to avoid the same note to be re-triggered each time the same value is output, solve your problem ?

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


verace's icon

This is certainly getting closer to what I am trying to achieve.

Sébastien Gay's icon

How about this ?

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

Edited.

verace's icon

This works perfectly, Thank you so much. I will make sure to document this when I am finished building the controller as reference. Thank you again.

Source Audio's icon

slightly different, for exercise

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