Nate Sommer's Senior Seminar Journal, Fall 2003
Sunday, November 30
Now the dumb perl script is finally working decently.
Friday, November 28
Over the past week I have been working on the perl wrapper/input file parser and playing around with different Markov chains. The perl wrapper now takes files in the following format:

    headers
<first ABC header>
...
<last ABC header>
end

chords
<first chord's name> <first chord's ABC notation>
...
<last chord's name> <last chord's ABC notation>
end

states: <number of states>
start: <list of [chord(state) probability]'s>
<first row title>: <list of [chord(state) probability]'s>
...
<last row title>: <list of [chord(state) probability]'s>
end


Chord names may consist of any alphanumeric symbols. Probabilities are integers from 1 to 100. The probabilities must add up to 100 on each line, or the program will complain and abort. Lines containing only whitespace and lines starting with # are ignored. There need not be a line for every chord at every state, but they have to be in order; the rows of the same state need to all be together, in order according to the order in which the chords were defined.
Saturday, November 8
I am pleased to say I am now generating chord progressions. I wrote a program that takes as input a file which starts with a number, indicating how many chords are to be in the progression, followed by 7x7 tables of probabilities (one less than the total number of chords). Here is an example file that implements the following general rule:

I is followed by IV or V, sometimes vi, less often ii or iii.
ii is followed by V, sometimes IV or vi, less often I or iii.
iii is followed by vi, sometimes IV, less often I, ii or V.
IV is followed by V, sometimes I or ii, less often iii or vi.
V is followed by I, sometimes IV or vi, less often ii or iii.
vi is followed by ii or V, sometimes iii or IV, less often I.
vii is followed by iii, sometimes I.

Here is my program as it stands currently: chord.cpp. At first I went about this by having a function for each chord, and each function would figure out which chord came next based on a class of attributes that was passed to each function in turn. It was silly to have that many functions that only differed by a few characters each, so I condensed it into a function that called itself recursively. This also seemed silly after I did it, so now the generation is implemented iteratively, which makes the code considerably smaller and more general. Currently it only generates I, ii, iii, IV, V, vi, and vii chords and writes them in half notes to an ABC file in the key of C, at a tempo of 110 beats per minute. The program then uses abc2midi to write a MIDI file. Here's an example ABC file generated by my program, and the resulting MIDI: chord.abc chord1.mid

The next step is to make the program even more general, so that it will generate chords specified in the input file, instead of hard coded chords in the program.
Tuesday, October 21
In order to analyze some phrases, I came up with a simple notation scheme. Each note is represented by its letter, followed by an 's' or an 'l' if its sharp or flat respectively. The note is followed by a '+' if it's an octave or higher above middle C, and a '-' if it's in the octave below middle C. The note is followed by its duration, represented by an integer. 1 represents a whole note, 2 a half note, 4 a quarter note, etc. The key is defined at the top of the file, and follows the word "key". A '^' comes after the key if it is minor. Here's part of a phrase from Dvorak's Slavonic Dances:

key fs^
cs 8
a 8
gs 8
fs 8
es 8
cs 8
b- 4

This phrase (or half a phrase, really) looks like so on a staff:

I also wrote a program that takes a file in the above notation and populates three parallel arrays; one with the notes in semitones from middle C, one with the notes in semitones from the root of the key, and one with the durations. Right now it just outputs the key followed by the data for each note on a line:

key: fs minor
1 -5 8
9 3 8
8 2 8
6 0 8
5 -1 8
1 -5 8
-1 -7 4

Next I plan to extend the program to generate some statistics about the intervals between notes and other patterns.
Monday, October 20
Last night I wrote a simple program in perl (found here) that generates runs within an octave that start at the root of the key and end up an octave higher using a simple grammar.
Monday, October 13
Now that the survey's done, it's time to start writing some software that actually composes music. Last night I sat down to try something out, and realized I should probably learn how to write MIDI files, so I can actually hear what is being composed, even if it is on a crappy soundcard synth. So I poked around online for some time, and found some things about standard MIDI files, but none of them had any good examples. This afternoon I'm going to pick up a few books from Lilly; one on MIDI and another called Music and the Macintosh, since I'll probably be using the Mac in the little electronic music lab in Runyan.
Wednesday, September 24
Nate Chu and I made a second trip to Oxford today to actually check out some books. I did some reading while there and narrowed my selections down to 7. This is a pretty exciting thing to be getting into because, as many authors of the authors point out, the possibilities are endless.
Wednesday, September 17
It's alive!
Course website