Generative Music Tool WIP

Posted by
September 11th, 2012 7:11 am

When I started to develop games, I didn’t know anything about music or how to compose a song. For my first two games I hired a composer for the music and the result was very good.

Unfortunately, you know how it is, you have to start over every time you develop a new game and buy more music. This was unacceptable for me so I thought it would be easy just to “teach” the computer some music theory and then let it compose the music in real-time instead.

I found out the hard way that this is much more difficult than it sounds. But after tons of prototypes and music theory studies, I have finally produced something that sounds reasonably good.

Generative music module output playlist

This will be turned into a tool of some sort but I don’t know the exact form.
I would love to see this tool to be used in future LDs :)

36 Responses to “Generative Music Tool WIP”

  1. Bemmu says:

    This sounds way better than I expected!

  2. Madball says:

    Variety of tunes is amazing. 2nd one is my favorite! (thought I didn’t listen to the last ones)

  3. Martok says:

    That, my dear Sir, is amazing!

    Fun thing is, I started working on something similar (even though for now entirely manual…) after LD, but apparently a gazillion of nested loops does not perform well. Who’d have thought!

    What kind of instruments are you using? MIDI, Samplebased, Synth?

    • Per says:


      It is extremely rewarding to compose music this way for a programmer, so I can only recommend you to keep creating those loops 😉

      The audio is just good old fashioned MIDI that is rendered with a soundfont and then post-processed.

  4. kddekadenz says:

    Why didn’t you post the download link here? I found it on your website:
    Works fine, just rendered a song.

    • Per says:

      It’s not the same generator. The RML editor is a finished, free tool that you can use but it is just one of the “tons of prototypes” that I have constructed.

      The source is also available for it, but it can’t really compete with this new system when it comes to voice leading, figuration, harmony etc. It is pretty fun to fool around with though, but the GUI is terrible :)

  5. goerp says:

    Ha, sounds very very good. Ludum dare is full of things that worked on but better, which is a bit daunting but also inspirational. This is certainly inspirational and if I don’t succeed with my own version I would be glad if I could use your product. Keep us posted!

  6. Codexus says:

    This sure sounds a lot better than anything I can compose myself… how depressing is that?

  7. Mastry says:

    That sounds fantastic. Do you plan on making this available for others?

  8. Cake&Code says:

    That’s pretty incredible, I think it’s way better than Wolfram’s attempt with Tones (

    It sounds like the program can generate very rich and full songs with good progression and everything… kudos to you. Many, many kudos.

  9. goerp says:

    Wolfram uses mathematics. This is made by a human ear who makes choices what is good and what is not.

    • Per says:

      That is partly true. I selected these 10 songs out of 60 generated ones. Also, during the development I listened to a lot of the generated songs and made corrections that “fixed” the problems. Still, most of the problems could be solved by just reading some more music theory (voice leading and harmony) and implement a solution. I did not make small tweaks for each song. All songs in the video have been generated from a single seed.

  10. axcho says:

    That is so awesome. Could this be the sfxr of music? 😀

    Are you going to release the source code? I bet it would be fun to play with…

  11. csanyk says:

    I’ve been interested in finding a tool like this forever. Can’t wait til you release it and I can play with it firsthand.

  12. sfernald says:

    Could you show a demo of you using the tool to create a song and then play that song in the video?

  13. S0larCode says:

    WOW! This is truly amazing. I’d really love to see this tool be downloadable soon, because I generally struggle to write music for my games.

  14. Khayet says:

    This is amazing! I love the variety of the songs, can’t wait to use it!

  15. johnfn says:

    As a composer myself, I’m not sure why everyone is scared of learning how to compose music. Remember learning how to program? It’s a lot like that, and it’s really a lot of fun!

    That being said, the music that your program composed is really impressive. Keep up the good work!

  16. Maple says:

    This is amazing. It would be very nice, though, if users were able to import their own sounds as instruments.

  17. Awesome says:

    I’ve been intending to write a similar program for myself for the last three years, but life has been getting in the way. Your videos are really slick, and the music is great. I am impressed that you have constructed this tool on your own, despite life, and that you are considering sharing it with the rest of the indie development community.

    Major props.

    I dub this [Certified AWESOME]!

  18. mohammad says:

    Dude, you are the BEST programmer in the world.
    Next thing you will have 20 macs to do an orcestra and 2 windows to be conductors. (Windows playing computers? Pfft!)
    Dude, YOU should sell this for millions. A musical constructer.
    Just think, we are all idiots compared to you.

  19. Fantastic! Great solution to not being able to write music 😛

    I could never program something like this though, for me it’s easier just to write it based on my own Music Theory knowledge 😀

  20. Scott Baker says:

    Bump… just wondering what happened to this project and if you were still working on it.

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]