I actually ported something to m4l


It’s a christmas miracle!
Probably the easiest patch to port that exists, but hey, I felt like I accomplished something! :grinning:

edit: added autofocus, clear command
64 version
128 version
256 version

grid64.amxd (50.9 KB)
grid128.amxd (50.6 KB)
grid256.amxd (50.2 KB)


Hi tehn,
I didn’t have any autofocus in this port. I am trying to copy it over from terms_flin. It does autofocus now. Unfortunately grid lights from other m4l patches carry over to it. Here is where I’m stuck.

Here is the flin autofocus I copied.


(wow, to this day folks still using my ‘p Monome_Protocol_Jumper’?! i’m flattered :smiley: made that thing for Rodrigo long ago, but I’ve never actually used it myself)

hmmm… so i’m not an M4L user but until tehn or others chime in, i’m guessing it’s to do with the message: “/monome/grid/led/set $1 $2 $3”(near the top left of the patch)… instead of the word ‘monome’ for the prefix, you probably want it specific to the app or track… for example, you have ‘prepend /grid/grid/led/col’ in your screenshot above, so you could similarly use “/grid/grid/led/set $1 $2 $3”(‘grid’ is the name of the app so that would work if you changed everything to look the same(though it looks confusing because that word is also used as part of the OSC standard for monome grids in general))…
i could be wrong, though, been awhile since i looked at other folks’s patches…

either way, that first prefix should be something specific to the app or the M4L track. say i had 4 patches loaded onto 4 separate M4L tracks, i’d probably choose 4 different prefixes for each separate M4L track… like so:
for the LEDs:

  1. “/mfla/grid/led/set $1 $2 $3”
  2. “/mflb/grid/led/set $1 $2 $3”
  3. “/mflc/grid/led/set $1 $2 $3”
  4. “/mfld/grid/led/set $1 $2 $3”

and for the buttons/“keys”:

  1. “route /mfla/grid/key”
  2. “route /mflb/grid/key”
  3. “route /mflc/grid/key”
  4. “route /mfld/grid/key”

since your app/.amxd is called ‘grid’, you could also change everything to look like:
"/grid/grid/led/set $1 $2 $3", “route /grid/grid/key”, (and you already have “prepend /grid/grid/led/col”, “prepend /grid/gird/led/level/col” etc.)…

bottom line is that first prefix is how you can separate/focus control to/from each patch.

i’m probably just confusing but… hope it helps.


Thanks @RABID,
I will give it a go! I have to redo all the goodies I copied from flin. Things got a little mixed up so I had to just scrap what I had. More practice redoing!


i forgot to mention too, that first prefix(whether ‘monome’ or ‘grid’ or ‘flin’) is also the argument you give to the bpatcher containing serialosc.maxpat(the thing that displays ‘none’ in your second screenshot because there’s no grid connected). click on that bpatcher, use CTRL+I(windows) or command+I(Mac) to open the bpatcher’s ‘inspector’ and then in the ‘argument’ field click ‘edit’ and enter a descriptive prefix like ‘flin’ or ‘mfla’ etc. and whatever word you enter in that field matches to the ‘…/grid/led/set’ and ‘…/grid/key’ messages to allow specific focus(i think patches default to ‘monome’ if nothing is entered… i forget… trying to get back into it these days :stuck_out_tongue: ). best of luck.


Hell yeah RABID! Working like a charm!.

If you feel like porting meadowphysics 2 for some good old max fun since you’ve been away from it for awhile I’m trying to rally people to donate for that.

Thanks for the help man!


Found one more thing that I’d like to fix: When I am in toggle mode using “grid”, leds stay lit. When I leave “grid” and then return to “grid”, there are no leds lit, but the matrix shows where they should be lit. How to fix this?


that should be easy, but a bit hard to explain(and i’m not sure how you’re leaving and coming back to ‘grid’ in M4L so i hope i get it right)… basically, the matrixctrl object will output all of its cells using a ‘bang’ so you just need to attach a ‘sel 1’(short for ‘select 1’) object to the output of the toggle, and then route the ‘sel’ object’s output to the matrixctrl object(the ‘select’ object outputs a bang when it detects the number it’s assigned to select).
here’s a patch to explain:


(you probably already know this, but just in case: copy that jibberish above including the
and the ‘----------end_max5_patcher----------’ and paste into a blank patcher to check it out… it’s the ‘CopyCompressed’ format of patchers designed for forums and email etc. available from the ‘Edit’ menu…)
hope that’s not confusing/overkill, your solution will look much simpler.


oh and regarding this:

might be a bit busy rest of this week, but i’ll see if i can find time over the weekend to take a look… if you start it up and upload/paste what you got in that thread and ask questions there i might even get to it faster(or maybe others will chime in too).


Working on a somewhat similar porting problem, will give an update if anything comes out of it. But in case you may want to take a look, i’ll post the patch here in a few weeks.


i’m using it in re:mix. makes setup easier for a lot of people. thx for sharing it! :smile:


it looks to me like when u connect, it delays 20ms before clearing the grid, and 40ms before sending the bang to refresh leds, but as it is now the bang to refresh isn’t going anywhere.

you need to connect a patch cable from the ‘del 40’ to the top left inlet of the matrix. alternatively, since the ‘del 40’ goes to a send object, u can just duplicate that object, change the s to r (which makes it a receive object), then connect the receive object to the top left inlet of the matrix. (it works the same just less messy)


@elquinto and @RABID

Thanks guys. I patched the ‘del 40’ to the matrixctrl and it is working perfectly.

Of course one fix leads to another question! SInce varibright is not used with the ‘grid’ patch can I just delete this whole grouping?

Edit: I deleted, and it works fine.


right, u can delete the grouping just to the left of that too (in your first screenshot, starting with the ‘route /grid/grid/key’ object)




Looking at you code for the the ‘input’ patch. I’m curious how you add midi learn to these patches? Is there a snippet you could share? I’d like to add midi learn to the ‘clear’ and ‘toggle’ buttons on grid.


PMd you this but just drag down a m4l “live.button” object and copnnect the bang function to the message trigger:


Great news! Thanks raws.


@raws @LLK,

Updated with midi learn for ‘clear’ and ‘toggle’.

I put the live.button on top of ‘clear’ and ‘toggle’ so it’s integrated raws. Thanks for the info.


dope!!! so here’s my next idea for this. Take the monomebase midi_sliders_64.maxpatch and port it.
To start we should just port the patch and then use @elquinto s quadrants port to split the grid in to two 64 grids. one running the grid128 (or 64 if you feel like making it) and the other half running the sliders port. Then we got ourselfs 8 faders and 64 midi toggles or triggers on one grid… all in m4l!

The step after that would be to compbine the two into a since m4l device. then BLAM you could run a bunch of them in the same project if u wanteed or needed. Each instance would rubn on its own midi channel and forget the headache of porting insanity!

edit: oh shit i just saw your grid64 patch. nice work!!!

edit edit: uploaded sliders64… im just having trouble with my serialosc.maxpat i need to clean house and let theere only be one! midi_sliiiiide.amxd (166.9 KB)