Skip to content

Instantly share code, notes, and snippets.

@pthrrr
Last active October 4, 2025 08:14
Show Gist options
  • Select an option

  • Save pthrrr/7e6d40f720b1a1ebd9618dc95c08bc65 to your computer and use it in GitHub Desktop.

Select an option

Save pthrrr/7e6d40f720b1a1ebd9618dc95c08bc65 to your computer and use it in GitHub Desktop.
Use RaspberryPi as MIDI-Host and make a Bluetooth MIDI Controller send commands to a USB MIDI Device

Raspberry Pi/Linux MIDI Host

Intro

In the following step-by-step guide I demonstrate how to connect a bluetooth MIDI Controller to an USB MIDI Device using a Raspberry Pi as MIDI Host. It should be possible to use this guide to make any Linux (Debian/Ubuntu) System act as a MIDI Host.

In this example I use the following hardware:

[ MIDI Controller  ] --> [    MIDI Host   ] --> [  MIDI Device ]
[ M-Wave Chocolate ] --> [Raspberry Pi 3B+] --> [Zoom MS-70CDR+]
[     Sender       ] --> [     Router     ] --> [    Reciever  ]

You should be able to use any other MIDI devices.

Prerequisite

Raspberry Pi

I recommend installing the latest Raspberry Pi OS (Lite):

Release date: November 19th 2024
System: 64-bit
Kernel version: 6.6
Debian version: 12 (bookworm)

Connect USB MIDI Device (MS-70CDR+) to Raspberry Pi.

  • sudo apt update && sudo apt upgrade -y - update packages
  • sudo apt install bluez bluez-tools -y - install bluez

M-Wave Chocolate

Use CubeSuite App (iOS/Android) to configure the Chocolate to send any MIDI data you want.

Program Change Command

I think this is the default setting for the Chocolate.

Select option: Program change A

SysEx Command

Using the app you can program the Chocolate to send SysEx commands. The author of the zoom-explorer published a list with most commands. To toggle the tuner on/off you can do the following:

Select option: Advanced custom mode 1 -> FOOT SWITCH [A] -> Mode: Single step (switch between two Banks)

  • Bank A -> SysEx: F0 52 00 6E 64 0B F7 (Tuner on)
  • Bank B -> SysEx: F0 52 00 6E 64 0C F7 (Tuner off)

You can also toggle an effect on/off using this commands as mungewell found out. :

f0 52 00 6e 64 20 00 00 00 00 00 00 00 00 f7
f0 52 00 6e 64 20 00 00 00 01 00 00 00 00 f7
                           ^^ 0=Off, 1=On
                        ^^ Item 0 = Effect Enable
                     ^^ Slot 0

Don't forget to disconnect phone from Chocolate!

Connect MIDI Host to bluetooth Controller

NOTE: You do not have to connect the Chocolate by bluetooth to the Raspberry Pi! You can also make an USB connection and skip this step.

Turn the Chocolate on and enter the following commands on the Raspberry Pi:

  1. sudo bluetoothctl
  2. power on
  3. agent on
  4. default-agent
  5. scan on
    • Chocolate should appear as FootCtrlPlus, showing the MAC-Address
  6. scan off
  7. pair <MAC-Address>
  8. connect <MAC-Address>
  9. exit

Route MIDI Data

If not already done, connect the MS-70CDR+ to the Raspberry Pi.

Enter the following commands:

aplaymidi -l

Port    Client name                      Port name
14:0    Midi Through                     Midi Through Port-0
24:0    ZOOM MS Plus Series              ZOOM MS Plus Series MIDI 1
128:0   FootCtrlPlus                     FootCtrlPlus bluetooth

aconnect "FootCtrlPlus" "ZOOM MS Plus Series"

The Chocolate (FootCtrlPlus) should now be able to send MIDI data to the MS-70CDR+!

You can varify that the Raspberry Pi is receiving data using the command aseqdump -p [PORT].

  • aseqdump -p 128:0

Pressing FOOT SWITCH [A] should look like this:

Waiting for data. Press Ctrl+C to end.
Source  Event                  Ch  Data
128:0   System exclusive           F0 52 00 6E 64 0B F7
128:0   System exclusive           F0 52 00 6E 64 0C F7
  • CTRL+C to exit

Auto-Connect Devices on Boot

Now let's make the connection permanent to autowire the devices on every boot of the Raspberry Pi!

  • nano /usr/local/bin/midi_connect.sh
#!/bin/bash

sleep 2
aconnect "FootCtrlPlus" "ZOOM MS Plus Series"
exit 0
  • sudo nano /etc/systemd/system/midi-connect.service
[Unit]
Description=Auto-connect MIDI Devices
After=sound.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/midi_connect.sh
RemainAfterExit=true

[Install]
WantedBy=multi-user.target
  • sudo systemctl daemon-reload
  • sudo systemctl enable midi-connect.service
  • sudo systemctl start midi-connect.service

Rebooting the Raspberry Pi should now connect the Chocolate and MS+.

Re-Connect Device when USB plugged in

When one of the devices gets reconnected to the USB port, the midi_connect.sh script should automatically re-run to to make the midi connection work again without rebooting the Raspberry Pi.

  • lsusb
Bus 001 Device 005: ID 4353:4b4d Jieli Technology SINCO
Bus 001 Device 004: ID 1686:07a1 ZOOM Corporation ZOOM MS Plus Series
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • ZOOM MS Plus Series: 1686:07a1

    • idVendor=1686, idProduct=07a1
  • Jieli Technology SINCO: 4353:4b4d

    • idVendor=4353, idProduct=4b4d
  • sudo nano /etc/udev/rules.d/99-midi-devices.rules

# ZOOM MS Plus Series
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idProduct}=="07a1", ATTRS{idVendor}=="1686", RUN+="/usr/local/bin/midi_reconnect.sh"

# Jieli Technology SINCO | M-Vave Chocolate 
ACTION=="add", SUBSYSTEM=="usb", ATTRS{idProduct}=="4b4d", ATTRS{idVendor}=="4353", RUN+="/usr/local/bin/midi_reconnect.sh"
  • sudo nano /usr/local/bin/midi_reconnect.sh
#!/bin/bash

# Wait a moment for the device to be fully initialized
sleep 2

# Check if the devices are present
if lsusb | grep -q "FootCtrlPlus\|ZOOM MS Plus Series"; then
    # Re-run the original connection script
    /usr/local/bin/midi_connect.sh
fi
  • sudo chmod +x /usr/local/bin/midi_reconnect.sh
  • sudo udevadm control --reload-rules
  • sudo udevadm trigger

Now you should be able to disconnect and reconnect the M-Vave Chocolate or MS-70CDR+ from the Raspberry Pi and the MIDI connection will be restored after few seconds.

Read-Only System

To prevent data corruption on SD card by pulling the power plug of the Raspberry Pi a read-only file system is recommended.

  • sudo systemctl disable dphys-swapfile.service - disable swap files
  • sudo raspi-config
    • Select 4 Performance Options
    • Choose P3 Overlay File System
    • Select Yes to enable read-only mode
    • Choose Yes when asked about enabling boot-time overlay
    • Reboot when prompted
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment