I've been experimenting for years with computer music composition in a rather strict form. I don't just use the computer to assist in manual composition, as someone using Cubase to compose dance music does. I'm seeking to generate music directly from computer progams, without any manual intervention - apart from writing the program of course - without the use of any physical instruments, and without any, or with minimal manual editing. I call this algorithmic composition, because the practice of controlling an instrument and choosing a tune is replaced by the practice of choosing algorithms that I think might generate interesting tunes.
It's a considerable challenge to create anything that sounds even vaguely musical, because computers have no sense of melody, harmony or rhythm and cannot distinguish music from white noise. My input lies in selecting just those algorithms that produce what sounds to me like music: the results vary widely in their success, and will be more or less acceptable to various people depending on their musical tastes and background - in particular how they feel about modernist classical music or free jazz. I enjoy some, though by no means all, of both genres. (It would of course be fairly easy to merely transpose written conventional tunes into my own computer notation and just play them, but that is the exact opposite of what I try to achieve).
Back in 1993 I wrote my own MIDI library in Turbo Pascal that enables me to output playable MIDI files directly from Pascal code. I write a Turbo Pascal program consisting of various loops that set up MIDI tracks with instruments assigned to them, then control the pitch, duration and spacing of successive notes in those tracks - when run the program applies parameters, some random, some selected by me, to compose a new original piece of music, which is output as a standard MIDI file. The composition process is thus in two parts: first writing the basic program structure, and second repeatedly tweaking parameters and re-running it until a desirable result is attained. One crucial design decision was not to represent whole notes in the internal notation, but rather to segregate pitch, duration and loudness into separate streams, so a program can more easily manipulate these values separately. The library contains a lot of mathematical transform functions that reverse, invert, transpose and mutate such streams, in the manner of a Bach or a John Adams. As an example of the kind of Pascal code involved, here is the main program loop that generates the piece I called "Mexican Bat Dance":
FOR I := 1 TO 4 DO
S.Track('Melody', Str(I, 0, 0));
IF I = 4 THEN
BEGIN S.progchange(I, I, Electric_Bass_finger) END
ELSE BEGIN S.progchange(I, I, Acoustic_Grand_Piano) END;
FOR B := 1 TO 24 DO BEGIN
Ma := M[B mod 8+1];
R := bar(tr(Ma, 50), 600);
V := tr(Ma, 100);
S.rest(I, 3*I, I);
S.phrase(I, Ma, R, V, major, 30+(I mod 2), I);
Using such an indirect approach via an intermediate MIDI representation means that I can't create the music as live performance the way that dance DJs do - I'm strictly an indoor composer sitting in my room churning out tunes. However the marvellous advantage that MIDI offers is the large selection of General MIDI instruments that I can change at will: having found a promising structure I can try it out with any combination of instruments, including even orchestral and brass sections, string sections and choral effects. Recently I've licenced the excellent Ableton Live sequencer which lets me post-process tunes to apply even better instrumental voices and special effects.
I started out by playing with techniques similar to those used by "minimalist" composers Phillip Glass and John Adams, including reflection and inversion of melody elements, making sections slip in relative phase, fugues too complex to be played by human hands, and fractal structures in which large scale movements are constructed from similarly-shaped smaller scale elements. Most of the tunes I produce are fairly short snippets because the big problem with algorithmic composition is instilling variation in a way that doesn't sound merely arbitrary. The computer is happy to play the same or similar sound forever without getting bored, but neither you nor I would want to listen for that long.
I've recently mastered introducing instrumental "solos" in a moderately convincing way, but what I haven't so far been able to achieve is a single program that can generate a through-composed piece with several movements (the difficulty lies as much with the structures supported by the programming language as in my limited composing abilities). I've now relaxed my rules a little to allow stitching together two or three separate snippets, made by different runs of a program, into a more complex "suite".
My own musical education progressed from black American music - '50s and '60s R&B, country blues, soul, jazz (particularly bebop and later on free jazz), on to modern music via Bartok and Debussy, before returning to a deeper appreciation of classical music from Bach, Beethoven and Schubert, through Wagner and R Strauss up to contemporary figures like Leo Brouwer and Dusan Bogdanovic. One result of this highly unorthodox trajectory is that I'm obsessed by achieving highly variable, "springy", human-sounding rhythms: Charlie Parker's lightning scales; Bartok's orchestral handbrake turns; Robert Johnson's manic strums; Danny Richmond and Charles Mingus swapping bass and drum flurries; Sly and Robby dubbed by King Tubby. I find some contemporary club music very exciting, particularly certain electro house and dubstep producers, but it's not a direction I'm seeking for my own works, which rarely have a strictly metronomic beat measured in BPM.
When Windows killed off Turbo Pascal in the late 1990s I stopped using my system, though I always meant to re-write an interactive version in Borland's Delphi that cut out the intermediate MIDI files but never got around to it. Later I fell under the spell of the Ruby language and planned to write the interactive version in that (I still have a Ruby Gem with the necessary MIDI interface) but that never happened either.
What revived my interest recently was reading Philip Ball's magnificent book "The Music Instinct", which hugely improved my understanding of harmony by explaining it at both physical and physiological levels, and then meeting a young American muso (thanks Jim) who turned me onto SoundCloud.com, which does for music what Flickr does for photos. Then I discovered that the Python language was perfectly suited to rewrite my composition system (it has superb constructs for handling sequences of notes), and also discovered Ableton Live, a marvellous music performance/composition application. I now generate MIDI from my new Python version, then put the MIDI files into Ableton to add instruments and effects for a more polished sound. Here's a link to a SoundCloud album of some of my better efforts using this new Python version - it's called RubbleDub -- and here's a link to my older, Pascal version stuff on SoundCloud.
At the foot of this page are a few of my very earliest attempts as MIDI files that you can download, play and modify using any sequencer. One of the tunes deserves further comment. Called Primal, the algorithm it employed is based on the values of the first 2000 prime numbers (1,3,5,7,11,13 etc). I couldn't use the values of prime numbers directly as pitch or duration information because they continuously increase and so the tune would just zoom upwards faster and faster into the hypersonic region! So I based both the pitches and durations of notes on the gaps between successive pairs of primes rather than their absolute values. The result was rather too bland and uniform so I also made the emphases (ie. the rhythm) also depend on the gaps, and ended up with a polyrhythmic, atonal tune that reminds me a little of some African music. You'd be hard put to whistle it, and I wouldn't recommend dancing to it either unless you are very supple indeed. I deliberately allocated African string and percussion instruments as the voices to bring out this aspect, but the file PRIMAL.MID is included below which you can download, and if you know how to operate a MIDI sequencer you could replace these with harpsichord, orchestral instruments or whatever takes your fancy.
Also included below is a poem called "The Proof" about the mathematics of prime numbers by Felix Dennis, who very kindly dedicated it to me. I had the poem read by a vintage voice synthesiser program called MonologueW, with my Primal tune playing as the background. I chose it because this voice has an early-Steven-Hawking quality that's been lost in superior modern voice synths (which merely sound like perky American ad salesmen to me).