Skip to content

Latest commit

 

History

History

midi_light_show

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

midi_light_show

This project implements a simple LED light and music show which can be executed on a Raspberry Pi. You can provide a MIDI file and it will display a pleasing series of blinkenlights.

Youtube: Rustberry Pi Plays Erik Satie

Raspberry Pi LED Wiring

This project supports multiple LED layouts. Shown below is the "basic" layout with eight LEDs. Be careful to check the GPIO pins of your specific model of Pi, as they may not match what is shown below.

Fritzing Diagram

You can also choose an "extended" layout which uses additional LEDs, or specify additional layouts, by modifying the [pins] section of Settings.toml:

layout = "basic"   ## select which pin layout you want to use

[pins]
extended = [13, 6, 5, 7, 23, 18, 15, 14, 21, 26, 20, 16, 19, 11, 9, 10, 22, 27, 8, 25, 17, 4, 3, 2]
basic = [13, 6, 5, 7, 23, 18, 15, 14]

The diagrams for the "extended" layout are available in the doc directory:

Usage

We recommend downloading the JS Bach Goldberg Variations from https://www.opengoldbergvariations.org/.

You need to start fluidsynth as a server, allow MIDI input, connect it to your ALSA sound device on the Pi, and then correctly select the device number when starting this application:

sudo apt-get install fluidsynth fluid-soundfont-gm libasound2-dev

# -g flag is useful for boosting volume, try -g 2 if you need
fluidsynth -a alsa -i /usr/share/sounds/sf2/FluidR3_GM.sf2 -g 1 --server

aconnect -lio   #  and COUNT the number of MIDI related devices

cargo run /path/to/file /path/to/file /path/to/file

Usage as a web server

The project is now intended (since v0.3.0 of midi_light_show) to be run as a web server and will accept PLAY/STOP/PREV/NEXT commands from the BreadAmp UI 🍞.

Building on Raspbian

You need to install libsound2.

sudo apt-get install libasound2-dev

At this point you can then build the alsa crate for rust on your Pi.

Misc OS Configs

Mac OS X

Raspbian

Virtual MIDI

Required reading: http://sandsoftwaresound.net/qsynth-fluidsynth-raspberry-pi/

Helper command -- play a midi file to your speaker using fluidsynth:

fluidsynth -a alsa -n -i /usr/share/sounds/sf2/FluidR3_GM.sf ~/Goldberg_Variations.mid

See MIDI devices:

aconnect -lio

See sound cards:

aplay -l

Output to HDMI monitor

The easiest way to have your Raspberry Pi output sound in a timely fashion is to hook up an HDMI monitor and select it as the output source.

Transforming MP3s to MIDI

Although it often results in MIDI files with strange sound artifacts, one can use the following pipeline to transform MP3s to MIDI was as follows:

For instance, after converting the MP3 for Rachmaninov's Prelude in C Sharp Minor, Op 3 to a WAV, we used the following settings in AmazingMIDI in order to generate a noisy but somewhat accurate MIDI output file:

Rach Prelude to MIDI

Further Reading

Acknowledgements

Bach's Goldberg Variations are available under Creative Commons License here.

The availability of the following audio libraries is greatly appreciated:

Thank you to fluidsynth, which allowed us to send MIDI output to an audio device on Raspberry Pi.

Audio and MIDI Resources

Wikipedia provides a delicious selection of classical MIDI music, most of which are in the public domain/licensed in a Creative Commons fashion, etc.

We drew from MP3 audio found at Project Gutenberg Music Category.

We recommend listening to selections from Bernd Kreuger's Classical Piano MIDI Page. There are a number of different composers represented here, and it was fun to try some of these out on the Pi!

We also recommend listening to Fredrik Johansson's MIDI repository, an excellent, extensive body of work! Bravo! Their work is available for download.