I just completed Melodique, a web app to procedurally generate melodic phrases. The tool randomly selects chords from a specified scale and then voices them using simple melodic patterns. There are many options the user can tweak to customize the process. The notes generated are displayed on a piano roll view rendered using the HTML5 canvas, and sound output can be produced using the Web Audio API (currently supported by Chrome only, but Safari should follow shortly). I coded my own simple virtual analog synthesizer to produce the synthesized piano sounds.

Programming this tool was a way for me to learn and experiment with music theory. One of the things I’ve been curious about was how I could go about randomly generating patterns that have a fairly high chance of sounding musical. The techniques used by Melodique are quite simple, chords are selected from a scale, and the choice of chords is biased more heavily towards degrees I, IV, V and vi. This is nothing revolutionary, but the tool may be useful for those learning about music theory, or simply looking for melody ideas (you can very rapidly generate and listen to many variations).

You can try Melodique at the following address:

http://www.cs.mcgill.ca/~mcheva/melodique/main.html

I plan to continue experimenting with music. My next goal is to try using Markov chains or a probabilistic state machine of some sort to generate electronic music. I may also try using stochastic techniques to generate interesting sounding synthesizer patches. To be continued!