Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Procedural music generation techniques [closed]

People also ask

What is automatic music generation?

Automatic Music Generation is a process where a system composes short pieces of music using different parameters like pitch interval, notes, chords, tempo, etc.


The most successful system will likely combine several techniques. I doubt you'll find one technique that works well for melody, harmony, rhythm and bass sequence generation across all genres of music.

Markov chains, for instance, are well suited for melodic and harmonic sequence generation. This method requires analysis of existing songs to build the chain transition probabilities. The real beauty of Markov chains is that the states can be whatever you want.

  • For melody generation, try key-relative note numbers (e.g. if the key is C minor, C would be 0, D would be 1, D# would be 2 and so on)
  • For harmony generation, try a combination of key-relative note numbers for the root of the chord, the type of the chord (major, minor, diminished, augmented, etc.) and the inversion of the chord (root, first or second)

Neural networks are well suited to time series prediction (forecasting), which means they're equally suited to 'predicting' a musical sequence when trained against existing popular melodies/harmonies. The end result will be similar to that of the Markov chain approach. I can't think of any benefit over the Markov chain approach other than reducing the memory footprint.

In addition to pitch you will need duration to determine the rhythm of the generated notes or chords. You can choose to incorporate this information into the Markov chain states or neural network outputs, or you can generate it separately and combine the independent pitch and duration sequences.

Genetic algorithms can be used to evolve rhythm sections. A simple model could use a binary chromosome in which the first 32 bits represent the pattern of a kick drum, the second 32 bits a snare, the third 32 bits a closed hi hat and so on. The downside in this case is that they require continuous human feedback to assess the fitness of the newly evolved patterns.

An expert system can be used to verify sequences generated by the other techniques. The knowledge base for such a validation system can probably be lifted from any good music theory book or website. Try Ricci Adams' musictheory.net.


Cellular Automata - read.

You can also try it out here.

Edit:

rakkarage has supplied another resource: http://www.ibm.com/developerworks/java/library/j-camusic/


There are over 50 years of research into these techniques, often overlooked by developers not familiar with the history of computer music and algorithmic composition. Numerous examples of systems and research that address these issues can be found here:

http://www.algorithmic.net


An easy and somewhat effective algorithm is to use 1/f noise aka "pink noise" to select durations and notes from a scale. This sounds sort of like music and can be a good starting point.

A better algorithm is to use "markov chains".. scan some example music and build a table of probabilities. In the simplest case, it would be something like C is 20% likely to follow A. To make this better, look at the sequence of the past few notes, for example "C A B" is 15% likely to be followed by B, and 4% likely to be followed by a Bb, etc. Then, just pick notes using the probabilities of the previously chosen notes. This remarkably simple algorithm generates pretty good results.

Markov chains for music generation


Dmitri Tymoczko has some interesting ideas and examples here :

http://music.princeton.edu/~dmitri/whatmakesmusicsoundgood.html


My software uses applied evolutionary theory to "grow" music. The process is similar to Richard Dawkins' The Blind Watchmaker program - MusiGenesis adds musical elements randomly, and then the user decides whether or not to keep each added element. The idea is to just keep what you like and ditch whatever doesn't sound right, and you don't have to have any musical training to use it.

The interface blows, but it's old - sue me.


I have always liked the old Lucasarts games that used the iMuse system, which produced a never-ending, reactive soundtrack for the game and was very musical (because most of it was still created by a composer). You can find the specs (including the patent) here: http://en.wikipedia.org/wiki/IMUSE

Nintendo seems to be the only company to still use an approach similar to iMuse to create or influence the music on the fly.

Unless your project is very experimental, I would not abandon the use of a composer - a real human composer will produce much more musical and listenable results than an algorythm.

Compare it to writing a poem: You can easily generate nonsene poems which sound very avant-garde, but to replicate shakespeare with an algorythm is difficult, to put it mildly.