Tuesday, February 20, 2007

Statistical Linguistics + Music

A class I'm taking this semester on computational linguistics, which is a continuation of the one I took last semester, is covering statistical analysis of linguistics. The subject covers everything from calculating how often specific words occur by simply counting them and dividing by the total number of words, to automatically grouping words by grammatical class and determining simple rules of grammar, to determining the author of unknown works by comparing them to samples of works by known authors. It's not what I thought the field would be when I started taking the course, but it's extremely interesting (to me, at least.) I've been wondering what else you could do with this, and then it hit me.

What if, instead of words, letters, or sounds, you used musical notes. You could create, more or less, the same type of analysis for music as you can for language. Some applications could be interesting, like determining the composer of unknown works, but the same tools that allow you to describe language, or in this case music, allow you to go the other way: you can create random variations based on what you've seen and analyzed. I tried this a while ago with my blog, and while a lot of the text it produced is garbage (you need a ton of sample text to get consistently good English, and my blog isn't that large), there were a few gems. Like "Tim can confiscate your property if he wants to." I'm looking into what's necessary to do this with music. I have a ton of Scott Joplin sheet music that I could run the analysis on, create a model, then generate novel music from. Chances are a lot of it will be crap, but with a basic understanding of music theory I could add some assumptions on how music is structured that could improve the results.

The only thing holding me back is that, while I really want to do this, I would have to translate all the sheet music into something a program could understand, which will involve a ton of typing. I could also do it on waveforms taken from MP3s on my computer, but that'll add an extra layer to the problem: figuring out the notes from the sound, which seems trivial but is actually fairly hard, especially with all the distortion used in a lot of my music. Maybe if I stick around another 4 years after I get my linguistics degree and get a music degree it'll all come together.

If I pull my act together and do this, I'll post some MP3s. Just don't hold your breath.