Phase 1: Configure the Pi for Midi
I chose the Raspberry Pi as my primary communication mechanism for a couple reasons. First, I am already familiar with the device having used it on a couple hack projects this year.
Second, after attempting to use the Pi with an Arduino to relay web events over serial and output Midi messages from the Arduino, I discovered a translation issue with differing baud rates between the devices. At this point, I chose to pair down my attempts and use only the Raspberry Pi.
Setting up the Pi to send midi messages is a little involved, but not over complicated. I referenced an excellent post by Silicon Stuff to hack the serial baud rate close to 31250 (Midi spec).
First, I hooked the Midi cable up to the Pi.
Pin 1 (5v) goes through a 220 ohm resistor to Pin 5 of the Midi cable.
Pin 5 (Ground) goes to the ground Pin 2 of the Midi cable.
Pin 7 (TX - serial transmit) goes to Pin 4 of the Midi cable.
Second, I edited /boot/cmdline.txt on the Pi:
sudo nano /boot/cmdline.txt
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
This enables the AMA0 serial port on the Pi to be used by Node.
Third, I added some lines to the end of /boot/config.txt :
sudo nano /boot/config.txt
# change uart clock to 2441406 for midi 31250 baud rate init_uart_clock=2441406 init_uart_baud=38400
This slows down the Pi serial baud rate to approximately 31250 if a serialport is opened at 38400 baud rate (one of the standard baud rates supported).
Fourth, I modified write access to the AMA0 port to allow Node.js to use it
Now, the Pi is able to communicate at the speed that Midi requires.