cpmpercussion / genAI-MIDI-module

A generative AI system for electronic music that runs on a raspberry pi.
MIT License
2 stars 2 forks source link

GenAI MIDI Module

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.

Making

Prepare Raspberry Pi OS

You'll need:

  1. 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.

  2. Make sure that SSH is enabled and that you know the username and password. The username should be pi.

  3. 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.

  4. SSH into the Pi and run:

sudo apt update && sudo apt upgrade
sudo apt install git
  1. clone this repository: git clone https://github.com/cpmpercussion/genAI-MIDI-module.git

Install

There are three install scripts. You'll need to have an internet connection to get these to work:

Once 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.

Using

Poetry Install

This project also works with poetry for defining dependencies and setting up a virtualenv for you (yay).

this replaces the software install step...

  1. install poetry.
  2. if on Raspberry Pi, use this workaround to stop poetry failing: export PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring
  3. run poetry install

N.B.: working towards making this the default on all platforms.