Computer-generated music is starting to pop up more and more. People have figured out what makes music sound good, and they’ve been able to codify those things in software. On top of that, people have figured out how to write software that learns on its own what makes music sound good. Regardless of which method is used, it’s becoming pretty clear that, like a lot of things we are good at, computers are going to be better than us at creating music some day.
Working with computers to make music is a process that combines, among other things, human creativity, music theory, and computer science. I’m pretty interested in working at the intersection of those fields, and my guess is that others are too. So to that end, I put together some simple software that auto-composes songs.
There are some basic musical constraints that I programmed in, but within those constraints the software randomly chooses the song’s tempo, chord progressions, drum beat, and melody; that way it’s able to produce a wide variety of songs. Here are ten songs that the algorithm generated; keep in mind that with this software, it’s as easy to make ten songs as it is to make ten thousand.
It’s fun to listen to what it comes up with, but the real purpose of this project is to lay out a simple framework that anyone can use to produce their own computer-generated songs. I think if we give programmers and musicians easy-to-use tools to create their own algorithm-based music, we’ll get some really cool results.
I used Python code (with a library called MIDIUtil) along with a free command-line synthesizer called FluidSynth to make my auto-composer. I wrote it with extensibility in mind, so hopefully it’s easy to use as a structure within which to implement your own ideas, or at least as an example of how you could write something similar from scratch using these tools. The main goals were to pique people’s interest by demonstrating what an auto-composer can do, and to make it as easy as possible for people to start writing code themselves.
The project lives here; there’s not a lot of code, and it’s easy to follow. Check out the readme for more details and to see how to get started.