Modding Arduino M4L Device for Teensy 4.0?

Ethan P's icon

Hey all,

I'm using the Arduino.amxd device from the Ableton Connection Kit to interface with a hardware project I'm working on that's built on the Teensy 4.0 instead of the Arduino Uno.

Looking for some help from someone with MaxMSP experience on modding the Arduino Max device patch for full Teensy support and access to all 14 analog pins and 40 digital pins through the Ableton UI. Basically I'm just looking for the exact same functionality as the current Arduino Max for Live device, but with access to the extra pins that are properly mapped to the Teensy 4.0.

If anyone would be able to rewrite this device for Teensy 4.0 or add Teensy functionality, this would be hugely helpful.

Thanks so much!

--

Here's what I've already tried/found:

  • Inside the Arduino.amxd device, there's a subpatch called M4L.IO.Arduino.ObjectModel controlled by a dropdown that looks like it was intended to be a board selector but the only option on there is Arduino Uno. Ideally, I'd want the Teensy 4.0 as a dropdown option on that list to retain Uno functionality and also add the Teensy. Tried modifying this to add the Teensy and have it connect to the appropriate logic and pinouts but couldn't be sure it was working. This is less important than just getting the Teensy working and replacing the Arduino mapping, but I thought it'd be nice to have both and share it on Reddit and the Max forums.

  • Anyway, inside of that subpatch there's another object called p parseDataModel, and inside of this there's a script called dict ArduinoObjectModel, which is a script that lists all the analog and digital pins for what seem like the Uno being mapped to the parent patch interface. When I edited this script and added more analog pins, nothing changed and I didn't have access to the other analog pins. I'm thinking it's a combination of adding these mappings in the script as well as in the following, which is the actual device UI

  • Most importantly, inside the main bpatcher is the parent UI for the analog and digital pins. Inside this, I was able to add in more analog inputs into the UI with the M4L.IO.Arduino.Analog.Parameter.maxpat and add it to the presenter view and all that. Issue there is that when I tried to drill down into that and change the "ID" (A6, A7, etc.), it kept messing up previous input IDs that I'd just made. Seems like I'm accidentally instancing the same object instead of creating unique versions? Not sure how Max handles this. Other major issue I ran into was that adding more analog inputs means that there's some overflow on the final Analog input UI. The digital panel UI for the Uno seems like it was set up for this overflow and has the ability to scroll, but I didn't know how to add this same flexibility to the analog panel once I started adding inputs. I got all the way to the collapseExpandViewElements but wasn't sure how to proceed or add this functionality to another embedded bpatcher without breaking the whole thing.

Original Arduino.amxd patch attached.

Arduino.amxd
application/octet-stream 1.77 MB
Original Arduino M4L device, built for Uno