The generative AI MIDI module lets you add generative AI capability to electronic musical instruments over a MIDI interface. This system runs on a Raspberry Pi Zero 2 W.
This program doesn't make any sounds, it just sends generated MIDI messages over a Raspberry Pi's serial port.
You'll need:
Flash an SD card with "Raspberry Pi OS Lite 64-bit" using the Raspberry Pi Imager. These instructions work with Kernel 6.1, Debian 12 Bookworm.
Make sure that SSH is enabled and that you know the username and password. The username should be pi
.
If needed, set up USB ethernet by following the instructions here, adding dtoverlay=dwc2
to config.txt
and modules-load=dwc2,g_ether
to cmdline.txt
in the boot partition.
SSH into the Pi and run:
sudo apt update && sudo apt upgrade
sudo apt install git
git clone https://github.com/cpmpercussion/genAI-MIDI-module.git
There are three install scripts. You'll need to have an internet connection to get these to work:
install_hardware.sh
: sets up ethernet-over-USB and enables the UART for MIDI in/out.install_software.sh
: installs Python and other packages needed for the genAI program.install_start_on_boot.sh
: installs a systemd service that runs the genAI program when the Raspberry Pi bootsOnce you have run these scripts (and they were successful), you can test the genAI MIDI module works by running: start.sh
.
N.B.: The genai_midi_module.py
program takes a long time to start (~90s).
You can stop the genai_midi_module.py
program by typing Ctrl-C.
Config is in config.toml
start.sh
starts the main python file
This project also works with poetry for defining dependencies and setting up a virtualenv for you (yay).
this replaces the software install step...
export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
poetry install
N.B.: working towards making this the default on all platforms.