How I recorded an album in an evening with a lunchbox modular and a python script
For some people (me), the hardest part of making music is finishing. It is easy and fun to get lost, hypnotised by repeating loops, enjoying the infinite choice and procrastinating by buying stuff or designing circuits.
At Loop 2016 in Berlin this year, I was wandering around the Funkhaus with a tiny battery-powered modular synth in a lunchbox (details below), a little bag of patch cables and a pair of old headphones. The synth had a odd set of modules but they worked well together. They were musical, with chords and melodies and interesting samples, fun to demo and play with in the canteen.
I thought it would be nice if , instead of noodling, I made and finished something with it. So I looked for some arbitrary constraints.
Dennis Desantis explains the concept of arbitrary constraints well in his wonderful book Making Music:
Create a “narrow frame” of possibilities, and then act entirely within that frame. Applying arbitrary constraints helps to limit your field of options, allowing you to move forward.
It’s important to note that these constraints really are arbitrary; you’re attempting to eliminate perfectly valid options rather than bad ones.
My rather silly process was:
- Write some code that will write some instructions for recording some tracks
- Run that code
- Read the instructions and record the tracks. (The album is now here on bandcamp)
- Write a Medium post about it
So here we are.
The idea isn’t new; in the 1950s John Cage popularised indeterminacy; graphic and text scores that could be interpreted in many different ways. Vinyl copies of his 1969 recording HPSCHD came with individually randomised computer printed sheets giving instructions for how the volume and tone controls should be changed while playing the record.
Cage seems to have believed that his indeterminate scores should be followed extremely carefully — just as an orchestral player follows a traditional score very closely. When David Tudor performed Cage’s scores, he’d spend a long time analysing and preparing the score, making precise measurements and notations.
Williams Mix is a tape piece with a 192 page score that precisely notated thousands of splices in 600 pieces of recorded tape. After a year’s painstaking and tedious work by Cage, Tudor, Earle Brown and others, the four minute long piece was premiered in 1958.
But when The New York Philharmonic played Cage’s Atlas Eclipicalis in 1964, the orchestra didn’t prepare, but casually improvised through the score, inciting a furious Cage to call them “a group of gangsters.” (There’s a lot more to this whole story, which is brilliantly told in ‘When Orchestras Attack’ by Benjamin Piekut.)
It’s up to you whether you want to take the Tudor approach or the NY Philharmonic approach. My own performance definitely tends towards the latter, to my shame.
How to use and modify the script
This python script will create a text file containing a score for a complete album.
Update: Here’s a web version of the script created by ApolaKipso
The score for this album, which the script named Bakusre, is here.
To run the script on a Mac (or another computer with Python installed):
- Click ‘Download .zip’ and copy the file ‘compose.py’ into a folder somewhere.
- Open Terminal, type ‘cd’ and a space. Then drag the folder containing ‘compose.py’ into the Terminal window and hit return. You’re now in that folder.
- Now type: ‘python compose.py’
- If you look in the folder, you’ll find a text file with a made up name like ‘Qoyatenu.txt’. This is the complete score for your new album, entitled Qoyatenu.
If you just want to play the score, skip on to the section below.
It’s a very crude, easy-to-read bit of code. Near the top, various options are defined as lists:
filter = [
Then, inside a loop to create multiple tracks, it picks options from each list.
score.write(“Filter: “) #Print a header
score.write(random.choice(filter)) #Print an option
score.write(“.\r”) #Print a carriage return
So while this version of the code was designed for my little modular, it should be easy to modify for other situations or instruments.
How to read and play the score
Your album will have between five and twelve tracks. Each track is given a name. These are randomly generated words with enough vowels and consonants to be roughly pronounceable.
If you fiddle with the code you can make the names more Dutch (double vowels) or more Aphex-ey (numbers instead of consonants).
Each track has a mood. This is just two words picked from the rather odd moodlist.net.
Then there are series of options from the lists I described above, and finally there’s a crude graphic score; a number of lines with various dots and brackets on them.
In practise, I found the moods really useful and challenging. WTF is ‘refreshed and infuriated’ music supposed to sound like? I don’t know, but now my brain is working.
I also found the titles useful. I liked ‘Kusawoxaba’ as a title. It sounded to me like a great Mbaqanga track from this mixtape. I was a bit sad that the instructions called for ‘nature sounds’ and extreme resonance, and the track ended up sounding like poundshop Musique Concrete. I still want to make Kusawoxaba properly.
The specifics — slope, modulation etc — I cherry-picked, but tried to stick to the sound source and the filter type, because they had such a dramatic effect on the overall track. Obviously you could be very strict; it depends how tightly you want to be constrained. Staying true to Dennis’ instructions, I was disappointed that the scores didn’t offer the things I wanted to use; none of the nice drum, speech or vocal loops could be used on this album.
Finally, the graphic element didn’t seem useful to me in practice; I didn’t have the patience to really make sense of it, but it feels like there should be a useful difference between this:
Recording the album
My technique was this:
- Run compose.py
- Take a look at the output. If it feels annoying, for whatever reason, run the script again until you’re happy you want to spend a few hours with this score.
- Print out the score. Now it’s real.
- Spend a few minutes building a patch, reflecting on the score and rehearsing a performance. This can take as long as you like. You might annotate the score, plan sections within the track. You might not.
- Record. I recorded everything live into two tracks on Audacity, tried to keep tracks to 4–6 minutes, avoided retakes, did no editing beyond trimming off silence and normalising the recording. I wish I’d used a few more delay/reverb effects now.
- Export your recording, name it.
- Don’t listen back, just break down your patch and start on the next track.
- Congratulations, you’ve made an album. Now upload it to Bandcamp. (Here it is.)
Listening back, I liked a few bits. Rilsupa works quite well, particularly the ridiculous bass and the end. But the sequence of pieces have a beginning and an end, and they are finished. Next time, maybe they’ll be better.
Left to right:
- Turing Machine: A random looping, sequencer that makes slowly evolving patterns.
- Volts Expander: Plugs into the Turing for more variation in the sequences.
- Chord Organ: A prototype module that plays chords.
- Pip Slope (by ALM): Acts as simple envelope generator or LFO
- Humpback Filter (by God’s Box): Resonant filter with low pass, high pass, bandpass and notch outputs. With resonance on full, it becomes an oscillator.
- Radio Music: A little sample player. This one has the Loop Divider firmware which puts out triggers synced to the loop.
- Mixer & Headphone Amp: Another prototype, built on Kylee’s protoboard and a Synovatron panel. It’s a cMoy headphone amp with a 4-input mixer that pans the signals in stereo.
It would be easy to make the python script more complex; to add sections within songs, to create more sophisticated naming or mood systems, to suggest melodic lines or sequences, to generate beautiful graphic scores, or clever album artwork.
Gil Weinberg and Mason Bretan’s session at Loop showed just how far you can go with machine learning and automatic improvisation.
But that feels a little like advanced procrastination. My next step will be to run the script again and try a bit harder with the music next time.