Skip to content

Instantly share code, notes, and snippets.

Last active April 17, 2024 00:00
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CarloCattano/8c01a6dea6ecbb459acd0b6bcd752ea6 to your computer and use it in GitHub Desktop.
Save CarloCattano/8c01a6dea6ecbb459acd0b6bcd752ea6 to your computer and use it in GitHub Desktop.
Raspberry pi UART MIDI Serial

rp3.+ raspberry OS lite (or better PatchboxOS as a starting point)

testing notes
Disable bluetooth or send bt to another serial port
    sudo nano /boot/config.txt

midi-uart0 ttymidi will set Serial S&R MIDI at 31250 when using 38400 baudrate automatically

Remove UART serial shell option in boot/cmdline.txt

   sudo nano /boot/cmdline.txt
            console=serial0,115200 console=tty1

Disable Bluetooth

    sudo systemctl disable hciuart.service
    sudo systemctl disable bluealsa.service
    sudo systemctl disable bluetooth.service

OR move Bluetooth to other serial port


install wiringpi ( optional )

    sudo apt-get install wiringpi
    gpio readall    (check tty dev tx rx)

download and install ttymidi to access pi serial


    tar -zxvf ttymidi.tar.gz

    cd ttymidi/

    nano Makefike
    add -lpthread in "all:"

    sudo make install

start serial midi and stay in background

    ttymidi -s /dev/ttyAMA0 -b 38400 -v &   // It will s&r at 31250 since midi-uart0

change midi device name

    ttymidi -s /dev/ttyAMA0 -v -n device_name

Depending on your setup you can manage ttymidi midi port instance after creation with ALSA MIDI or JACK

send the ALSA midi to Jack Midi for system messages (clock etc) to pass through as well

ALSA - list and connect to available ALSA MIDI input clients

    aconnect -l    aconnect id:0 id2:1                     

Connect TX/RX/GND (use midi specs circuitery for protection etc) <-----

TX RX PINS ON THE PI ( Check your model , tested rpi3B+

Copy link

konsumer commented Apr 16, 2024

Very helpful info, but hardware "midi specs circuitery" link is dead. This is a nice summary of the circuit:


or this:


Also, a helpful video tutorial can be found here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment