janiluuk / genAI-MIDI-module

A generative AI system for electronic music that runs on a raspberry pi.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

  • an SD card
  • a Raspberry Pi Zero 2 W
  • an internet connection
  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:

  • 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 boots

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

  • Config is in config.toml

  • start.sh starts the main python file

About

A generative AI system for electronic music that runs on a raspberry pi.

License:MIT License


Languages

Language:Python 90.7%Language:Shell 9.3%