Arduino MIDI Remapper - Part 1

In my last post I set myself the task of designing an interface to remap the MIDI messages from a Hammond XB5 organ, allowing a Ferrofish B4000+ sound module to be operated using the organs controls. Eventually I could build the electronics into the organ. In order to investigate the MIDI messages generated by the organ I used a MIDI-USB interface on my computer with MIDI-OX software. In this post I describe the hardware and the use of Arduino libraries.

The Hardware

For convenience I decided to use the Sparkfun MIDI ‘shield’. This came as a partially-assembled PCB, with all of the surface-mount parts already fitted. 0.1” headers were also needed, as these do not come with the kit. By default the MIDI board uses the Arduino UART for transmit and receive. A disadvantage of this is that it ‘ties-up’ the Arduinos serial port, which means that the Arduino console cannot be used for sending messages to the screen to help with program debugging. Fortunately the Sparkfun board can be configured to route the MIDI comms via digital I/O pins 8 and 9 instead. This involves cutting tracks and soldering blob links and is explained in the excellent MIDI Shield Hookup Guide. As well as modifying the hardware we need to configure the software so that the Arduino uses digital I/O pins (pins 8 & 9 in our case) instead of the UART. To do this we need to use the SoftwareSerial library.

Fig.1 - Arduino Uno with Sparkfun MIDI Interface

The Code

For this project I am using the Forty Seven Effects MIDI library. The instructions for installing this are in the MIDI Shield Hookup Guide. The SoftwareSerial library is included in the Arduino IDE and does not require separate installation. Before writing the code for translating the organ MIDI messages, I made some test code to check the hardware and confirm the correct configuration of the MIDI and SoftwareSerial libraries. The test code plays an ascending sequence of notes on a connected keyboard or sound module. The code is shown below.

#include <MIDI.h>
#include <SoftwareSerial.h>
SoftwareSerial softSerial(8, 9); // RX, TX
MIDI_CREATE_INSTANCE(SoftwareSerial, softSerial, MIDI);

int note;
const int channel = 1;

void setup() {

void loop() {
  for (note=10; note <= 127; note++) {
    MIDI.sendNoteOn(note, 100, channel);
    MIDI.sendNoteOff(note, 100, channel);
The correct operation of the test code and MIDI hardware was confirmed first using MIDI-OX, then using the Ferrofish B4000+ sound module.

Continued in Part 2


MIDI Shield Hookup Guide

Disclaimer: This is my personal blog. Views expressed in my posts are my own and not of my employer. The information provided comes with no warranty. I cannot be held responsible for the content of external websites. Any practical work you undertake is done at your own risk. Please make health and safety your number one priority.