Music Composer -- computerized creativity

Music pixCan computers compose music? Can they actually create anything that's new or original? This program can help you think about these questions as your computer plays interesting and thoughtful music that no one will have heard before. It's up to you to decide if this is elevator music, new wave, junk, punk, or possibly a new dimension that's shared by some of our modern composers.

Music Composer -- instructions for running the program

This is my attempt to write a program that creates original music. Begin by running the Music Composer program, following the suggestions below.

MenuWhen the program starts you will see this menu. Begin by pressing zero. The computer will create an endless series of notes picked at random from a musical scale. As you will quickly hear, notes picked by the computer with no pattern at all are not particularly interesting.

The other eight choices offer compositions based on a specific pattern. If you press "1" and select Major Chords, the composition uses three major chords to create a changing pattern of notes. Each time the sequence repeats, a note is added or subtracted.

Instead of a rhythm or measured beat, this music is made up of continuous notes that are constantly changing. The chords will sound familiar, but the way the music changes will probably be very different from what you are used to hearing.

After a few minutes, press any key from one to eight on the keyboard and select another composition. The first three are combinations of chords, and the last five use several different musical scales.

You can change the tempo or speed of the music by pressing the left and right arrow keys while the program is running. I like the tempo that I selected when the program starts, but try other speeds and see what you prefer.

Run the Music Composer program.

After you've finished running the program, press the Esc key to stop and return to this page.

FlowchartSee how it runs -- the flowchart

It's probably no surprise to see that this program design contains loops within loops. After you select the composition type, the program takes over, creating its own unique composition.

Inside the first loop, the program adds a note each time the sequence is played. The computer can select and add any note that is included in the chord being played. When there are no more notes to be added, the program goes to the second loop.

Inside the second loop, the computer subtracts a note on each cycle until there are no notes left. At this point the program selects a new chord and a new length for the next sequence, and then returns to the first loop again.

There are two ways randomness is used in this program. The length of each cycle can vary each time a new chord is selected. The notes that are added are randomly selected from all notes in the chord.

This program is probably easier to listen to that it is to explain. If you like the effect, you might decide that the computer is creating "music" after all. If you think this sounds boring or simply awful, then don't give up on the idea that computers can be used as tools for creating music. In other words, don't blame the computer, blame the programmer. Whether you like my results or not, you may want to try changing the way this program works by changing the chords and the musical scales used. How to do this easily is explained below, in the programmer's section. How this program sounds different from music you are used to is explained next.

It's about time -- east, west, and elsewhere

Western music from rock and roll to Ravel and Rachmaninoff is very similar in the way it uses time. We usually select notes in a particular key and add them to a rhythm or beat that is constant for a particular piece. The music created by this program uses a very different technique. There is no set rhythm because the notes are continuous, with a single note being added or subtracted with each musical cycle. Even if the chords or scales are familiar, the constantly changing length gives this music its unusual character.

With this program, your computer can create endless variations on whatever chords or scales you select from the menu. Whatever your choice, it is a sure bet that you can't dance to it. Some Eastern music and compositions by several modern composers take a similar approach to musical time. Instead of a set rhythm, a changing series of notes is played as a unit to create time values.

More about a modern composer: Philip Glass

Inside look -- at random

Random pixRandomness is everywhere. This is the property that makes every tree, flower, and person unique. Humans are skilled at seeing and identifying patterns in nearly random events. Using these patterns within randomness is how we can tell elms from oaks, daisies from daffodils, and ourselves from giraffes.

It is also patterns that make music different from noise. A scale played on a xylophone sounds different to us from a garbage can bouncing down the stairs or wind in the trees because of the organization in the musical sounds we hear. Music with a great deal of organization or predictability is very easy to listen to, or even dance to. When the patterns are more complex, as with some kinds of classical music or music from unfamiliar cultures, we have to listen more carefully to hear the form or the composition within the music. If the composer's design is too complex or not at all familiar, the music may sound completely randomized and not unlike falling garbage cans -- at least to us.

In this program, I use randomness very carefully to create music that is unique with every performance. The patterns I use range from familiar chords to scales that will probably sound unusual to you. Whether the result is musical, boring, interesting, or simply garbage to your ears, depends on how well this computer program can combine musical patterns you may like with random events you have not heard before.

More ideas -- music & MIDI

There are two very different directions you could explore with this program. If you were interested in music, then modifying and expanding the compositional database would be an interesting place to start. You could, for example, easily substitute any chord sequence in any key you like and hear the results. You could also experiment with a variety of musical scales that are different from the ones that sound more familiar. If you wish to experiment with alternate forms of music creation, then you will have to modify the program itself.

The other area for possible expansion of this program is the way it sounds. I am not at all satisfied with the beeps in the computer's speaker, and I would like to at least drive the sound board directly and create a more interesting instrument to listen to. The numbers I use in the program are MIDI (Musical Instrument Digital Interface) compatible, even if the program is not. Providing an output that would drive synthesizers would be great.

You are welcome to share any compositional or instrumental insights you have with me and with others who will be using future versions of the seminar. Please read sending stuff to me before you send stuff to me.

Programmer's toolkit

SetupData (Comp(), Chord())

I promised that I would show you how to "easily" modify this program to use your own chords and scales. Now that I've reached the end of this section, I take that back. It isn't exactly easy, but it is both possible and fun to do.

You will have to load this program in BASIC and then look carefully at the SetupData sub. The Composition array format section is where I determine the chord sequences. If you look at the Blues Chords section, for example, you will see the familiar eight bar blues sequence.

The Chord array format section is where I assign specific notes to each chord. You will see lots of familiar chord patterns here if you remember that I am using MIDI notation to specify the notes.

If this description makes sense to you, then you are well on your way. If not, not. Even though I enjoy composing music on a classical guitar, I don't actually know beans about chords, notes, music notation, and similar stuff. I wrote this program by listening to it and fussing with it until I liked it. It took me over a week to try and rewrite the present version of this software so that it would make sense to somebody who understands music.

Rand (Bottom, Top)

The computer can create almost random numbers easily. I say "almost" because completely random events with no pattern whatever are actually difficult to find or produce. The Microsoft BASIC instruction that picks a random number is OK, but I find it so confusing to use that I wrote a function that makes creating random numbers easy, and added this to the Programmer's Toolkit. This is a direct copy of the random function that Jay Fenton used in BALLY BASIC about 18 years ago. Here's how you can use my function in your programs:

To create a random number, just use the Rand function, like this:

x = Rand (1, 10)'x is a random number from one to ten.
z = Rand (0, 100)'z is a random number from zero to 100

To create a 10% chance that an event will happen:

IF Rand (1, 10) = 1 then GOTO DoYourThing

In order to use this function, you must add this instruction at the beginning of your program:


Exploring random numbers on your computer