musicLife

Last semester I had a class entitled “Music Composition With Computers”. The class was very different from what I expected, and we focused entirely on Art Music, rather than how to use computers to compose more conventional music. Art music is definitely a different experience than any other music I’ve listened to, and you should check it out (though keep an open mind!).

Our final project was to create a piece that was five to seven minutes long. It was a very non specific assignment; we didn’t even have to use computers for the project. I did use them and I wrote a program that would do all of the composing and the sound making for me. When you run the program what you’ll see are a bunch of different colored dots on the screen that represent music playing entities. They will move around and play their instruments for generally as long as you let the program run (though they do sometimes all die out). I suggest running the program multiple times, because each time you’re likely to get something that sounds very different from the last. For more details on conceptual level operations of the program, check the program notes which are included in the download at the end of this post.

That program is musicLife. It consists of five classes: Entity, Neuron, pocket, Project9, and SoundMaker. It is a Java Applet and you’ve find the source at the end of this article. Each class does the following:

  • Project9: This is the class that’s run, and gets everything else running. It handles the visual output and the reproduction/killing off of the entities.
  • Entity: Each entity has “brain” which is a two dimensional array of neurons. The Entity manages the neurons by prompting them to fire and passing them input from the environment and passing the environment input from them. Also, each Entity has two instruments which are selected from the midi catalog on the computer its running on. Depending on the out put from the neurons, the Entity will play or not play its instrument. The Entity’s movement about the screen is also determined from neuron output. Lastly, if the Entity is passed an Entity during construction bases its own brain on the brain of the Entity it was passed. In this manner there is a parental lineage that forms that allows the evolutionary aspect of the program to work.
  • Neuron: Each neuron is generated with an algebraic operator (+, -, /, *), a number that will be used with that operator when data is passed in, and four links to other Neurons in the Entity’s brain. The neuron takes in information, uses its operator and number on it, then passes the info out to the Entity (in a “pocket”) and the Entity handles letting the other Neurons know they have data to accept.
  • pocket: This is a really simple class that shouldn’t even exist, but for some reason I made it and once I used it in the code I didn’t see it being too necessary to change it. It just holds two objects, and thats really all it does.
  • SoundMaker: This class accepts the number of the midi instrument to be played and the pitch to play it at. There are only the population limit number of SoundMaker classes, and they are reused after an Entity dies because midi synthesizers get very expensive resource-wise when you’ve got upwards of 20 going at once.

To get the program running compile everything and use whatever tool you normally use to run Java Applets. I used TextPad, its really easy to use. Included along with the source is the Program Note I created when for when the piece was to be played. I thought the piece’s name was self referential and clever: A Truth: No piece has ever been given a name with this meaning.

I created this quick licence that, by downloading this file you are signifying you agree to:

By downloading this you agree to the following:

1. You may modify these files any way you wish, and you may even
use them as your own. However,

2. Any feature modifications you make you must inform me of. You
don’t have to provide the code (though you can), but you must
provide the conceptual details for the modifications you’ve made.

You can get the files right here.

Published by

Chris

This is my blog about life and things I find interesting.