Computer Pitch Techniques
in Musical Composition

Christopher Dobrian

University of California, Irvine, USA


Composers are constantly making decisions, not the least of which is to determine which pitches should be played. In contemporary music there seem to be at least as many techniques of pitch selection as there are composers.

While many composers and programmers have found it interesting to use the computer to enact established pitch selection techniques such as tonal composition or serialism, the computer more importantly presents the possibility to devise new types of musical organization not previously used. Indeed many interesting types of pitch organization are realizable only with the aid of a computer due to their complexity, level of abstraction, or amount of calculation required. Still other methods of pitch selection and organization can be suggested by the very nature of computer memory and programming, and would probably never have been conceived without the existence of computers.

This article discusses four such methods, which the author has devised and employed in the composition of complete works. Two of the methods rely on probabilistic computer decision-making. The other two methods are deterministic, but are achievable only using a computer, due to the complexity of calculation necessary. The four methods are here designated 1) stochastic transformation, 2) evolution by genetic algorithm, 3) transition by computer address, and 4) continually variable tuning. Explanations of their conception and implementation are presented below.

Stochastic Transformation

The first and simplest method involves the use of first-order probabilities to make an exponential transition from one weighted pitch set to another. This technique is similar to ideas expressed decades ago by Iannis Xenakis (Xenakis, 1972), although it is not directly derived from those writings.

In a weighted pitch set, each element of the set of possible pitches is ascribed a probability of occurrence. A computer can then make weighted random choices from this set, and the frequency of occurrence of each pitch in the resulting musical passage will correspond to that weighting. (A "passage" can contain any number of notes the composer desires. The probabilities the composer desires are realized more accurately as the number of notes in the passage increases.)

This method has been implemented in such a way that the computer calculates probability weightings at each instant by interpolating between a beginning set and an ending set specified by the composer. The composer assigns probability values to each pitch - one set of probabilities for the beginning of a musical passage, and another set for the end of the passage. (These beginning and ending probabilities are stored as arrays in the computer memory.) The composing algorithm then composes melodic phrases of any length by a) calculating an array of instantaneous probabilities (likelihoods of choosing a given pitch at that instant) by mapping a point on an exponential curve between elements of the starting array and ending array, b) making a stochastic choice of pitch, based on those instantaneous probabilities, and c) incrementing toward the ending point and repeating the process. Because the input description is stated in terms of relative probabilities of different musical occurrences, the composer can easily describe music which ranges between totally predictable (negentropic) and totally unpredictable (entropic), and which can transform gradually or suddenly from one to the other. This method was originally conceived as a vehicle with which to explore concepts of information theory and stochasticism in an artistic way.

Musically this technique demonstrates the use of stochasticism not only as a model for the distribution of sounds in time, but also as a method of variation of a harmonic "order". For example, one can modulate from one "key" (pitch set) to another by means of a "probability crossfade". During the period of transition, both sets are present to some degree, and a new, more ambiguous set is evidenced. This sort of modulation can also be done between highly predictable (uneven) weightings and unpredictable (evenly distributed) ones, so that the degree of entropy itself becomes the means of varying the pitches in a passage. This idea is the focus of the composition Entropy for computer-controlled piano (Dobrian, 1994).

Evolution by Genetic Algorithm

The second method is derived entirely from ideas of computer science, and is a musical manifestation of a computation technique known as the genetic algorithm (GA). In a GA, possible solutions to a problem (in this case, what chord or pitch set to play) are represented in the computer as streams of binary digits (e.g., 1 or 0 representing the presence or absence of a pitch). In GA terminology, each bit stream is a chromosome, and the set of bit streams is a population. The bit streams are "mated" by taking some of the bits from one stream and replacing them with corresponding bits in another stream, thus generating unique new offspring which consist of characteristics of both parents. An offspring might be slightly mutated occasionally (just as unpredictable mutations occur in genetics) by randomly flipping one of its bits. By this means, many new potential solutions are generated. These new bit streams are evaluated by a fitness algorithm, and the fittest bit streams are then used to procreate the next generation. Over generations, the population contains members that are rated more and more highly by the fitness algorithm.

A pitch set or pitch class set can be described as a binary stream, with each bit representing the presence or absence of a pitch. A weighted set can be represented as a population of such sets. These sets are mated and mutated by simple algorithmic processing of the bit streams (bitwise crossover and bit-flipping), and new populations are thus generated. If a certain target pitch set is used as the fitness measurement for offspring in an evolving population, and pitches and chords are continually chosen from the existing population, then over time, this creates a gradual modulation from one type of population (one harmonic setting) to another.

This technique has been used in the composition Unnatural Selection for improvising musician and computer-mediated synthesizer. The computer plays notes on the synthesizer, choosing chords and melody pitches from a population of possibilities. The population is continually evolving (by the GA techniques of recombination of bit streams and occasional random bit-flipping mutations), and the notes most recently played by the human improviser are used as the fitness criteria to shape the next generation. Thus, the population of computer choices is constantly evolving toward what the improviser plays.

This algorithm is very effective for producing a distinctive type of modulation and variation. Choices made by the computer can be somewhat unpredictable - recombinations of pitch sets can result in some unforeseen chords, for example - yet almost never incongruous, because any new solutions that the computer generates are derived explicitly from previous material.

The two methods described so far - stochastic transformation and evolution by genetic algorithm - were designed to explore computer decision-making in the composition and improvisation process. The next two techniques do not contain any element of indeterminacy, but are nevertheless unique thanks to the capabilities of the computer.

Transition by Computer Address

The third method is a direct morph from one unweighted pitch class set to another, with each element of the first set moving to become a corresponding element of the second set. Once again the pitch set at any given instant is determined by interpolation between starting and ending sets provided by the composer. Rather than interpolating chromatically, however, the elements of the set move according to a prescribed path of transition. This path can be any ordered set of pitch classes (of which the chromatic scale is only one possibility), and the construction of the path affects the harmonic "flavor" of the transition from one set to another. For example, a path made up of a circle of fifths sounds different from a chromatic scale.

Transition by chromatic scale

Transition by circle of fifths

The example above shows two varieties of modulation from one pitch class set to another, using different paths of transition. The beginning and ending sets in this example are a C major scale and an A-flat major scale, respectively. The elements of the set are in arbitrary order. The first chart shows a transition from one key to the other using a chromatic scale as the path of transition (i.e., the elements morph from one set to the other in semitone increments); the second chart shows a transition in which the elements morph by perfect fifths (i.e. via a path of the circle of fifths). The pitch class set in use at any given instant is determined by what pitch classes are present (vertically) as one moves from left to right (from C to A-flat).

The intermediate pitch class sets that occur as a result of this transition method do not necessarily have a construction similar to the starting and ending sets. (In the above charts, for example, the intermediate sets are not simply major scales.) They may introduce elements that are not present in either the starting or ending set, and may be considerably more or less chromatic. However, it is significant that the systematic consistency with which the intermediate sets are derived lends them a sense of intentionality and progression that the ear can follow and appreciate.

This modulation is made computationally simple by referring to the computer array address of each element in a set rather than to the pitch class itself. In determining the intermediate sets, each element is identified by its address on the path array, and this address value is simply incremented or decremented to move the element along its path of transition. Thus, a linear change in the address value results in movement along a (possibly non-linear) path of different pitches.

This idea of transition by indirect reference, making possible a nonlinear path from one set to another, would not have been discovered without attempting to implement this system in the form of a computer program.

In the work ETC for harp and computer tape, this algorithm was employed with seven-element pitch class sets (as in the example given above) appropriate to the capabilities of the harp. The algorithm was used to constrain the pitch choices made by a more complete composing algorithm. The composing program designed melodic contour patterns, and the actual pitches were chosen by finding the nearest pitches that were a member of the pitch set in use at that instant.

Continually Variable Tuning

All of the above methods assume a limited set of possible pitches, as in our commonly used chromatic and diatonic systems. However, when the composition is of computer-synthesized sounds, there is no necessary limitation to the pitches used. One can use continuous pitch variations (glissandi, vibrato, bending, etc.) or any type of mathematical division of the octave into a specific number of fixed pitches (experimentation with different tunings systems). Most composition with alternative tuning in computer music has been either with a) fixed pitches tuned to some set of pre-determined frequencies other than the standard equal-tempered twelve tones per octave or b) notes of changing pitch gliding continuously from one frequency to another according to an arbitrary curvature.

There is yet another possibility that is much less often explored: fixed pitches tuned according to a formula or set of rules that is constantly changing. This can result in a wide variety of fundamental frequencies, in patterns unlike any single established tuning system, yet still musically coherent because of the systematic integrity of the process by which the tuning of each note is derived.

So, a fourth technique, available only with computer and inspired by computer capabilities, is to divide a continually changing arbitrary frequency range into any number of discrete steps, and use those steps as a (temporary) scale or pitch set. This can result in any number of unforeseen tunings - continually changing-with very interesting effect, provided that the musical structure provides some of the coherence given up by the absence of a fixed tuning. By placing a recognizable melodic contour pattern within different frequency ranges, one can retain classic motivic techniques while infinitely expanding the tonal possibilities of such techniques.

One implementation of this idea is employed in the composition Degueudoudeloupe for computer tape. The computer chooses from a set of extremely recognizable melodic patterns (e.g. upward arpeggio, downward arpeggio, upward zig-zag, downward zig-zag, etc.), and chooses a number of notes for each pattern. This results in recognizable melodic motives which are varied in length.

The variable length of the motivic patterns is one method of variation in the piece, but the other primary method of variation is that the pitch range in which they occur is constantly changing. (In fact, the patterns are further varied by insertion of rests and ties, and by changes of tempo, but it is the change of pitch range that concerns us here.) A passage of any number of notes is composed by the computer in the following manner. The frequencies of the notes are chosen by a) interpolating, according to a linear or exponential curve, the upper and lower limits of the (log) frequency range, between given starting and ending points, b) segmenting the available range into the proper number of steps to execute the desired melodic pattern, c) assigning a frequency to the note according to its location in the current pattern and range, and d) incrementing the appropriate rhythmic value to the next note onset time and repeating the process. An example passage-using a four, five, and six-note upward zig-zag pattern within a descending and expanding frequency range-is shown in the following figure.

Melody in a changing range

This example shows the composition of a single melody line with a constant rhythm. The motives are clear, the change in tuning is also constant and clear, but the tuning itself is constantly changing in a systematic, coherent, yet quite novel manner. With the addition of contrapuntal melodies occupying differently-changing frequency ranges, the tuning system can become even more complex, yet remain comprehensible to the ear.


The four methods described here represent but a few of the many possible ways composers can expand the tonal world of music using the computer. These examples demonstrate the utility of such techniques for both instrumental and synthetic composition, and it is hoped that they will encourage other composers to develop new ideas in the area of pitch and harmony using the computer.


Dobrian, C. (1994) Entropy. Intercambio/ exchange (compact disc), CCRMA/CRCA/LIPM.

Dobrian, C. (forthcoming) Unnatural Selection and Degueudoudeloupe. Artful Devices (compact disc), EMF.

Xenakis, I. (1972) Formalized music; thought and mathematics in composition. Indiana University Press, Bloomington. (Previously published as Musiques formelles, Paris, 1963.)