Note off to Max from external instrument

    Sep 12 2013 | 11:51 pm
    Hello, pretty sure it´s easy but I can´t do it:
    I´m sending MIDI notes [notein] with a pad to max/MSP. So I send [45 127], [34 127], etc., for example, and then these notes are on. This is ok, but I want that, when I press again "45" (or "34"), now it sends note off to max/msp. I mean: one time for note on; second time for note off, and of course, playing in the meantime a lot of notes.
    How can I make this?
    Thank you very much and best regards.

    • Sep 13 2013 | 7:47 am
      Hi there's a Max object for that!
      The [toggle] object functions as a latching switch:
    • Sep 13 2013 | 12:15 pm
      Hello, thank you very much for your help, but I have 88 pads and I can route 88 messages, but it´s not very "clean".
      Thank you very much again.
    • Sep 13 2013 | 12:50 pm
      There are several ways to do this, and numerous examples in the tutorials. There is no one "right" way to do this, but there is one that will be "right for you."
      You may want to look at [poly] and [poly~], as well as the MSP Tutorials on integrating with MIDI (18-21). You may also want to look at [stripnote] and [flush] and work through Max MIDI Tutorial 2.
      Unless you can be super-specific with what you're exactly trying to do, a general question has a high chance of garnering responses in the close-but-no-cigar category. For instance, I'm not sure how anyone could guess that you had 88 inputs from the original post.
    • Sep 13 2013 | 1:41 pm
      Here's one way - using a coll to keep a register of played notes slightly adapted from something I had lying around. I would also second what Peter said re: lack of specificity, as there are a some assumptions in my solution...
    • Sep 13 2013 | 4:31 pm
      Hello, thank you very much for your responses. Maybe it´s my english, but I don´t know how to be more specific with my question (I had forgotten the 88 pads, but the rest is exactly how noob-meister had understood). I´ll try again: I have a pad with 88 pads. If I press one pad it sends one MIDI note number, and "1" while I sustain and "0" when I release the pad, but I can isolate this and use only the MIDI note number for my purpose. What I need is that when I press the pad number 54, for example, Max understand it like "1", and if I press it again, then it be "0". But I can press 34, then 23, then 12... and all of them be 1, and if I press after that, "34" again, then it be "0". So, it cans work as a sampler, for example, but in a way that I don´t need maintain my finger to maintain the sound: it maintains the sound still I press the same pad again.
      I hope now it don´t be worst ;-)
      Thank you very much and best regards.
    • Sep 13 2013 | 4:33 pm
      Spectro, thank you very much for your help, I´ll take a look when I arrive at home.
    • Sep 13 2013 | 11:53 pm
      Thank you very much, Spectro, with your patch I can see when I´m pressing the pad, but that´s not what I need. I was reading what I wrote this afternoon, and I must apologize very much for my english. I´ll try again:
      - For my purpose, we can imagine it is for a sampler: if I press a pad, then it receives the MIDI number note and it´s note on. - If I press again, it receives the MIDI number note and that now it´s note off, because before it was note on.
      Thank you very much and best regards.
    • Sep 14 2013 | 10:36 am
      The patch I posted will do what you require - Its just not connected to midi ports/devices to illustrate its function. Its up to you to modify the patch to connect it to your MIDI devices. Hint:replace the kslider up top with note in (note number and velocity), and if you are sending the notes back out via MIDI, a noteout replaces number boxes at the bottom of the patch)
    • Sep 14 2013 | 11:19 am
      Hello, I did it, but with the kslider it works because kslider "doesn´t know" when I release the key. But with a MIDI device it works in other way: when I release the key it sends "note off" (velocity=0), so the result at the bottom is 0. I need that when I press the key the velocity maintain that value still I press the key again. The problems are two with MIDI devices, for what I need: it has to avoid the release message, and it has to remember that it has been touched still I touch it again.
    • Sep 14 2013 | 11:41 am
    • Sep 14 2013 | 11:54 am
      Great! That´s exactly what I needed! I think I love you ;-) Now I have to study your patch to understand it. Thank you, thank you very much :-)