I need to get a bang whenever i have.a note off

Arian Ahmadnezhad's icon

i NEED a sort of strip note that send a separate bang for note off. i have tried if $i1 > 0 then 1 else 0 and then selecting 1 and 0 to get separate bangs but for some god damn reason the outlet that selects 0 also bangs when there is a note one. why on earth does this happen

double_UG's icon

Velocity is $i2 (Velocity 0 = Note off)

if $i2 == 0 then bang

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

Arian Ahmadnezhad's icon

Yeah of course I forgot to mention I do extract the velocity from the list so in my case $i1 is velocity

Aera's icon

Why not use a simple sel 0?

Arian Ahmadnezhad's icon

The problem is that sel 0 doesn't only bang out on note offs it also bangs out on note on since when a velocity change to a non zero value happens it crosses zero anyways. 0 is the default velocity amount

Aera's icon

It's either a 0 or not. Or maybe you get your note values from some sort of process that spits out 0s when there shouldn't be any.

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

Source Audio's icon

By no means will sel 0 bang

on anything then zero at input.

What zero crossing are you talking about ?

Maybe you use raw midi and don't know how to deal with notes ?

Aera's icon

I assume there's a process before the sel0 / if object that sends a 0 at the same time or slightly before the note on. You can easily test this with a print object.

Arian Ahmadnezhad's icon

Untitled3.maxpat
Max Patch

this is what i have been testing. the only other process before select is the zl.mth which i use to extract the velocity from the list.

Arian Ahmadnezhad's icon

I also just tested it with print and in fact it does send out 0 everytime there is a velocity change. first 0 then the new velocity amount.

TFL's icon

So probably what you get is the expected result, but not what you actually want.

I see nothing wrong with your example. Here is another way to do this, alongside yours:

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

Aera's icon

For me it behaves as expected - a nice single bang with every note off. Are you playing into the midi-in object with a keyboard? Coming from an Ableton Clip? Another (M4L) Midi device?

Arian Ahmadnezhad's icon

I think the mechanism is okay the issue is the push. if i just use the mouse to trigger the keyslider it works but when i trigger it with my push it does the same thing. it bangs on both note ons and offs. any idea why that oculd be happening ?

TFL's icon

Are you sliding your finger across the push pads? It sounds like as soon as a note on comes (your finger reaching a new pad), a note off comes too (your finger leaving the previous pad), so you get notes on at about the same time as notes off.

it bangs on both note ons and offs.

This is probably just an impression. If you try my example with the gate, it also tells you which note got off'd. This way you could maybe see more easily what actually happens.


Maybe if you tell us what you want to do for real in the end with all that we could also provide better advices.

Arian Ahmadnezhad's icon

So i just fixed the issue by routing 128 midi message instead of 160 polypressure. and that solved the issue of the note off. now the next issue is that there is apparantly no way to manually reset the ramp~object back to zero. I have made a sampler that uses a ramp which goes into a wave~to do my sample playback and i want to create a gating behaviour. meaning the ramp goes on until i lift my finger from the pad and so on. is there anyway i can make the ramp object reset ? I would veery very much rather not have to swap out the ramp for a phasor since the patch is already very developed

TFL's icon

You could force the end of the ramp to reset to initial value to mimic a reset. And set the end value back to normal before triggering a new ramp:

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

Source Audio's icon

read ramp~ help file and reference.

It will give you the answer if it can do whatever you want or not.

duration mode is maybe where you need to look first.

duration * note On/Off state

P.S.

In Max 8 ramp does not react

no matter what end value is set to during the ramp.

maybe that changed in Max 9 ?

Arian Ahmadnezhad's icon

Thank you TFL it works perfectly fine