Programming and melodies


Been a while, huh?  I haven’t been up to much besides programming.  I did compose a wee bit of music for my album, but my programming has been too much of an obsession lately for me to get much else done.  (I’m also way behind on my email, a couple hundred messages still unread.  Of course, most of it is spam or newsletters I don’t care about, but I’m sure there are some people I need to get back to in there too… and a bunch of YouTube comments I want to respond to eventually.)

Anyway, hopefully you won’t mind it if I just blather a bit on what I’ve been working on.  I started out writing a book on melody, though I didn’t get much writing done at all; I mostly just planned out how I was going to analyze melodies.  Then I started writing a computer program that could be fed melody information and spit out an “analysis” of that melody (“analysis” being mostly a collection of statistics).  It was my intention to use these statistics in my book, but then I decided to try reversing the process.  So I made my program take a melodic analysis and create a melody for it.  That in and of itself isn’t special, it just gives you back the original melody you put in.  But if you change that analysis around a bit, based on similarities of other melodic analyses (and some randomness), you get … new melodies!  Or at least melodies that are variations of the original melodies.  In other words, the more similar two melodies are, the easier they will mix.  The more different they are, the more my program will just regurgitate one of them, after having been unable to mix them that well.

That said, I’ve so far only tried a very limited amount of melodies… probably only around ten at this point.  It’s kind of a tedious process because right now the program only takes text files as input and outputs another text file.  So every melody you want the program to use you have to convert into numbers, and then to hear the melody it comes up with, you have to convert numbers back to notes.  It’s an utter pain!

So right now I am trying to make some sort of a GUI (graphical interface).  I’m working with Java, and I know just about nothing about Java’s GUI, or how to program 2D graphics for it.  Sun Microsystem’s website has a lot of resources about it, but no real solid tutorials that I could find; they’re resources are kind of all over the place and I’m having a lot of difficulty figuring out how to do what I want.  So I might go to the bookstore here soon and see if there are any good books on programming 2D graphics with Java.

My eventual ambition is to create something worth selling, so I don’t really have any plans to share the code or the specifics of exactly how the program works yet, though I admit that I definitely do not think it’s something so incredibly complex and amazing that it will change the world of music… still, I think I personally would really enjoy creating melodies with it… if I can make an easy-to-use GUI.  The logic behind how the program works is pretty much all in place though, though there are some areas that could use improvement.  But I really think the program needs to be using more the 10 or so melodies I’ve given it, so I’d really like to have a nice GUI that would make feeding it melodies much easier, faster, and less tedious.

I’ve uploaded some melodies it came up with at:

… some of them sound awful, some of them have pretty good ideas I think, and some sound too much like one of the melodies fed in (especially that Beethoven’s Ninth one).

So, that’s what I’ve been up to!