Ramid.py

page version 0.8
 
ramid.py is a Python program that composes melodies using a "pyramid" method (explained below). Here are five tunes picked from its output so far:

first_nice_tunes.mp3 (852K)

(The timing and dynamics are composed by the program and played by a MIDI player.)

I wrote ramid.py during the Music Hackday Boston weekend, Nov. 21-22, 2009. Thanks to the organizers, sponsers, and all the inspiring hackers and their hacks!

Ramid.py is based on the ideas in PyraQuant, an earlier C program of mine. Here (381K) is a sample Vince-Guaraldi-like song from that program.

Pyramid Music

The program builds melodies out of notes grouped in phrases that are varied, reused and grouped into larger and larger phrases. The "pyramid" refers to the fact that the number of random numbers used at each level is proportional to the distance from the top of the tree, which creates the style of phrase-sharing used.

Other note expression parameters like dynamics, staccato/legato, tempo variations, and (in PyraQuant) synthesizer filter parameters, are generated by the same process with the same phrase-sharing structure as the melody.

There is also a keen feature in PyraQuant and ramid.py v0.7 and up whereby the melody is a compromise between a chromatic melody and a circle-of-fifths sequence, giving something like a scale and chord changes.

These ideas as well as more about "pink" or "1/f" fractal music in general, are discussed in more detail on the PyraQuant page. Ramid.py, besides being written more cleanly in a more suitable language, has a couple tricks new since PyraQuant. It varies the tempo, and it sometimes builds phrases out of groups of three instead of always two. The RAndom MIDi pun is accidental.

Ramid.py uses the pythonmidi library. Thanks to Max M.

Source code and longer examples

Here are some extended MIDI outputs, paired with the versions of the source that produced them.

v0.8: music, code

v0.7: music, code

v0.5: music, code

The five individual tunes from "first nice tunes" (The "see..." in the file names refers to cue points where the songs were found within larger MIDI files.):

01_ramid_see_15_48.mp3 (285K)
02_ramid6_see_5_33.mp3 (181K)
03_ramid6_see_4_06.mp3 (186K)
04_ramid9_see_13_06.mp3 (123K)
05_ramid7_20_34.mp3 (96K)

All five combined in one mp3 file: first_nice_tunes.mp3 (852K)

--Steve Witham
Up to my home page.