A program for composing music


I want to write about the program I'm working on for creating music, in case anyone wants to give feedback. If there's any interest I might port this to a Flash app to reach a wider audience. At the moment it's only for Linux.

So here we go.

At the moment it plays 1 instrument, the piano, but this can be extended.

Each line is 3 values: Pitch Duration Skip

The Pitch is the pitch of the note played, the duration is how long the note is held down and the skip is like the cursor on the keyboard to indicate where the next note will start relative to the current one. If the skip value is the same as the duration then the current note is played in full and then the next note is played. If the skip is less than the duration then two or more notes will be played simultaneously.

There's two ways to input the pitch, as absolute by starting the line with a z or as relative, without the z.

I think that's all there is at the moment so let's see an example. Here is the start of the song Fallin' by Alicia Keys.

z 74 4 4
-5 4 4
-7 4 4
-5 4 4
-7 3 6
-3 14 14
-5 2 2
-7 1 1
-5 2 2
-7 2 2
z 64 2 2
-2 3 3
3 4 5
0 22 25
-2 14 14
-2 4 4
0 20 23
3 4 4
0 4 4
3 16 19

The song starts at pitch 74 for duration 4 then goes down 5 to pitch 69 and so on. The line -7 3 6 means that the note 7 down from the last is played for a time of 3 and then there is silence for a time of 3.

A neat thing to do is to represent this as graph form. I prefer to use two graphs, one for the pitch and one for the duration.

The first graph is the pitch graph, it starts at 0 which is z 74 and everything after that is the relative values, just like in the text. The second graph is the duration graph and the first four values are 4, just like in the text. The vertical dashed lines indicate that there is a silence (when the skip value is higher than the duration).

And finally here is an mp3 of the result generated by the program:

Let me know what you think at https://twitter.com/Mixailovich. Would you like to use this language for composing music. Why or why not?