One of the things I always do when I get a new LED matrix style display is run Conway’s Game of Life on it, so having recently played with some MIDI step sequencers, I thought it time to put the two together. This is the result.
- In a follow-up post, I add some simple MIDI controls.
Warning! I strongly recommend using old or second hand equipment for your experiments. I am not responsible for any damage to expensive instruments!
These are the key Arduino tutorials for the main concepts used in this project:
If you are new to Arduino, see the Getting Started pages.
Parts list
- Arduino Uno
- LOLShield (details here)
- One of the Arduino MIDI Interfaces
- MIDI module
The Circuit
If you already have a LOLShield ready to go, then this can be considered a “beginner” project (assuming you don’t want to dig into the code either).
However if you need to get hold of, and build, your LOLShield, there are some details of how to do that here: LOLShield MIDI Waterfall Display.
One of the Arduino MIDI Interfaces is linked to 5V, GND and TX on the Arduino.
The Code
This code is based on one of the ready made examples that comes with the LOLShield library – “Life”. This is an implementation of Conway’s Game of Life that runs neatly on the LOLShield.
I won’t go into the details here, but consider this an ever changing grid of lights that changes according to some well defined, simple rules, that yields some fascinating patterns. It is part of what is called “code automata” and new variants are still being studied today.
The plan is to use the Game of Life to populate a grid which is then used as the input to a step sequencer. The LOLShield isn’t actually necessary for the operation of the sequencer, but it is an easy way to actually visualise what we are hearing.
The LOLShield is a 9×14 grid of LEDs, so I’m using each columns to represent the nine notes that might be played on any one of the 14 steps. If the LED is on then that note is played.
The basic layout of the code is as follows:
In the loop(): Take a column corresponding to the next step. Work out which notes need to be played and play them over MIDI. Calculate the new Game of Life pattern for that column. Pause for a while to match the tempo of playback required. Move on to the next step.
I’ve been able to use the main functions from the LOLShield Life example almost unchanged. The main change is that each pass of the Game is only calculated for a single column at a time, rather than the whole board.
In terms of deciding which notes to play, I wanted a pattern of nine notes that I thought could sound interesting together in any combination. So I opted to fill it with the first nine notes most closely relating to the natural musical harmonic series starting on C3:
byte midiNotes[MIDI_NOTES] = {
// C3,C4,G4,C5,E5,G5,Bb5,C6,D6
48,60,67,72,76,79,82,84,86
};
I didn’t pay too much attention to which note matches which row on the display, so left it with the default coordinate system where the first note listed is the top row. This feels backwards if you have the music running left to right, but when you rotate it so that it is running bottom to top (like the “waterfall displays”) then the lowest note is now on the left. That is what you can see in the video.
This is plugged into my MT-32 on the Elec Organ 4 sound, which apparently is based on a Vox/Fafisa. I quite like it.
Closing Thoughts
There are so many ways of building algorithmic music, and so many variations for each of those ways, I could be experimenting with tempos, patches, note scales for hours.
It would be nice to create a simple way of changing some of these parameters “on the fly”, but the LOLShield pretty much uses up all of the Arduino’s IO apart from RX/TX so I might need to do it over MIDI using one of my MIDI controller projects.
Kevin