Forums > MaxMSP

making a momentary MIDI switch into a latching Max switch 4.6

Mar 09 2010 | 9:48 am

I bought a launchpad and am trying to get back some Max skills but this one has me stumped. I’d like to make a momentary MIDI switch into a latching Max switch using matrixctrl.

The User 2 bank of the Launchpad sends out a noteon when you press a pad, and a noteoff as soon as you release the pad. So it’s just like a keyboard in that respect. But I want to use it as a matrix controller, turning processes on (MIDI processes in Max) and then turning them off later. In other words, I want Max to interpret a first noteon as an on command to turn on a process, and the very next time it sees the same noteon, I want it to turn the process off. And because I want to keep track of which processes are on and which are off, I am using the matrixctrl object. But I can’t figure out a way to do this! As a starting point I’ll use stripnote to remove noteoffs in the following example of how I want to use it.

Example of latching switch mode using pitch and velocity

55 127 – process x on
66 127 – process y on
77 127 – process z on
55 127 – process x off
44 127 – process a on
66 127 – process y off

For those who are familiar with Launchpad and Ableton LIVE, this is essentially an imitation of the functionality of the session and mixer modes where you have visual feedback on what’s on and off in LIVE.

I have attached my patch for the momentary patch.

Thanks for any help.


Mar 09 2010 | 12:15 pm

You might want to try a [stripnote] between the notein and the rest of your patch.

Mar 10 2010 | 6:18 am

I already tried that. All it does is give me the notes without noteoffs. I said:

"As a starting point I’ll use stripnote to remove noteoffs in the following example of how I want to use it."

That means I already understand that the noteoffs are not needed. What I need is some sort of storage object that, when it see a repetition of a list – even after intervening list items – I reverses its state. That is what I tried to describe in the example I gave above: 55 127 repeats after two intervening list items, and at that point I want a zero to be sent.

So, to restate, perhaps clearer:

Is there an object that will reverse its state (1 to 0 or 0 to 1) when it sees a repetition of a list?

I have tried with 4 objects, but none seems to do exactly what I want:
coll, funbuff, table, offer

Thanks for any help! Going mad with this one.

Mar 10 2010 | 6:39 am

here is a little patch i wrote for my launchpad some while ago. Shouldn’t be using double buffering. Seems to be what you want and really isn’t too complicated.
The only thing is, i have chosen the Abbreviation "i" for my launchpad, you will need to correct the port at two midi objects in that patch or choose the same abbreviation to make it work. It is thought to display the routing in the matrix object even if the matrixctrl has changed (py pattrstorage eg.) and only if the patch is "on", wich is the toggle on the upper left. so if you don’t want that, you can maybe delete some objects in there.

-- Pasted Max Patch, click to expand. --

Mar 10 2010 | 9:30 am

Unless I’m completely misunderstanding your problem, stripnote works fine for this:

-- Pasted Max Patch, click to expand. --

Mar 10 2010 | 10:42 am

it seems not only i didn’t see that you’re running max 4.6, sorry for the real helpful patch i guess.
I don’t know if this was in 4.6 already the case but what you seem to need is the "inc" "dec" command (for increase/decrease of course)to the matrixctrl object.
so sending for example "0 0 inc" to matrixctrl would alternate the state of the cell with the coordinates 0 0 everytime you send the message. So you can store the state of a pad or cell in matrixctrl. of course you need to remove the note-offs either with stripnote or a simple gate which is opened by "!= 0" for example.
the rest is converting the "pitches" of the launchpad to matrixctlr coordinates. Find that an interesting process, say so if you need help on this.

Dec 23 2010 | 4:28 pm

I’m doing something similar and this has helped a great deal! I’m using NI Maschine for a similar task. However, instead of muting/unmuting instruments/melodies I am using it to select patterns.

So I have a patch similar to the example above, so that when a note is hit the select object picks up the note and latches the toggle box.

However, in my case, this can lead to more than one toggle lit at once where as I should only ever have one as I want to select one pattern or another.

So basically I want to send an off message to all the other toggles when one is selected. Is there a way to do this with select or an alternate object? I could use if/else and != calculations but this seems like overkill.

Viewing 7 posts - 1 through 7 (of 7 total)

Forums > MaxMSP