Sample Code for MIDI Controller

M9 MIDI Control

Sample firmware for M9 MIDI Controller - screenshot

This is posted mostly for the curious. I’ve been working with Rodrigo Costanza on the code for the complete M9 controller. This is not the finished version, as it lacks the Scene Select, Folder Select, and Utility Mode portions. The looper controls require the controller to keep track of the status of the M9’s looper. If Line 6 had designed the M9’s MIDI implementation to just mimic the footswitch actions, we could just send one command per footswitch and be done. Sadly, the MIDI implementation involves separate commands for each toggle of the switch. Pressing the Play footswitch sends the Play command (CC28 127) but only if the looper is not playing! If it is playing, then pressing Play sends the Stop command (CC28 0.) If the unit is in Overdub, sometimes Play sends Play and sometimes it sends Stop, depending on whether we came from Play -> Overdub or Record -> Overdub! As you might guess, this can get complicated fast.

The code is included as an Arduino sketch below. Use it for whatever you like! You’ll need the MIDI and EXROM libraries installed to make it work.