Stochastic Music Exploration

I made a simple generative music program. It plays randomly generated drum patterns. Original is by Tero Parviainen:

You can create new patterns with the ‘GENERATE’ button. ‘LENGTH’ determines pattern length (4…16) and ‘DENSITY’ (0…100%) affects how many active notes there is. ‘DEVIATIONS’ (0…100%) adds random notes, delays and triplets when playing the pattern and ‘TEMPO’ changes the tempo.


StochasticDrumMachine.bin (58.3 KB)
Source code:


Next iteration of my stochastic music project: Stochastic Christmas Blues.


It utilizes the same idea from the drum machine to play the main instrument. Notes from the blues scale are played over a 12 bar blues chord progression. Great thing about the blues scale is that you can play any note and it always sounds ok, as long as you don’t make too big leaps in the note’s pitch. And of course, to make it christmas music, it has drum pattern with jingle bells.

Here’s short audio sample:

‘LENGTH’ selects the length of the main instrument’s (celesta) pattern between 4, 8, 12 and 16 beats. For example 16 beats is 4 bars so it repeats 3 times during the 12 bars of the song.

With ‘DENSITY’ you can change the fill ratio of the pattern from 0 to 100%.

During playback ‘DEVIATION’ adds randomness to the pattern. With values higher than 0% beats can be randomly played or skipped.

‘TEMPO’ setting goes from 60 to 240 bpm, default is 120.

Bin: StochasticBlues.bin (174.0 KB)
Source code:


Soumds suprisimgly good! Thar could be used as a game music.

1 Like