Skip to content

Instantly share code, notes, and snippets.

Last active August 15, 2023 04:23
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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+

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