Blog Post

Return to blog feed

Side Project: Random Music Generation

December 10th, 2012

This week's random side project was inspired by my friend Bryan Ploof and my Music and Technology class. We've been discussing music generated by computers with little or no human influence, including attempts to map anything from fractals to sorting algorithms to musical notes. Michael Matthews gave a lecture on his research in creating music using cellular automata. Cellular automata are sets of simple rules that define how a grid of "cells" evolves over time. They provide very interesting possibilities in the generation of music because their rules often generate musically interesting patterns and progressions. Michael's approach was to use a one-dimensional automata to control the pitches and timbres of sound available to a player, who modulated the sound directly through motions picked up by a webcam.

My goal was to make a system that could act autonomously to create a unified tune with a strong melody. My approach was to create three seperate automata to control different aspects of the music. One controls the rhythm of the song by selecting the timing of each note (quarter, eighth, etc). The other two control the notes that are played: one selects a chord from a pre-defined set, and the other selects which notes from the chord are activated.

Here's a sample! This video uses a few chords selected from the Star Wars theme to generate a tune.

An executable and the full C++ source are available on my code page. Future plans for the project may include replacing the chord-selection mechanism with a Markov chain to make it more musically coherent, and implementing samples and ADSR so the notes can be things other than sine and square waves.