I want to use this with my iPad, so there are some special requirements. It has to be compatible with an iPad, and it has to be compatible with the Lemur app doing bidirectional sysex communication with an AxeFX.
The first requirement was easy to meet. The iPad will recognize a standard midi interface if it reports maxpower of 20mA or less. One line of code in the Teensy usbMIDI library needs to be changed:
In file: \arduino-1.0\hardware\teensy\cores\usb_midi\usb.c Find: bMaxPower On this line, change the 50 to 20. Save the file. Restart Arduino.
Meeting the second requirement has been more difficult. I’ve tried two ways of handling the incoming sysex messages (from an AxeFX):
- Pass the sysex message bytes via USB to the iPad with minimal buffering, only as required to encode the sysex data into USB messages. Lemur receives the sysex message at whatever rate the external device is sending MIDI … about 3 bytes per millisecond.
- Store the sysex message in a fifo buffer, and once the complete sysex message is in the buffer, send it to the iPad as quickly as possible. Lemur receives the entire message in a millisecond or two.
There is a problem with method #1. Lemur appears to chop off the tail end of a sysex message if the message takes more than a certain amount of time (one Lemur frame?) to be received.
Method #2 seems to work perfectly with Lemur, but has a limitation that the sysex message cannot be larger than free RAM in the Teensy microcontroller.
If there is interest I will post a schematic and the source code.