Game of Chance

Have you ever wished your computer could help you write a good tune or provide some unique chord changes for your latest effort? Or have you ever wanted

Have you ever wished your computer could help you write a good tune or provide some unique chord changes for your latest effort? Or have you ever wanted it to generate an endless stream of random notes that conform to certain limitations (everything must fall between A2 and G7, for example)? If these sound like strange concepts, then you'll be interested to know that using computers to help make compositional decisions is a practice that originated in the very earliest days of modern computing, and composing music by using algorithms is a tradition that is thousands of years old.

Algorithmic composition, that is, the use of instructions or processes to determine aspects of a musical work, has taken many different forms. In the digital era, composers have used a variety of approaches to enlist the computer in the compositional process including using data derived from scientific domains (for instance, converting DNA sequences into control information for a composition), applying random distribution curves to select events, and employing various types of number theory. Nor is it uncommon for composers to write their own algorithms, such as one that instructs the computer to choose randomly from a certain group of notes some set number of times, then to make choices of instrumentation based on the notes that were selected.

Regardless of the approach, the main trick is determining how the data that is generated by the algorithm is applied (or “mapped”) onto specific musical parameters. In some cases, such information is used to control pitch, but it might also be used to determine the overall formal outline of a piece, the register and dynamics of an instrument, or any other aspect of a performance that the composer chooses to put under such control.

In this article, I'll describe the approaches taken by several representative algorithmic-composition programs on the PC and explore the various features each offers. (See the “Contact Information” sidebar for a list of the developers' Web sites. You will also find a list of some other software, including programs for the Mac, in the sidebar “More in Store.”) Two of the programs in this roundup allow you to tweak parameters in real time and hear the results, while the others require that you configure your settings, then wait for the data-generating process to run. And all of the programs generate MIDI data except one — Rajmil Fischman's Al and Erwin processes WAV files in very unusual ways — while Nyr Sound's Chaosynth can produce MIDI and audio files.


MuSoft's a Musical Generator (aMG; shareware, $25) is a powerful yet intuitive program that incorporates many of the data-generating techniques of the other programs in this roundup but with some added twists. For starters, you can apply algorithmic processes to four different musical parameters, which aMG calls Aspects (note selection, duration, Velocity, and note start time), independently. You can also customize all of the algorithms, then see what type of data they will generate by plotting them on a 2-D grid. And because you can interact with the Windows Clipboard, it's easy to import data to or copy it from the program. This allows you to use nearly any source of information to control an Aspect — a spreadsheet, a database, an e-mail to your publisher, or even the lyrics to your latest song.

AMG's algorithms are divided into five categories: 1D Fractals, Dynamic Systems, Complex Maps, Data, and Other. When you pick a category (by selecting its tab at the top of the screen), thumbnails of the processes available from that category appear (see Fig. 1). Click on a process, and its icon shows up in the Data section at the left of the screen. From here simply drag the icon onto the Aspect you want it to control.

To edit a process, double-click on its icon and choose Edit. A window opens in which you can set a high and low range for the algorithm's output, change its color, set its start and end points, and tweak other parameters depending on the algorithm you're working with. For example, if you're working with a fractal image, highlight a small area of the image, and that area will be magnified to fit the entire screen. It will also become the new source of the data that gets applied to the Aspect.

There are algorithms for generating numbers randomly using various types of noise distribution, and you can just as easily generate a linear succession of integers within any range. You can also import a text file from your hard drive directly using the Text Editor (found in the Data group). I converted this article to a text file and used it for the Notes (pitches) parameter of a track — you can hear the first 30 seconds of this effect played by a marimba in the file articlescore.mp3 at the EM Web site.


AMG supports up to 16 voices (version 4.0, in early beta, extends that to 128), each of which is assigned to a track. In addition to a MIDI channel and patch, you can assign each voice a default “style” and scale. There are 50 scales to choose from, and you can build and save your own. Styles include staccato, legato, and normal, but these are only default settings, and they'll be altered by the processes you choose for the various voice parameters. You can also solo, mute, and name a track.

In aMG, almost everything can be controlled by algorithms including an additional 16 drum tracks and all MIDI controllers. That allows you to play with panning, reverb depth, portamento, Aftertouch, or pitch bend in any way you wish. Altogether this gives you lots of flexibility in creating your music.

AMG's Help file is adequate, and it comes with over a dozen example files to work with (more are available at the developer's Web site). Exploring the program was fun — every new turn seemed to produce another feature. If you want to get a taste of algorithmic composition in the most direct and clear-cut manner, this might be the one to try.


Rajmil Fischman's new software takes a unique approach to computing the data needed to create sound using granular synthesis. Al and Erwin (free) uses a postulate called Schroendinger's Equation as a model to generate control information. If you aren't up on your quantum mechanics, Schroendinger's Equation defines the probability that an electron will be in some position around the nucleus of an atom. It's the concept of probability that is used to control the various parameters of your sounds — for example, the likelihood that a grain of a certain length and frequency will occur at a certain time.

When you first open a new document, you'll see a blank workspace on which you create Events. Click and drag the mouse on the screen, and a rectangle will appear that represents an empty Event. The width of the rectangle determines duration, and its horizontal position determines its location in time (the height of the Event is not relevant). You can move or resize Events after creating them and, in theory, have as many Events on the screen as you need.

Each Event can be “associated” with an existing WAV file, so you can use the software simply as a mixing tool. But the real fun comes with Erwin (Schroendinger's first name), a plug-in that is used to access the granulation features of the program.


Erwin offers four tabbed screens (and an About screen) that provide access to the grain-generation parameters. Granular synthesis involves the creation of numerous very short segments of audio either derived from a preexisting audio file or synthesized on the fly. Erwin uses the former approach and will chop a sound file into many thousands of pieces using the parameter values you supply.

You can define a number of global settings for the overall mass of sound (which Erwin calls a “grain cloud”) and also work at the level of the individual grain. At the global level, there are settings to control the density of the cloud, move the grains through space (including a Doppler control), and determine the size and duration of the analysis window that is used to extract the amplitude envelope of grains from your sound file. Some of the options are intuitive, such as using the density of the input file to control the density of the grain cloud. But you can very easily move into some complex math, as when using the more advanced distribution curves to calculate the grain cloud's density.

Other global parameters let you set a range within which the cloud's frequency will be transposed over time — you can use either ratios or semitone increments — and there's also an option to vary the cloud's amplitude. The cloud can be equal to, longer than, or shorter than the original file.


Working at the level of individual grains is like performing microsurgery, but the variety of available parameters can alter the resulting sound in significant ways. Manipulating the Grain Duration parameter, for example, allows you to retain recognizable chunks of audio from your original file or completely obliterate any references to it. More subtle is the Transition Interval parameter; it determines what amount of time (represented as a percentage of a grain's total duration) that a grain will move in a particular direction.

You can introduce a high degree of randomness in the movement of grains by setting a high value for the Maximum Scatter Jitter parameter and set minimum and maximum values to which a grain will be transposed. A user-adjustable 6-stage linear amplitude envelope (accurate to four decimal places) is applied to each individual grain by default, but you can use a number of other preset envelope shapes if you prefer.

When you're done setting parameters, click on OK and Erwin will calculate the distribution curves that control grain-generating parameters. It then displays colorful plots of your control data that cry out for graphical editing (see Fig. 2); but alas, you must return to the previous screens to make any adjustments.


To hear the new file, press any key, and you are returned to the main screen where you can choose to play all Events or only selected ones. Positioning Events and adjusting their gain and fades is simple, which makes Al and Erwin very useful for mixing tasks. I experienced some problems with the Duration parameter in the Event Properties dialog — Events shrank to an unreadable size when I increased their length. But other than that, the software performed as advertised.

Though it's easy to get good results by using the presets or minor variations thereof, it will take many hours to master and be able to predict the result of some of the more esoteric features. That's not necessarily a bad thing; just be sure to devote an adequate amount of time to exploring the program's many options. Whether you mastered physics in school or not, give Al and Erwin a try.


Digital Expressions' ArtSong ($59.95) offers a vast number of algorithms that can be applied to a variety of musical parameters. The program is laid out somewhat like a sequencer, with tracks and other program elements arranged vertically along the left side of the screen and data arranged on a time-line to the right (see Fig. 3). To generate new music or process existing data, you insert one or more Components into a project — these can be as simple as an arpeggiator with only a few parameters or as complex as a Julia fractal image from which more than a dozen parameters are extracted. You then press the Compose button, and ArtSong will create a composition according to your specifications.

Each of the Components allows you to fine-tune its operation and/or output. You can use pattern generators to create melodic riffs or looping drum tracks or any of the Arrange Components to help control the overall form of your piece. The Arrange category also includes options for generating your music's texture algorithmically. For example, you can determine how many different textures will be used and how often the music will change from one to another. Other Arrange Components allow you to create a process whereby the existence of notes in one track determines whether notes in later tracks are generated. You could use this, for example, to automatically build harmonies from a single-note melody.

The Text Mapper will take a plain text file and convert it into numbers that can be used for almost any purpose, and all of the Meter algorithms will add variety to the note values and accents in a track. Under the Melody/Harmony tab you'll find Components that can alter individual or groups of tracks — use them to define constraints on the notes that you will allow in your melody or to create a set of keys and scales that you want the program to use.

If you prefer, you can apply algorithmic processes to data in an existing MIDI file. For example, load a MIDI file (Type 1 only) with a simple melody on track 1 then apply the Canon Component, and ArtSong will create a countermelody in no time. You can use the Invert or Mirror option to make variations on your new melody or instruct the program to deviate (from 1 to 100 percent) from your original in its selection of notes. You can also combine Components for even more radical transformations; for example, you could use a Melodic Contour Component in conjunction with the Canon.


Being a visual person, I found the Image Mapper algorithm to be especially useful. I set up a track assigned to a timpani patch, then loaded nearly a dozen images in sequence to hear the effect they would create. Using only the default settings, each image resulted in a variation on an aggressive, syncopated rhythm. You can hear an example in the file ArtSong_Image_Mapper.mp3 at the EM Web site.

Some of ArtSong's parameters have only sliders, which makes setting their values awkward (most allow text entry). And a few elements of the interface aren't as intuitive as they might be. But there is context-sensitive help to keep you going, along with numerous tutorials aimed at both beginning and advanced users. Additional user-supplied tutorials are available at the developer's Web site, where you'll also find details on how to create custom algorithms (some programming knowledge is required).


Nyr Sound's Chaosynth (free) is a unique application that generates synthesized granulated audio or MIDI note data using control information derived from cellular-automata (CA) principles. CA consists of a dynamic grid somewhat like a checkerboard containing an array of “cells.” The status (on or off) of any particular cell is determined by the state of its neighbors: a cell in row 3, column 5 might be deemed “on” if the cells in some fixed number (say three) of the previous columns were on, but deemed “off” otherwise. The status of the cells in column 5 would then determine the status of the cells in column 6, and so on.

When applied to the generation of graphics, the status of a cell could determine whether there was a pixel on the screen or not and what its color might be. This is the type of result that you'll find in Mirek's excellent (and free) CA graphics program, Cellebration ( In Chaosynth, the status of cells is used to determine which frequencies the program chooses when synthesizing a waveform.


Chaosynth's main interface consists of eight tabbed screens and several controls that appear regardless of which screen you are in (see Fig. 4). There are numerous aspects of the program that affect the sound output, and a survey of them all is beyond the scope of this article. Among the most important, however, are those found in the Frequencies screen and the Oscillators screen.

Unlike some Chaosynth parameters, the adjustments you make to parameters of the Frequencies and Oscillators screens update in real time. This makes Chaosynth feel and act very much like a software synth. On the Frequency page, you'll see a window on which you can enter data for the frequencies of up to 64 oscillators. First press the Note On button and select WAV output (as opposed to MIDI) to start playback, then sweep around on the screen with your mouse, and the program will instantly generate audio reflecting the new data you enter. (If you have a slow machine and the program starts to choke, you can lower the number of oscillators or the sampling rate.) You can save specific settings as presets as well as change the base waveshape of the sound (sine, square, sawtooth, triangle, or noise) on the fly.

The Oscillators screen contributes the pool of amplitudes that will be available for selection by the program and works independently of the Frequencies control. For example, you could have only two amplitudes available for all 64 frequencies. As with the Frequencies, you can create two different sets of values and have the program interpolate between them.

Among the other main options are a functional (but limited) reverb effect, a filter, a four-segment envelope, and a feature that modulates the pitch of the generated sound. Like other features, these can be mapped to MIDI controllers for real-time control. The program also offers functions that control the cellular-automata processes at work and can generate an animation of the cells that are creating the data. You can choose to view the animation as the program plays and save it to disk in AVI format.


Chaosynth can produce both audio output (with up to 24-bit, 96 kHz resolution in mono or stereo) and a MIDI file containing a quantized MIDI-note version of the “results” of any given work session. Be forewarned that the MIDI files contain a huge amount of data, often on many tracks. But I've had great luck orchestrating such files and playing them back in sync with the audio version.

As we went to press, a VST instrument version of Chaosynth was in late beta. The plug-in accepts real-time MIDI note data to determine the base frequency of the waveforms produced by the software and includes several effects. It looks to be one of the most interesting tools for sound generation to come along in a while.


FractMus 2000 (free), from developer Gustavo Diaz-Jerez, uses a control-data generator that is easier to understand than many of the others. Put simply, you choose one of its 12 basic algorithms to determine the pitches of each of up to 16 voices, then let the program create a new composition that applies your settings to various musical parameters.

Each algorithm uses a different type of number theory to do its thing. For example, the algorithm entitled 3n+1 (also known as Hailstone Numbers) uses an intriguing process that always concludes when the number 1 is reached. The rules are as follows: Start with any whole number, and if it is odd, multiply it by 3 and add 1. If it is even, divide it by 2. Keep going until, inevitably, you reach the number 1, then stop. Depending upon what number you start with, there may be a huge number of steps before your reach 1 or just a few. The values derived at each step are used to control the pitch selection for each voice. (You can read about the algorithms at the developer's Web site without downloading the program).

Among the other algorithms are a pseudo-number generator that will produce an entirely random set of values within the range of 0 to 1; various fractal generators; and 1/f noise, a naturally occurring “pink” noise characterized by an even distribution of power when frequency is mapped in a logarithmic scale (that is, the power between 100 Hz and 200 Hz would be the same as between 1,000 Hz and 2,000 Hz). There's also an algorithm that uses cellular automata to generate values and one that employs chaos theory.


Once you pick an algorithm, you have the option to modify its parameters and view a graphical representation of the data plotted over time (see Fig. 5). You can also hear an audio preview of the pattern the algorithm will generate, though you have to return to the main screen to hear the pattern playing in context with the other tracks.

Each voice includes a number of other parameters, including Offset, which will delay or anticipate the playback of that track, and Modulate, which allows the voice to change keys during playback. You can choose whether modulations will occur randomly or at some fixed interval, say, every 50 notes. You can also choose a patch for each voice, assign it to a MIDI channel, give it a default volume level, and determine whether it will play repeated notes or not.


If selecting parameters for individual voices is too much for you, you can use the Composition Randomizer to create a complete composition from scratch. Using the default settings to create a piece with absolutely no user input won't get you much — just a single-voice melody that will probably include stretches of silence. But by altering just a few of the settings (adding more voices and randomizing all the voice parameters, for example), you will begin to hear some interesting results. The MP3 file FracMusic.mp3 at the EM Web site uses random settings for every parameter of its six voices.

FractMus is very serious about its math and even includes a link to the Windows calculator for your adding and subtracting pleasure. Among its many other talents, it will create a visual image of your composition. Images can't be saved, and the images created from many of the example files looked similar, however. The Help file is mostly thorough and a large number of example files are included. Unfortunately, there are no tutorials. The program's developer has created a large number of compositions that are available at his Web site — their range and variety is quite impressive. You'll also find a number of user contributions in many styles among the included examples.


Algorithmic Arts' SoftStep ($199) is the only program in this roundup that will accept and manipulate real-time MIDI input. This makes it suitable for live-performance situations, and indeed, there is a lot that would work well at a gig. The software offers dozens of data-generating and -processing modules that you can hook up in an infinite number of combinations and provides several dozen examples to get you started. SoftStep has extensive graphics capabilities, including the option to read in an image and extract data from it and the ability to generate images algorithmically. At press time, the developer released a new program, called ArtWonk, that expands on these features in dramatic ways.

Like Native Instruments' Reaktor or other modular synth-building toolkits, SoftStep opens as a blank screen onto which you place the various modules that you'll use in your design. Right-click on the screen and you'll see a drop-down menu containing 20 categories, each of which breaks out to many more individual routines (see Fig. 6). There are display elements such as sliders, faders, and knobs to which you can assign a specific range of values; clocks, pattern generators, and random processes; modules that manage and mangle every type of MIDI event imaginable, and much more.

Rather than using “patch cords” to connect the various modules, SoftStep's Connect window displays a list of all the modules currently onscreen, from which you select the source of a hookup. The Connect screen also includes a number of default options, such as MIDI controller numbers, the values 0 through 127 (which you can use as constants), On and Off, and a list of sliders.

Speaking of sliders, there are 9 modules that offer from 4 to 128 sliders each. You can set the positions of the sliders manually or use the handy Fill feature to assign values to the sliders in a vast number of ways. You can generate values using several different random distributions; invert, normalize, scale, and reverse existing slider data; quantize the sliders to a variety of major and minor scales; and more. You can also restrict values to a high and low range and store up to five different slider configurations.


Among the most unusual data-generating modules is SoftStep's Bouncing Ball. The interface for this module is an animated ball, and when the ball hits the side of its frame, a trigger is sent out. The trigger can be used by any other module that is loaded; for example, it could initiate a program change in one module and generate a MIDI note in another. You can resize the frame to slow the time between successive triggers or “process” the Ball's output with a Ball Control module, where both its duration and output value can be manipulated.

More traditional modules include a variety of clocks (Free Run, Arpeggio, Stepper, and the like), math and logic functions, a large number of random-data generators and processors, and modules to read in data from external sources. Matrix modules, found in the Sequencer category, are especially useful for generating data. In addition to assigning values to the various rows of knobs manually and using the Fill feature, you can use the Matrix modules to generate numbers using cellular automata. You can also create your own function generators using the User Controlled Functions feature.

Be careful, as there is no Undo command for many operations — inserting a new module, for example. But that's one of the few missing features in this massively powerful program. And though building simple processes is mainly an intuitive endeavor, there's lots of support in the form of tutorials and electronic documentation to take you to more advanced levels.


Algorithmic composition is a fascinating field that can generate an unlimited amount of musical material. But using one of these programs is no guarantee that you'll come up with hours of great music. Rather, in some cases, you'll have to dig in and learn how to control the features of these programs just so you'll have a clue as to what kind of music will result. But take the plunge and try one or more programs and see if you can't make it work for you. Take a chance — what do you have to lose?

EMassociate editorDennis Millerhas decided to let his computer write his next symphony. Check back in a few minutes to hear the results!


Algorithmic Arts

Digital Expressions
tel. (920) 733-6863

Gustavo Diaz-Jerez


Nyr Sound

Rajmil Fischman

More in Store

This article includes only a small sampling of the many algorithmic-composition programs available on modern computing platforms. Here are a few additional programs to consider and some Web sites that can serve as portals to other software. Also be sure to explore the many random and algorithmic processes available right on your desktop. Many programs, such as Native Instruments Reaktor and Symbolic Sound Kyma, allow you to use various types of automated procedures, including some that select randomly from a group of audio files for processing and others that play back the notes of a sequence at random.


AC Toolbox (Mac)
If you have time on your hands, check out this robust composition system.

Bol Processor BP2 (Mac)
Bernard Bel's powerful (and complex) composition system is available for download, though it doesn't appear that the program has been updated in recent years.

Cellular Grid Machine (Mac)
In the composer's own words: “Cellular Grid Machine is a [software] machine that spits out music. It asserts its personality and prescripted method onto the music.” Also check out the developer's Oscillator Music Machine.

KeyKit (Win)
Tim Thompson's unique “composition environment” includes tools for generating and processing MIDI data and graphics algorithmically.

Koan Pro 2.7 (Mac/Win)
Though not currently in active development, this seminal program is still available commercially. Brian Eno is among its biggest fans.

Lexikon-Sonate (Mac)
Computer-music wizard Karlheinz Essl wrote this amazing program, which generates music according to a variety of parameters you supply. The interactive version runs under Cycling '74's Max, but other versions (Java and Perl) can be used to generate random Web sounds. Check it and a number of other fanciful music-making tools out at the composer's Web site.

Nick Collins
British composer Nick Collins has explored the use of algorithmic principles in dance music. Collins's article “Algorithmic Composition Methods for Breakbeat Science” is available at the composer's Web site, along with several musical examples that implement his techniques using Csound. See the Code and Papers sections in particular.

Repercussion (browser applet)
You can fairly well predict the music these “instruments” will make, but you won't find a more unusual interface anywhere.

Silence (Win)
Michael Gogin's powerful composition system includes numerous tools for creating music algorithmically.

Thonk_0+2 (Mac)
This granular-synthesis program will generate music with no assistance whatsoever from the user. You take your chances!


A Brief History of Algorithmic Composition
Lots of links and references are included with this interesting article.

Composition with Algorithms
Chaos theory, fractals, neural nets, and other approaches to algorithmic composition are included at this site.

Fractal Vibes
A good starting point for exploring various types of generative music software.
This site focuses on the research aspects of generative graphics and music.

Music and Artificial Life
Read about how various composers have used generative processes to compose music. Many of the links at this site include downloadable software.

This site includes links to other sites as well as a number of articles on composing music with algorithms.
This site offers an excellent list of tools that use fractals and number theory to generate music.