SoftMusic Documentation

by Stefan Blixt

Last updated 2003-01-10



Using SoftMusic

Configuring SoftMusic

SoftMusic Internals

My Thoughts on Music


Contact Info


What is SoftMusic?

SoftMusic is a program that creates music based on a random generator and various restrictive algorithms. It can be used for quickly creating ambient musical backdrops, cyclic arpeggios that can be used in techno songs, or just plain strange music. You can also sit fiddling with the large amount of configuration options for fun, and become mesmerized by the strange tunes that flow from your speakers.

SoftMusic uses Java's MIDI-implementation, and is capable of exporting MIDI files for use in other software. It can also play directly using Java's internal software synthesizer implementation. More possibilities for sending MIDI data to external and internal synthesizers are planned to be implemented in SoftMusic in the future

Using SoftMusic

Note: Some of the terminology in this manual will perhaps only be understood after reading the whole manual through. You can refer to the terminology section if you start getting too confused about what is written here.

The strategy when constructing SoftMusic's graphical interface has been to place most of the controls that immediatly affect the music directly in the main window and subdialogs that are reached by clicking buttons in the main window. The menu bar is used occasionally.

The main window consists of a number of horizontal bars that are called players and stretches across the entire width of the window. Every player consists of a number of text fields and buttons that are used to change the configuration and state of the player. Buttons that contain a text with "..." at the end will bring up a dialog containing more controls.

The Player

Let's go through the individual parts of a player and explain what they do. I'll describe them in the order from left to right, top to bottom.

At the top left of the bar is the player name, which is used to identify the player in various dialogs. To change the player name, double-click it. Next is the MIDI channel that is used for this player. There are 16 channels in the MIDI standard, with channel 10 usually set to play a collection of drum sounds. Next is the instrument that is set for this MIDI channel. Note that if you set the MIDI channel for two players to the same value, an instrument change will affect both players. Also, the instrument list isn't currently updated after startup, meaning that it doesn't show drum list names of new soundbank contents properly.

Next is the pattern size. As described in the internals section, players play cyclic patterns of notes. The note count sets the size of this player's note pattern. The following textfields, Note count max and min, set the amount of notes that will be placed in the pattern.

Next comes three buttons that affect the state of the player. Play causes this player to start playing its notes in time with the other players. Mute causes this player to stop playing its notes, although the notes that have already been played will sound until their release time is up. Shuffle will cause this player's notes to be erased and replaced with a new set of randomized notes.

After this comes the note collision setting that determines what will happen if a note is written to a position that already contains a note. "Overwrite" means that the old note will vanish and the new note will be put in its place (note that this may cause the final amount of notes in the pattern to be less than the minimum setting for note count. "Add" means the the old and new note will sound together at the same time. "Reshuffle" means that SoftMusic will try to find a new time position for the new note.

Tone base will display the tone base dialog. Next come two buttons that set the scale for this pattern. The first button sets the base note for the scale (as the D# in D#-minor), and the second sets what kind of scale this is. There are a number of different kinds of scale to choose from, and you can create your own kinds if you like (see Configuring SoftMusic). The following scales are shipped with the program (please excuse me if these are not named properly; I am not so well-educated in english musical terms. Come to think of it, I don't know all the proper names for these things in my native language):

Next on the player bar is the transpose setting, which will cause all notes in the player pattern to be transposed the corresponding amount of half-tones as the last stage in shuffling.

Last in the player bar come buttons for opening dialogs concerning time weights, note lengths, chords, and note wandering.

Tone Base

When shuffling, the first stage when creating a note for the pattern is deciding what pitch the note is going to have. For this, the tone base is used. In the tone base dialog, the use single note checkbox decides whether this note is always to be the same pitch (possibly transposed up or down octave-wise), or if a collection of weights is to be used instead.

When "use single note" is checked, the combo box to the right of the checkbox changes to display the twelve tones used in western music (click the combo box to see all the notes). The selected note will be used when shuffling. If the checkbox is not checked, the combo box will instead display a collection of pre-defined sets of note weights. You can create note weights of your own if you like, (see Configuring SoftMusic). These are shipped with the program:

You may note that all of these fit in the C-major scale (which uses the same tones as A-minor), plus B flat in the case of Jam C-Major. It is OK to use notes in the tone base that are not part of the selected scale. They will be played by the players, and when they are added to or subtracted from by note wanderers or chords, the result will be an adjacent note in the selected scale.

If the octave range is set higher than one, then notes will be transposed one or more octaves up or down based on the following crude and home-made distribution algorithm:

  1. If the range is 2 octaves, then there is a fifty-fifty chance that a note will be transposed one octave up.
  2. If the range is an uneven amount of octaves, then there is a fifty-fifty chance that it will not be transposed by the octave randomizer. If it is transposed, then there is a fifty-fifty chance that it will be up or down. If it is transposed down, and the range is greater than 3, then there is a 25% probability that it will be transposed more than one step. If it is transposed down more than one step, and the range is greater than 5, then there is a 25% probability that it will be transposed more than two steps, and so on. Anologous logic apply when transposing upwards.
  3. If the range is an even amount of octaves, then there is a fifty-fifty change that a note will be transposed as if the range was 2 octaves. If it is not transposed as if the range was 2 octaves, then it is transposed as described for uneven ranges.

Time Weights

Rythm and timing is at least as important a concept in music as note pitch, and this part of the interface is where you configure how a player's notes are distributed in time. When shuffling, the player's set of time weights are repeated to fill the player's pattern (if the length of the time weights set is less than the size of the player's pattern) and used as place holders for notes. Notes that are created at the first part of each shuffle iteration will end up in the place indicated by a time weight with a statistical frequency depending on the value of the weight. Notes created by a note wander model will use the next time weight greater than a set threshold.

The actual time weights are shown as black vertical lines and green dashes at the bottom of the time weights dialog. The buttons, text fields (except the size field) and slider above are used as utilities to create sequences of time weights.

The default time weight model contains a single weight with the value 100%. If you want to try this dialog out, try increasing the size (click the up arrow next to the size field), and then clicking just above the green dashes at the bottom. You'll see that black lines appear if you click above an empty weight position. This shows the actual contents of the assigned player's time weight model.

If you set the slider above the weight graphics to a value and click the uniform button, then all weights will be set to the slider's value. If you click the weigh beats button instead, then beats will be set to the slider's value with the set frequency, beginning at the weight position indicated by the set offset value.

A warning will be displayed if there at any time are no time weights greater than 10%. SoftMusic need to have at least one time weight greater than 10% to be able to safely support all its features.

Note Lengths

The note length settings decide how long a note will sound after it has been triggered by the player. The note lengths are stored in the player's pattern along with the notes.

If the stop at next note option is checked, then a note will not sound after the following note in the player's pattern has been played, with some adjustement by the offset parameter. The offset determines if the note stops the set amount of ticks before the next note (negative offset), or overlaps the set amount of ticks into the next note (positive offset). Omit is not used by the SoftRythm algorithms at present.

If the randomize lengths option is checked, then the lengths of notes are randomized, with the maximum and minimum length set to the amount of ticks set in the text fields max and min respectively. If randomize lengths is not checked, and stop at next note is, then all notes will always stop in synch with the following note. If none of these options are checked, then all notes will last the amount of ticks set by the max parameter.


Note: this is one of the parts of SoftMusic where I personally have had the most fun, and I plan to add a lot to the chord generation in the future. Also, not that many chords are predefined in SoftMusic at present, partly because I don't know what they are called, but also because SoftMusic does not yet support chords with notes that are not part of the base scale, such as C7, which contains a B flat although it is often played in melodies that go in C-major. Watch this space.

Throughout this manual, the word "note" is mentioned fairly often. If you check the use chords option in the chords dialog, then you can exchange the word "note" with "chord", and almost all descriptions here will apply appropriatly, including note wandering and tone base.

When chords are used, the shuffle process replaces all notes with corresponding note clusters depending on the chord configuration of the player. A chord consists of two or more note offsets that are added to the original note created by the shuffle process. The offset addition follows the rules of the player's scale (note: thus the chord offsets do not represent half-tones)

The combo box next to the use chords checkbox contains a number of preconfigured chords. You can define chords of your own, if you like (see Configuring SoftMusic). These are shipped with the program:

Note: the uses mentioned in the list above need not apply at all to the kind of music you like. Most chords have a lot of different possible uses. Just try them out and see what happens.

If the randomize note amount is checked, then a random amount of the chord notes will be used for each note. At least one note will always be used, though not necessarily the base note that the others where offset from. If fix notes upward is checked, then the selected amount of notes (including the base note) will always be offset upwards in the scale. Otherwise, there is a fifty-fifty chance for each note in the chord that it will be transposed one octave downwards in the scale.

Note Wandering

Note wandering has been implemented as a kind of add-on to the note shuffling described in the tone base section. The idea is that the shuffling algorithm picks two notes using the methods described above, and then a wander model creates a series of notes that begin at the first note and end at the second. The goal of this algorithm is to create something that might sound like a continuous melody.

If the use note wandering option is checked in the wander dialog, the player is set to use note wandering. Next to the checkbox is a combo box containing a set of predefined note wander models. The following three note wander models are implemented in SoftMusic:

Note wandering is always restricted to the set scale for the player. To decide the timing of the notes the player's time weights are used, so that if two notes succeed each other, then there will be no time slot between them with a higher weight value than 10%. The amount of notes created by a wander model has to obey the limit set by the note count settings in the player bar.

The wander size settings determine the statistical length in notes of each wander sequence generated when shuffling. The slack settings determine the statistical tone distance between two successive notes in a wander sequence. As mentioned above, some of the wander models ignore parts of wander size or slack settings.

Configuring SoftMusic

A subdirectory called "config" resides in the main directory for SoftMusic. Here a number of configuration files reside, parts of which you can alter.

Configuring Chords

In the file chords.smc are stored settings for various chords that can be used in SoftMusic. The format for the lines in the file works like this:

chord name/note 1/note 2/...

where "chord name" is any string that uniquely identifies this chord amongst other chords. "note 1" is the first note in the chord, described as a numeric offset in whole tones from a base note. At least one note needs to be defined. Note that you need to include the base note (0) if you want it to be part of the chord.

Configuring Note Weights

In the file noteWeights.smc are stored settings for various sets of note weights that can be used in SoftMusic. The format for the lines in the file works like this:

set name/C weight/C# weight/.../B weight

where "set name" is any string that uniquely identifies this set of note weights amongst other sets, and the rest of the values are decimal weight values for their corresponding tones. There are always twelve such weights.

Configuring Scales

In the file scales.smc are stored settings for various scales that can be used in SoftMusic. The format for the lines in the file works like this:

scale name/scale characters

where "scale name" is any string that uniquely identifies this scale amongst other scales, and "scale characters" is a string of twelve characters, where "X" means that the corresponding tone is part of the scale, and "." means that it is not.

SoftMusic Internals

In this section I will describe what happens when players are shuffled and played in SoftMusic. A lot of this information is also described in the other sections of this manual, but here they are summarized from the perspective of the randomizing algorithm instead of the perspective of the user interface.

The Shuffling Algorithm

When SoftMusic shuffles a player, that is creates a new pattern of the set size and fills it with a random amount of notes, it is like taking a blank sheet of music paper and sprinkling notes over it. Therefore the function called "shuffle" is somewhat inaptly named, since it suggests that existing notes are shuffled around rather than created anew. I chose it over names such as "sprinkle" or "create new" though, since I think it gets the message through that randomness is happening to the player without making the user nervous about using it.

The first thing that happens when the user clicks "shuffle" is that the note pattern in the player is erased. A number is then generated (based on note max count and min count) that decides the amount of notes that the pattern will contain this time around. After that, a loop is started that will last until all notes have been distributed in the pattern. The loop takes these actions:

  1. A new time position for a note is created using the player's time weight model. If the set of time weights is shorter than the player's pattern, then copies of the time weight set are placed adjacent to each other so that they fill the pattern. A position is then picked using an algorithm that ensures that time positions with the same weight value have the same chance of being picked, and that a time position is less likely to be picked than a time position that has a higher weight value.
  2. A note length is generated using the note length model.
  3. A tone is generated using the tone base settings.
  4. If chords are used for this player and note wandering is not used, then the note is transformed into a cluster of notes according to the chord settings.
  5. If note wandering is used, then a second tone is generated using the tone base settings, and the player's note wander model creates a sequence of tones based on the two tones that the shuffling function has created. This is then placed in sequence (restricted by the time weight model) in the pattern until the note amount limit that was set at the beginning of the shuffling function is reached.

After this, if the stop at next note option is set in the note length model, a second loop is initiated where all note lengths are checked against the time position of the succeeding note, and adjusted according to the note length model. After that, the shuffling is complete!.

Playing notes

SoftMusic plays the notes of unmuted players in the current project using a simple ticking timer and Java's internal software synthesizer. The ticking timer triggers a note player function every 250 milliseconds, which performs the following steps:

  1. All notes that have been played by SoftMusic are stored until they have sounded as long as their set lengths indicate. The first thing that the note playing algorithm does is check all stored notes for overdue lengths, and sending corresponding note off messages for notes that have ended.
  2. After that, it loops through all unmuted players, retrieves any notes that are in the player pattern's position that the ticker currently points at, and plays them. If they are cluster notes (notes that have been transformed into chords), all of the cluster notes are played. The played notes are stored for future termination as described in the previous step.
  3. Last, the tick value is incremented

The ticking timer is started when the SoftMusic program is started, and is kept running even when all players are muted. When you click play for a player, SoftMusic starts to play it at whatever position the ticker currently happens to be pointing.

My Thoughts on Music

Stupid Music

The idea for this program has been raging around in my brain for some time, and when I recently was given large spaces of free time with nothing to do (I was not at home with my TV and PC and CD and Playstation etc.), I thought I'd give it a go and see if it was possible to generate some music that was possible to listen to without cringing. Especially since I noticed Java's sound API (what's the point of making this kind of program if you can't easily make it generate sounds?) and Java, as we all know, is the best programming language in the world.

I was amazed when I had created the first bare-bones version that just threw some random notes into the pattern and played them. I thought it sounded exactly like parts of Brian Eno's "The Drop". I know that Eno has experimented with this kind of program (I have heard about a "record" that he released that, when you opened the jewel CD box, contained a floppy disc with some music-generating algorithms on it) but still. It shouldn't be as simple as this program, should it?

Thinking about it (and working with this program) has convinced me that the process of making music actually is pretty simple. We like to think that music is a mysterious thing that a few gifted individuals are able to create for our pleasure, and I think that at least the first part of that sentence is true. Music is mysterious, because it is disconnected from most things that directly affect our lives such as cars, new-born babys and guns. OK, so you can make music that sounds like a machine-gun, but I consider that more part an intellectual message in such a song than part of the music. You could make a love song using the same sounds and not think for a moment about machine-guns.

The mystery of music happens when you listen to it and contract emotions from it, and this often doesn't have a lot to do with the genius of the person creating it, since the mystery is part of the essence of music. I like to try to write songs every now and then, and am often surprised after writing a song at the emotions that it causes in me. They are often not what I intended, but pleasing all the same.

The Logic of Music

The structure of music is very easy to understand. In Europe, we generally use a selection of seven or eight tones out of twelve to create a melody, plus versions of those tones that have double the frequency (one octave up) or half the frequency (one octave down). If we take any other kind of tone and put it with the others in a song, it sounds bad, and we cringe in our seats and change the channel on the radio or whatever. A tone-deaf person that sings will use a lot of tones that are not part of any scale.

Then there is the timing, which is more complex but equally important. You can't just pick a few good tones and play them indiscriminately, there has to be a rythm to the melody. These days rythm is usually thought of as as a modern music thing as in dance music or backbeat rock'n roll, but rythm is in all music, in the psalms that you sing in church, in Wagner and all the way back to the primeaval caveman who invented music. If we subscribe to the theory that music arose as part of dance rituals before going to war with another tribe, or perhaps people hacking down a tree together with their axes striking in time, then rythm was probably there before melody and tones.

A rythm is a set of regular intervals in the time between sounds that are repeated over and over. You can insert irregularities if you like, and stretch out the length of the rythm intervals. But not too long or too complex, or the listeners get confused and the music starts to feel pointless.

The Mystery

The mystery of music appears when you ask yourself: why these rules? Why do I not like it when they are broken? Why don't I like it often even when they are obeyed? What makes a song good? Can it be explained physically or logically? SoftMusic is part of my quest in finding the answer to this question. It may be that this mystery has been solved long ago, and I just have to find the book where the answer is written. But the quest is fun, and I think I'll keep away from the library a bit longer.

I have analyzed the way I think when I make a song and tried to convert some of that thinking into computer algorithms. I have also tried to analyze music that I like, and convert regularities that I find there into algorithms. This is the result. SoftMusic naturally sounds nothing like a good pop song, but that was not what I expected either. Generally I've tried to keep tailor-made things out of SoftMusic (like a bass drum/snare pumping algorithm) and keep things general so that they, combined with other parts of SoftMusic, can create a large amount of different and, hopefully, unexpected effects.

Although SoftMusic is not pop music, it isn't necessarily what we think of as art music either, since art music often is about breaking free of the music rules I have described above to obtain complete freedom in its expression. Breaking rules is not something that a computer program is good at, so I have concentrated on trying to generalize the rules that I see in "normal" music around me, and code them into SoftMusic.

Also, SoftMusic is still a pretty primitive program that I hope to add a lot to in the future. Maybe it can be capable of creating a good pop song sometime! If it does, I don't think it would necessarily be a bad thing, because the magic of music lies in the listening, not the making, and that good pop song will probably have to be selected by a capable human listener out of heap of strange, boring or weird pieces of music. Because the main thing about music is that it is enjoyed, and that is something that humans do. The computers don't care.


Note: I am not a certified expert on musical terminology, and therefore some of these explanations may be plain out wrong. If you know more appropriate explanations, please contact me.

Bar - in sheet music, a way of dividing the music into small sections that are often the size of four quarter notes (one full note). Since the shortest note length in SoftMusic is about that of a common quarter note it could be said that a bar is four ticks. So if you set the pattern size for a player to eight, then you might say that it contains two bars of music.

Chord - a collection of tones that are played simulationeously to create a harmonic effect.

Combo box - a kind of button in a graphical user interface that, when clicked, displays a list of options that may be selected for this combo box. SoftMusic has a lot of them.

Flat - a half-tone offset downwards from a base note, e.g. E flat (a half-tone lower than E). In sheet music, this is usually indicated by a symbol like a small quarter note (unfortunately this symbol doesn't seem to be generallysupported by browsers at the present).

Half-tone - the smallest distance between two tones in the western twelve-tone spectrum, e.g. the distance between C and C# or the distance between E and F.

Note - the combination of tone and note length. See note length.

Note length - the length in time that a note will last before being silenced. In sheet music, this is indicated by the shape of the note: a circle means a full note that lasts a whole bar, a circle with a line attached to it is a half note (not the same as half-tone!), a filled circle with a line is a quarter, a quarter with a flag is an eighth and so on.

Note wandering - a way of creating melodic sequences in SoftMusic. I made the term up myself, so don't try to find it in a musical dictionary.

Pitch - the frequency of a tone.

Player - a container for a pattern of notes and various settings for tone base, scale, note lengths, time weights, chords, and note wander model. Represented by horizontal bars across SoftMusic's main window.

Scale - a collection of tones from the western twelve-tone spectrum.

Sharp or # - a half-tone offset upwards from a base note, e.g. C# (a half-tone higher than C).

Shuffle - the act of replacing a player's note with a new set based on the current settings in the player.

Tick - the smallest distance in time between two notes in SoftMusic. At the time of writing, this is fixed at 250 milliseconds.

Time Weights - a method used in SoftMusic for deciding when a note is to be played.

Tone - a sound that has a distinguishable frequency, called pitch. In Europe, the twelve tones C, C#, D, D#, E, F, F#, G, G#, A, A#, and B are generally used to create scales and melodies.

Tone base - settings that determine which tones the shuffle algorithm will create.

Weight - in computer science a term that usually means "probability that this will be selected".

Whole tone - a distance between two adjacent tones that are part of the same scale. This may be equal to one, two or sometimes more half-tones.

Contact Info

Stefan Blixt may be contacted by email at or The traditional mailing address Slussgatan 12I, 211 30 Malmö, Sweden may also be used