Monday, March 07, 2011

Music Generation Thoughts Part 1

I've been working on a simple artificial intelligence to generate music. I use my own software for music and this has lots of advantages (beyond cost, which was the original motivation for programming it!)

My original idea was based on frequency analysis, that is of notes as in letter-frequency analysis, not of the frequencies of sound waves. The aim is to analyse existing music and produce original music based on it using probabilities. This is quite complex though.

Music has several components, pacing and timing as well as melody, chords which go with the melody, counterpoint, and lots of repetition. A tune is more creative at the start, with the initial idea or theme often being repeated later, so any artificially intelligent composer must mimic these features. I decided to give the tables self-feedback which should help with this. Music is surprisingly repetitive when analysed, but it can also vary in key, which could confuse the computer. To a human, the notes might even sound the same, although in a different key. As music is designed for humans, there are also issued of boredom, if the same features repeat too often.

Also creativity can back-feed. I write music forward to back, I guess most composers do the same (although I can see that adding bits into other movements, here and there, bits and notes from previous ideas might also work). Soemtimes a change made at the end would add more structure to the piece when some changes are made to the beginning.

The ultimate key to artificial creativity though is analysis of existing forms, self-creation, then self-criticism and analysis, evolution even, until a desirable form is reached. The computer will have to know what is good and bad music.

There are lots of ways to analyse music. Currently I'm looking at timing and have built tables the the frequency of note on the beat, half beat, quarter beat etc. Then there is global patterns, the computer must have some scope beyond the local to see the shape of the whole tune. Then very local patterns, the patterns in repeating themes.

The ultimate goal should be to identify these patterns, and be able to generate and recognise them.

My plans so far are very simple and involve just one voice. More would be a matter of seeing more patterns beyond a single track, and more instruments or volumes would really complicate things!

Anyway, today I've build the basics into my software and added a simple set of analysis tools with the ability to create any number of analysis tables, save and load them, and perform simple calculations on melodies. As the software is essentially my virtual studio I've got no end of tunes to feed it. The ideal would be to feed it some Mozart or something and have it generate an original tune in the same style.

This blog entry is a definite ramble! And like many such rambles partly designed to flesh out my thoughts.

2 comments :

jill said...

I dont understand most of this as I am not a musician or composer but I do like music and it would be great to hear some of yours if you can put it on here. How did the exhibition go. I guess like most creative people you have many strings to your bow if you pardon the pun.

Mark Sheeky said...

My post was definitely a ramble to air my thoughts :) The opening at The Cubby Hole went well, there were about 40 people there, a lot for a small shop. I post music sometimes... try my website here music section for some samples. There's quite a lot there over the years and it can vary!