Sunday, 27 September 2015

Novation Release Custom Firmware API for Launchpad Pro!

The Novation Launchpad music controller has been around for several years in various form; it is a USB MIDI grid controller which is primarily designed to work with the Ableton Live program but can also be used as a MIDI controller on its own.

I am not a user of Live but I have always seen the potential of the Launchpad as part of a standalone MIDI sequencer, like a cheaper Monome. I bought my first Launchpad years ago and immediately got to work writing code to run against it.

 The original Launchpad showed up as a MIDI device (assuming you have Novations drivers installed) and you could open it using your programming language of choice (I was using C++ on Windows MIDI API).

Then when you press buttons you receive MIDI messages (notes for the grid and CC's for the menu buttons). Sending the same messages back to the controller turns the lights on and off. And it is pretty much that simple!

 My real aim was to get something that could run MIDI sequencers that were not tied to a PC, so I started looking at USB hosting from a microcontroller. The original Launchpad was not USB MIDI class compliant (that came with the Launchpad S) but used a custom interface based on interrupt endpoints. I pulled the descriptors and used an FTDI VNC2 USB host chip to implement sequencer sketches, which did work, but I had some issues with the early versions of FTDI's toolchain for the VNC2 and kind of ran out of steam.

Later on I started working on an Arduino shield where the VNC2 would just have the USB hosting duties, with the Arduino running the sequencer sketch. That project is still in the pipeline, but what I always thought to myself what would be REALLY good is if Novation opened up the Launchpad with a firmware API so developers like me could actually load custom firmware for sequencers, etc, into the Launchpad itself (in fact I've been wishing the same for lots of musical hardware – are you listening Arturia, Korg etc.. :)

 Anyway just last week I heard that they have actually gone and done it a couple of months back, with a custom firmware API for the Launchpad Pro!!! I immediately had the credit card in my hand and was unpacking a brand new Launchpad Pro the next day.

Check out the API here
https://github.com/dvhdr/launchpad-pro

 I can't quite express the awesomeness of this move my Novation!!! OK it may be a pretty niche thing right now, but I hope it sets a precedent where a creation of custom firmwares for these types of device really takes off.

 Anyway, I got started trying to make a version of one of the sequencers I originally built on the original Launchpad and the FTDI VNC2. Novation 's API provides a simple set of callbacks that you implement in your “app”. These are an initialisation routine and handlers for incoming MIDI messages, button presses etc. Plus there is a simple set of hardware abstraction functions for controlling the lights behind the buttons, sending MIDI etc.

 The architecture is 32-bit ARM and Novation helpfully provide a Ubuntu Virtual Machine image of a configured development environment using Eclipse and GNU C for ARM. A default firmware project is provided which it is pretty easy to start playing with. The make process invokes a utility to convert the output HEX files into a MIDI SYSEX which can be sent to the Launchpad Pro over USB.

In order for the device to take new firmware it needs to be set into a bootloader mode (by holding the Setup button when powering on).  I quickly discovered an issue; after uploading custom firmware, the Launchpad was not enumerating as a USB MIDI device any more (in fact it was lost to USB until put back into bootloader mode). After trying to work out what I was doing wrong, I contacted the Novation development team via Github and raised an issue which they have acknowledged and will hopefully soon fix.

Luckily the LPPro does have a “real” MIDI connection in the form of a pair of 3.5mm jack sockets which break out to standard 5-pin MIDI connectors via supplied cables. This “hard” MIDI connection does work, so I have been able to use this for now to get output from my sketch to play an external synth.

When you load new firmware into the LPPro you are actually replacing the factory firmware. The SYSEX file for the factory firmware is supplied with the SDK so you can easily switch back to it, however there is no source code available for the factory firmware. Maybe this is not so surprising, but it does mean you have to take an “all or nothing” approach to customising the LPPro. There is no option to “tweak” the factory functionality without rewriting it yourself first! I hope Novation address this – maybe it would need the high level functionality of, say, the factory “drum” and “note” modes to be ported to the custom firmware API so the source for those could be released for customisation without having to open up all the proprietary low level stuff.

 I am using a Windows 7x64 machine and I did find that sometimes the VirtualBox VM / VAGRANT package was getting in a funny state such that my VM login could not access the source code projects in Linux (probably something I was doing wrong). Also there was the annoying need to copy the output SYSEX file from VM out to host OS on every build so I could upload it to MIDI. I eventually decided to install the GCC-ARM compiler and Eclipse IDE natively on Windows, but that was not too hard and Novations VM package was invaluable to see how the setup should work.

Another thing that gets a bit tiresome is the procedure for putting the LPPro into bootloader mode (a process which needs a manual power cycle of the LPPro and needs USB to re-enumerate, so the LPPro device needs to be re-selected in MIDI-OX before the SYSEX can be sent). When debugging you do this a lot and it gets annoying, not to mention putting extra wear and tear on the power switch. A nice feature would be a special SYSEX command to put the LPPro into bootloader mode without a power cycle and ideally without any USB re-enumeration. Then the SYSEX loader could set bootloader mode before uploading and all the steps included in a makefile (maybe this bootloader command could be “unlocked” via a physical button combination if there is a worry about unwanted firmware updating)

 Anyway, I am not going to complain any more. I applaud Novation for releasing this API and I hope other manufacturers of music and/or other devices follow suit. Interesting times!

This is my first sequencer project, I expect to be doing lots more like this over the coming weeks and months :)

You can get my code (forked repo) here
https://github.com/hotchk155/launchpad-pro

Or if you just want the sysex
https://github.com/hotchk155/launchpad-pro/blob/master/build/launchpad_pro.syx


2 comments: