Computer Composer

This project presents an attempt at automatic composition of melody by parsing midi files to find a probability distribution of the duration and value of notes at a given time.

Midi files (in a major key and 4/4 time) are devided up into 4 measure chunks, in which each note's pitch and duration are recorded into separate histograms. When the computer generates a note, it selects from its recorded histogram corresponding to its location within a 4 measure chunk.

The resulting music, when played raw, is dissonant, but occasionally exhibits some interesting temporal patterns (demo1). However, when we limit the range of the tones to 2 octaves, the music becomes much more pleasant.

To run the code, create a folder of Midi files. Then, in a terminal, run midiToDists.py with the folder name as an argument. This will produce an out.ck, which should be shredded prior to 220AFinal.ck. Finally, shread 220AFinal.ck to produce the music.

Dissonant Bottle Demo

Pleasant StifKarp Demo

Chuck code:

Python Code: