# A Machine to Compose Music

### John F. Sowa

Reprinted from a pamphlet distributed by the Oliver Garfield Company with GENIAC Electric Brain Kits during the late 1950s and early 1960s. The circuit described here won the prize for the best design in the 1956 GENIAC competition. One of the sample melodies composed by the machine was used in an advertisement that appeared in the September, 1956, issue of the Scientific American.

Since the functioning of the human mind may seem to be beyond analysis, the thought that a machine could compose music might seem absurd at first. However, by the use of statistical analysis and the application of information theory, such a machine could be built. In fact, an electronic computer which can compose melodies similar to modern popular songs has been built. On these pages, a circuit is described which will compose simple melodies. (See "Information Theory and Melody," by Richard C. Pinkerton, Scientific American, Feb. 1956). The necessary data from which the circuit was derived was obtained by the mathematical analysis of some simple tunes. For the sake of simplicity, I analyzed music in 4/4 time using only the first five notes of the scale with no eighth notes or accidentals. I secured music of this type from exercises in several piano books for beginners. On page 7 are some typical tunes composed by the machine; this music is reminiscent of the melodies originally analyzed.

The results of this analysis are compiled in the table on page 2. These tables give the probabilities of any particular note following any other in the tunes analyzed. After a note in the column at the left has been played, the numbers give the transitional probabilities to any of the notes at the top which may be played. There are four tables, one for each position of a note in the measure. The symbols C, D, E, F and G signify the first five notes of the C scale; the O represents a note held for more than one beat. At the bottom of the same page is listed the relative frequency each note appears in every position of a measure.

#### Page 3

From the tables on the preceding page, the chart on page four was developed. The notes which occurred most frequently were chosen for each position in the measure. A line extends from a note in one position to the most probable note in the following position. In some cases there are two lines from one note; one line is solid and an alternate possibility is dotted. In this chart there are some deviations from the pattern dictated by the tables on page two. These discrepancies occurred in order to provide more variety in the music or to simplify the circuit so that it could be more readily constructed with the GENIAC.

When there are two lines leading from one note in the chart, I used either of two different methods to decide between the lines. The first method is to flip a coin; heads, take the solid path; tails, the dotted one. Suppose we were to write a tune using this diagram. We shall start with a C in the first position. There are two directions in which we may go. If we flip a coin and it falls heads, the next note shall be an O. Therefore, our first note is a C and a half note. Similarly, if on the next two trials the coin would fall heads and tails respectively, we would have an E in the third position and a C in the fourth. Now, whatever side of the coin comes up, we would have a D in'the first position of the next measure, for there is only one way to go. On subsequent trials, if the coin would fall in the following manner, HTHTHTTHTH, the first line would be as follows:

The second method is to choose any random number, say 41. In the binary system, this would be 101,001. We may treat this the same as the flip of a coin, by using heads for a 1 and tails for 0.

#### Page 4

Diagram I

At the left is the number of the position of a note in each measure. After the fourth position in one measure comes the first position of the next. The solid lines lead from one note to a note in the next position; the dotted lines indicate an alternate choice. By means of this diagram, simple tunes of indefinite length can be composed.

#### Page 5

On page six is the wiring diagram for this machine; the deck positions are on page seven. As one can see, all six switches are used. Because of the complexity of the Present Position Switch, no connections to it are shown. Instead, the wires connected to it from four of the switches are marked in Qrder to show how they should be attached; the wires from these four switches should be connected to screws on the first and third circles from the center. Connections from the Last Note Switch should be made to all the corresponding screws in the rows marked (b) on the second and fourth circles from the center. For example, a wire from C on the Last Note switch should be connected to all screws marked C on the rows (b) in the second and fourth circles. In the same manner, connections from the lights should be made to all the corresponding screws in the rows marked (a) in the second and fourth circles.

If we were to begin composing a tune using this machine, we would set the Last Note Switch on C, which would be the last note of the preceding tune, and the Present Position Switch on one. We would set the First Position Switch on either H or T, depending on whether the coin fell heads or tails. If the coin falls heads, the light under D will light. We record this and set the Last Note Switch on D, the Present Position Switch on two, and the Second Position Switch on either H or T depending on our coin. In larger computers, rectifiers or other devices would be employed. However, since this machine lacks such devices, when we are using the second position, for example, the First, Third, and Fourth Position Switches should be in a neutral position to prevent two or more bulbs from lighting simultaneously.

#### Page 6

Wiring Diagram

[Exercise for the reader: This diagram, which was redrawn by the Oliver Garfield Company, omits a critical connection. Where should it be?

Hint: It is a short wire on the Present Position Switch.]

Sample Tunes