Some computer generated melodies…

Here are five melodies my computer program wrote today, all in one MP3 file:

Examples of computer generated melodies

A few things to note:

1. The program is still working within limitations of only being able to compose in C major, only being able to use the basic triads, only being able to compose 8-bar melodies in 4/4 time. I will, of course, work to remove those limitations, but there is still more work to do on the algorithm first.

2. As you can hear, some of the melodies don’t sound that great. I think they technically work (they don’t sound like random atonal garbage), but they’re not quite memorable. I really like the first one though, and the second and third one have some interesting parts. Anyway, my goal with the program isn’t to get it to output something beautiful every single time; the point is to give the user melodic ideas. As the algorithm is now working pretty fast, the user should be able to have the program generate 100 or so melodies at a time, then he can browse through the results and find whatever strikes his fancy.

3. The five melodies in that MP3 are based on melodic knowledge the program learned from just two melodies. So if they sound kinda similar now and then, that’s why. But still, it amazes me how much musical variety can emerge from such a small set of knowledge. I look forward to building the program’s knowledge database; I can’t wait to see what sort of stuff it might produce with knowledge from several hundred melodies or so.

Melody project: the great reprogramming – update 3

I haven’t gotten much done today because I slept all day because I was up late reading because I have library books that are due soon because they are on hold and I can’t renew them and I want to finish them or at least get as far as I can in them before I have to return them because that’s just the way it is, OK?

Anyway, regarding the melody project… I have created a small set of symbolic knowledge with which to experiment with. I am now continuing to work on reprogramming and restructuring the main melody composition algorithm to make use of the knowledge in its new form. That’s pretty much it. An in-depth look at my meaning of this is strictly confidential.

Thank you for reading update #3. I will keep the blog informed of any and all progress made on this revolutionary product.

Melody project: the great reprogramming – update 2

Yesterday I successfully designed, programmed, and tested a melodic information symbology, making melodic information easier to input. This should also save the program time and memory, as it will only have to decode the string of symbols if and when it needs them, and when it no longer needs them it can delete them again. The only caveat is that the symbol strings themselves are always held in memory. I’ll leave it like that for now; if I have memory problems in the future, this issue may need more attention.

My goals now are to use this symbology to create a set of knowledge for the program’s knowledge base for further algorithmic reprogramming, restructuring, and testing. An in-depth look at my meaning of this is strictly confidential.

Thank you for reading update #2. I will keep the blog informed of any and all progress made on this revolutionary product.

Melody project: the great reprogramming – update 1

I’m working on reprogramming my melody generator from scratch in an attempt to make it more organized and more efficient. A higher degree of modulation should also make the programming of future feature additions easier. My overall goals are as follows:

1 – Reprogram the algorithm and get it output easier-to-interpret text
2 – Get the program to output MIDI files
3 – Begin adding other features

For now, work continues on goal #1. I’m trying to program a symbology, so that the program can store a bunch of melodic information in the form of encoded strings. It can then decode these strings when and if it needs to. This is in an attempt to save both time and memory, and to make adding future features much easier for the programmer. An in-depth look at my meaning of this is strictly confidential.

Thank you for reading update #1. I will keep the blog informed of any and all progress made on this revolutionary product.

Melody generator update…

My obsession with programming an automatic melody generator (that actually gives good results, unlike just about every other melody generator out there) continues. Again, the program works by analyzing existing melodies and “learning” from them. In my 2008 version, the program analyzed the given melodies while it composed new ones from them. Now the program stores its “knowledge” so it doesn’t have to analyze a melody more than once. Of course, there’s still the problem of getting the program to find the right sort of knowledge and to use it appropriately. But what I have is coming up with some interesting results. I’ll post more later, but here’s one melody the program wrote early this morning: MelodyExperiment2.mid (melody stated and repeated ad nauseam in pizzicato… the output of the program just gives chords and melody numbers; the tempo, the instrument choice, and alberti bass were added by me)

EDIT: By the way, obviously some of the melodies it outputs sound much worse than that. That’s one of the better ones…

Unfortunately there are still a lot of limits in the program that need to be dealt with:

1. It can still only compose an 8-bar melody in 4/4 time. I need to give it a wider range of time signatures (3/4, 2/4, and 6/8 at the very least), and I need to let it be able to compose 16 and 32 bar melodies, and “extended” melodies, such as a 10-bar melody which is really just an 8-bar melody that takes two extra bars to resolve. Ideally the user could choose the bar length and time signature.

2. It can only compose in C major. That might seem trivial; can’t the program just transpose the melody up and down afterward generating it? Unfortunately that can lead to notes that are way too high or way too low. To keep the melody within a certain range, we’ll have to deal with this.

3. It can only compose diatonic melodies. It can not yet shift into other keys or limit itself to a certain scale. Fortunately I don’t think this would be very hard functionality to add; it’s just a matter of giving the program more options, and making sure it uses them appropriately.

4. It can only compose within a certain range of notes. Which is fine, but ideally the user could decide what range is allowed, and what interval leaps are allowed.

5. There are limits on chord progressions. It must always start and end with the I chord. This makes it sound nice and complete, but it should have the ability to start on a different chord or something. It also sometimes comes up with some pretty odd chord progressions that are technically fine, but just odd. It would be interesting to program an “inventive” variable, telling the program how much it should do whatever it wants with the chord progression (within reason), and how much it should adhere to what it “knows.” Also, it currently only recognizes the main triads; it ignores major 7ths, major 9ths, sustains, etc. I’m not sure that matters much; a listener could always change that himself if he wants to use the melody for something, so if I do add that feature, it will probably be the last thing I concern myself with.

And then matters of practicality:

6. It outputs numbers in a text file which then have to be laboriously converted manually into a MIDI file, which takes too long. It should be able to output a MIDI file (or files) by itself, or at least a much easier to read text file.

7. It’s programmed in Java. To get it to work on the Internet (if that’s what I decide I want), it will probably have to be converted to PHP, and we better make sure it’s not too computationally heavy for that. (I don’t think it would be.)

That’s all! Enjoy that beautiful melody! Look out for more!

Java programming blather

I spent the day doing some more Java programming on my melody project. I’m attempting to add some new features (with different algorithms) to the program so that it will work with music of any length, and with multiple melodic lines, thus different instruments and the emerging harmonies. But of course to say it is difficult is an understatement. The algorithms work; that is, they run. But they go far too slowly and take up a lot of memory. I think I can fix the memory problem by greatly reducing redundancy with some algorithmic improvements, but I’m still not sure how I can get it to go any faster; the algorithms simply have to do too much calculating. So I’ll probably have to abandon the algorithms altogether and try coming up with new ones. Since the program is going so slow now, I can’t get it to output anything but gibberish, and thus can’t really tweak the current algorithms to improve them. Anyway, if I can ever get it to work and create musical output that actually sounds musical, the musical mixing possibilities would be pretty cool. It’s just too bad computers aren’t faster and don’t have more memory; I could sure use it.

If I do get my musical-mixer-generator thing to work as well as I do in my daydreams, I can’t quite decide what I’ll do with it. Part of me would like to sell it and make $$$ off of it, but another part of me is quite tempted to keep the software a secret and use it to create hundreds of thousands of musical pieces under a pseudonym and not tell anybody my secret power. Both possibilities are still distant daydreams, of course, but I guess I’d probably sell it, since that seems more honest, and would probably result in a lot more $$$. But the other choice remains a temptation, and if I choose that road, I won’t blog about it, bwahahahaha!!

A happy Wednesday to you

And now, 23 more days until Christmas…

I worked a little more on my Android game; I created a poorly animated bouncing head to represent the player, which bounces in whatever direction you move him. Unfortunately his directional movement is a bit jittery; I need to figure out how to update his position on every frame, but not when a frame isn’t being rendered. And then I have a bunch of other work to do on him. (If I ever actually finish programming the game, I might look into hiring a pro artist to do the art for it… but for now the game can look visually awful.)

I also added a “readers” counter on the side of this blog; you can see it over there below the subscribe buttons. So if you’re ever feeling low on self-esteem, maybe taking a look at my low reader count will give you a boost (but then reading the blog and realizing what a genius I am in all that I do might lower it again).

The only other thing I’ve done worthy of note (but not really) besides going to work is to watch my new Dr. Strangelove blu-ray last night. Quite a funny film, and it looks great on blu-ray. Blu-rays are the way to watch movies. DVDs are losers. (Except for TV seasons, because blu-rays currently cost too much for those.) I will say, though, Stanley Kubrick’s sudden endings are kind of annoying. You really get into the ending scene and then BOOM it’s over. No closure. No goodbyes. Just BOOM. The end.

For my blog, I would never–

Game programming and so on and whatnot

GAME PROGRAMMING

It feels nice to be diving into game programming again.  I’d forgotten how engaging it can be.  Right now, however, I’m doing more graphics programming than game programming.  I’m experimenting with OpenGL on Google’s Android operating system, trying to get a feel for how it all works.  I hope to create a little adventure game with it.  Or an action game.  Or a mix.  I’m not really sure yet.  Recently, I’ve just finished programming a tile-based scrolling map, which was quite a challenge itself.

Anyway, there are not yet many resources out there for programming games for Android.  But there are a few.  I bought a book called Pro Android last week from Amazon and it just recently arrived and has already been of some help.  I’ve also been reading through Chris Pruett’s Replica Island game development blog, which not only has some info on programming for Android, but has some fantastic wisdom on game development in general.

THE ACCORD REVIEW

The Accord In other news, I finished reading the sci-fi book The Accord by Keith Brooke a few days ago.  (I just picked it randomly off the library shelf one day.)  It was a strange book, and overall pretty bad.  It’s filled with awful language, and it’s used so often that it loses all affect and becomes somewhat comic.  The tenses shift from scene to scene, and the POV shifts from first to second to plural first depending on the character or mix of characters in the scene.  The last third of the book is told over the span of thousands of years, so characters forget who they originally were and what they used to want, which makes it quite hard to keep relating to them.  And some characters mix with other characters to become new characters.  With such ideas, it had the potential to be a really awesome story, but unfortunately it was just a lame love-triangle tale, with this character bent on getting this character to love him, and this character bent on killing this guy, and this character forgetting who she is… it drags on too long.  And the ending… maybe I should have read the ending (or endings) more carefully, because I found it (or them) to be somewhat cryptic; I’m not quite sure what happened.  It certainly wasn’t climactic though.

That was the 9th book I’ve finished reading this year, and only the 2nd fiction book.  I seem to read an average of 10 books a year.  Which I suppose isn’t too bad, but also very bad, depending on who I am compared to.  Obviously I’ll never make it as a writer.  Although, that’s only counting books, not book fragments, short stories, articles, magazines, etc.  So I’m probably OK.  Although my want-to read-list is at around 50.

READING AUDIO BOOKS?

There seems to be some debate on these here interwebs as to whether or not one can validly say that they “read” audio books.  The answer is:

No, you do not “read” audio books.  Don’t flatter yourself.

The problem is that, when asked “How many books did you read?” or “Have you read such-and-such?” you can either answer “No, I listened to them” or simply “Yes.”  If you say yes, you are lying, but it’s an OK lie because nobody cares.  It does not make “reading” and “listening” equivalent.

DOLLHOUSE AND OTHER SUCH TV BLATHER

Dr. House doll! Fox cancelled Dollhouse last week, which is very sad.  It wasn’t as good as Firefly, and it’s not as good as House, but it was a very fun sci-fi show.  I am wondering if they will wrap up the storylines in the final episodes or if it’s too late and now and the storylines are doomed to never be resolved.  Earlier this year, there was another fun show called My Own Worst Enemy.  I thought that had a really fun premise, but that was cancelled and the storylines were left unresolved.  The problem with series in which each episode builds on the last is that when they are cancelled you’ve got these big over-arching stories that never complete, making the remaining of the series a bit sour.  It’s like making two movies in a trilogy.  Who would want to watch or buy them?  I don’t feel like watching any Dollhouse or buying the seasons on blu-ray if the storylines are just going to remain unresolved.  At least with Firefly they were able to make the film Serenity, which did provide at least a little closure, but it’s highly doubtful they’ll do that with Dollhouse.  Now when is some more Dr. Horrible stuff supposed to come out?

The other shows I’m watching (on Hulu, mostly) are Monk (3 more episodes of the series left, hopefully Monk will soon solve his wife’s murder), House (best show on right now, or at least tied with Monk), Lie to Me, and Fringe.  And sometimes a bit of The Simpsons and Family Guy.  Oh, and Shark Tank… awesome reality show.  I can’t wait for the next season.  I was enjoying How’d You Get So Rich, a show in which Joan Rivers went around touring rich people’s mansions and lavish lifestyles, but that show got cancelled, perhaps because Joan’s face fell off.  I also have the show Legend of the Seeker on my wish-list… it airs on some bizarre channel at a bizarre hour, and I couldn’t keep up with it on Hulu, so I’d like to buy it on blu-ray or DVD (I watched the first few episodes on Hulu to know I’d like to see the rest of the season, even though it’s a bit cheesy at times… but so was the book).  Oh, I’ve also been watching Flash Forward on Hulu.  That show started out slow, but it’s getting interesting (or at least they’re putting in some comic relief in now).  Also been watching V (The Visitors), which has still been a bit stale so far, but it’s one of the only shows that comes on when I’m not at work.  Hmmm… I guess I watch too much.

OK, I think that’s enough blather, eh?

No NaNo and other stuff instead

I guess NaNoWriMo has officially started!  And … I don’t care.  I’ve once again changed my mind, and will probably not participate this year.  I have a bunch of other stuff I want to do, including finishing my album that I’ve been working on for over a year now.  I’m still about 10 minutes of music away from completing the thing.  I’m currently working on the last section of an unnamed orchestral piece.  I’m orchestrating / composing the climax and end, so it’s almost done.  Then I have four other pieces started that need finishing, though I don’t believe all of them will make it onto the album.  One will probably be called “The Journey Ahead” and I am fairly sure that it will indeed appear on the album as I think it really fits with the spirit of the other pieces.  And one will probably be called “Castle Sky” … that’s my long 15-minute orchestral piece (and still unfinished, but I don’t think it will be much longer).

Oh, I started a new project, one that I know I’ll finish eventually because it requires hardly any work at all from me.  I call it: The Mozart Listening Project.  The objective: to listen to the complete works of Mozart while following along with the scores.  As you can see on the side, I made a page about it.  Because it is just so important.  I just started working through his symphonies.  Got a long way to go.

Android Lastly, I was chatting on a music forum on Friday, and someone mentioned the new Verizon phone coming out called Droid, which will compete with the iPhone (though, of course, that’s some very tough competition).  Looking at the Droid rekindled my interest in creating an app.  It was something I looked into in college, when Google’s Android OS first came out, but somehow lost interest.  (And as far as I can tell, one must have a Mac to use the iPhone SDK, so I don’t think I’ll be trying to develop for the iPhone anytime soon … though, from a business perspective, that’s currently where most of the phone app market is, methinks.)

Anyway, I’m downloading the newest Android SDK and will perhaps try creating something with it.  Having long been interested in game development, two things excite me about the phone app market: 1) It’s rather new, and is still at a stage where a single developer can develop a sellable app by himself.  In most of the video game industry (except perhaps online Flash games), those days are long gone, never to return.  And perhaps one day the phone app industry will be like that too, but it isn’t now.  And 2) it can be very lucrative.  Actually, I’m not sure how lucrative it is.  I’ve heard that some iPhone apps are making millions.  But that’s only a very select few out of tens of thousands, so I suppose it’s like saying that the music industry can be very lucrative.  Well, yes, it can be, but only few a very select few.  Still, I’m guessing the phone app industry is more lucrative than the indie artist industry.  Unfortunately, I’m sure it’s even less lucrative for non-iPhone developers at this time, but who know?  With Google’s more open platform, Android or some similar OS might come to dominate the phone industry, just like Windows now dominate Macs, despite Apple’s oh-so-witty ads.  In fact, I predict that will happen in the next decade or so … Apple may still dominate the iTunes / iPod industry, but the iPhone might meet its demise with a collection of other phones that run the same OS and are thus compatible with the same programs…

And… I guess that’s all I have to say.

Blagh … and java programming

I’m tired.  My sleep schedule is just terrible.  That holiday weekend wasn’t good for me.

I don’t have much to say right now anyway.  I’m not sure I’ll have my first album ready by August anymore; my interests have once again shifted to something else.  Over the past week, I’ve been working on my melody project again, something I started quite a few months ago (August 2008), but it’s just been sitting there for a while.  I made some minor improvements to the algorithm (to be more specific, I took the recursive inverse directional beta loops and strongly conjoined them with the dysfunctional relative note sequence data curves coupled with reticulating splines, and programmed in the consciousness of a monkey. (More seriously, I changed the algorithm so that the output melody would be guaranteed to not be any of the input melodies, which had been a threat in the previous version if you were mixing only a few melodies that didn’t sound very much alike.  With the modified algorithm, the program forces the melodies you’re using to mix.  Overall, I think it gives better results, but it depends on the melodies you input and how similar they already sound (and your own melodic tastes, of course).)), and I also made this spiffy javascript page which aids in the formatting of the text files the program uses as input.

What I’d like to do this summer is release the melody project in it’s current form so that others can fool around with it.  I’m hoping to turn it into a Java applet that will run on a web page.  It shouldn’t be too hard; it’s already Java after all.  I mainly need to program a good input-output system, since it can’t so easily load and save text files from a visitor’s computer, since it will be on a web page.  I can load the text files from my server easily enough, then I suppose the output could just be text in a text box.  That would be the easiest, and will probably be what I end up doing to start off with.  But that is a pretty annoying burden for the site visitors; they’ll have to interpret the output text by themselves (it’s not really hard, it’s just extra labor).  So I’ll have to program a text-to-MIDI converter so visitors can easily and quickly hear what the output melodies sound like.  And then there are a thousand other improvements I could blather on and on about, but those are my first ambitions.

So that’s what I’ve been working on…

Oh, and remember to vote for a note!  (That whole experiment is going to take forever…)