You Can Send MIDI Over I2C If You Really Need To

The Musical Instrument Digital Interface has a great acronym that is both nice to say and cleanly descriptive. The standard for talking to musical instruments relies on a serial signal at 31250 bps, which makes it easy to transmit using any old microcontroller UART with a settable baud rate. However, [Kevin] has dived into explore the utility of sending MIDI signals over I2C instead.

With a bit of hacking at the Arduino MIDI library, [Kevin] was able to get the microcontroller outputting MIDI data over the I2C interface, and developed a useful generic I2C MIDI transport for the platform. His first tests involved using this technique in concert with Gravity dual UART modules. After he successfully got one running, [Kevin] realised that four could be hooked up to a single Arduino, giving it 8 serial UARTS, or, in another way of thinking, 8 MIDI outputs.

At its greatest level of development, [Kevin] shows off his I2C MIDI chops by getting a single Raspberry Pi Pico delivering MIDI signals to 8 Arduinos, all over I2C. All the Arduinos are daisy-chained with their 5V and I2C lines wired together, and the system basically swaps out traditional MIDI channels for I2C addresses instead.

There’s not a whole lot of obvious killer applications for this, but if you want to send MIDI data to a bunch of microcontrollers, you might find it easier daisy-chaining I2C rather than hopping around with a serial line in the classic MIDI-IN/MIDI-THRU fashion.

We’ve seen [Kevin]’s work before too, like the wonderful Lo-Fi Orchestra. Video after the break.

9 thoughts on “You Can Send MIDI Over I2C If You Really Need To

      1. Well I was printing out my MIDI messages, posting them and scanning them back in, but then I decided putting sheet music in the post had a better latency for keyboard playing, albeit with a bit of a delay as you had to batch the notes up and send them in one go to reduce jitter. Scanning it in was quite tricky on reception though, so eventually I cut out the “middle person” and got a musician to play it instead.

        I have found that if you switch over to a full orchestral score, then the bandwidth is fantastic, especially for the price of a stamp, plus it has the added bonus you can read it on the train when you receive it. Getting an orchestra to decode it at the other end is left as an exercise for the reader…

        (No, I don’t quite know why I sent MIDI over I2C either… but “just because” was a good enough answer for me :))

        Kevin

        1. Never mind the negative vibes, Kevin! I enjoyed reading your article, especially since I was somewhat in the same boat some time ago and I could have used this solution and your enhancement of the 47 effects MIDI library. I had an Arduino Mega running the show, communicating with a Pi running QLC+. Also, some SPI display and a DMX-out needed to be driven and I was quickly out of usable IO on the Pi. Internal communication now goes over software serial on the Pi, less-than-optimal. I2C comms could have been useful!

          Also, your experiments with nRF24+MIDI are an interesting read! As an accessory to the above project, I’m sending commands to up to 5 slaves, of which at least one of them translates the commands back to Program Changes and Control Changes. nRF packets of up to 32 bytes payload are more efficient than sending single MIDI bytes, as you have found out ;)

          1. Haha – yes! I need to optimise my RF24L01 layer… that is the next job :)

            Thanks for your comments – that sounds like an interesting application.

            Aside: I think I did see the MidiBox stuff, but it looked more like a non-MIDI intra-module link to me, sending messages specific to the Teletype, but maybe I was getting it confused with i2cmidi from here: https://github.com/attowatt/i2c2midi

            Either way, PIC programming and custom PCBs is quite a long way away from simply messing around with an Arduino. And having it as a transport layer for the standard Arduino MIDI library makes routing applications fairly trivial.

            But it is all very experimental. I wouldn’t attempt to use it for anything significant… maybe that would be the point at which to investigate MIDIBox more fully.

            Kevin

    1. Great! Do drop me a line if you do it :)

      But please do note my warnings about the experimental nature of the code and the limitations – especially around addressing and so on. Also I’ve not done any testing with anything else sharing the bus…

      In short – do have a play and let me know how you get on, but please don’t rely on it for anything significant.

      Kevin

Leave a Reply to ViktorCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.