Monday, April 27, 2015

Composing With Strange Circles

As described in this previous post, the  text below is a draft of one of several "interludes" to be included in a book that I am working on concerned with music and artificial neural networks.

This post provides a working java program for hearing different combinations of strange circles; the program is described below and is available for free as a Java jar file at this location: http://www.bcp.psych.ualberta.ca/~mike/BlogStuff/Circles/StrangeCircles.zip. 

Also, this post is a revised version of this previous post on this blog.  The text is a bit different; the big difference is that at the bottom of this blog I provide a java program that lets you compose with a variety of strange circles and hear the results.  Feel free to download the program and play with it.  If you have any difficulties please leave a comment; this is my first attempt at distributing code in this fashion and I would be surprised if I don't make some mistakes.  To run the program, download the zip file, unpack it, and double-click on the .jar file's icon.  You need to have Java installed on your program for this code to function.


Figure I-8. The first four bars of an atonal piece composed with some strange circles found within musical networks.  See text for details.
 

Atonal music has no discernible musical key or tonal center because all twelve pitch-classes from Western music occur equally often.  Arnold Schoenberg invented a method, called the twelve tone technique or dodecaphony, for composing atonal music.  His 1923 piece Fünf Klavierstücke, Opus 23 was the first to be composed using this technique.
 
In dodecaphony one begins a new composition by arranging all twelve pitch-classes in some desired order; this arrangement is called the tone row.  The first note from the tone row is then used to begin the new piece.  The duration of this note, and whether or not it is repeated, is under the composer’s control.  However, once the use of this note is complete, dodecaphony takes control: the twelve tone method prevents the composer from using again until all of the other eleven notes in the tone row have first been used.  Their use, naturally, follows the same procedure used for the first note: the composer decides upon duration and repetition, uses the note, and then moves on to the next note in the tone row.  The final movement of Schoenberg’s Fünf Klavierstücke, Opus 23 was the first to be composed using a complete (twelve note) tone row in this fashion.
 
In the preceding chapter we saw that musical pitch-classes could be arranged in a number of different strange circles: for instance, four different circles of major thirds ([C, E, G#], [C#, F, A], [D, F#, A#], and [D#, E, G]) or two different circles of major seconds ([C, D, E, F#, G#, A#] and [C#, D#, F, G, B]).
 
We also saw that when artificial neural networks are trained to solve problems in harmony, they often use these strange circles to organize pitch-classes into different equivalence classes.  For instance, all of the pitch-classes that belong to one circle of major seconds may all be assigned the same connection weight (e.g. to the connection from a pitch-class input unit to a hidden unit).
 
In a musical network, the connection weight from an input unit to a hidden unit is essentially the ‘name’ that identifies the pitch-class.  If all of the pitch-classes belonging to a strange circle are assigned the same connection weight, then they are all being assigned the same ‘name’.  This means that the hidden unit is deaf to any differences between members of this subset of pitch-classes.  For a hidden unit that uses equivalence classes based on circles of major seconds, there are only two pitch-classes: some ‘name’ x (the weight assigned to C, D, E, F#, G#, and A#) and some other ‘name’ y (the weight assigned to  C#, D#, F, G, and B).
 
Why do networks use strange circle equivalence classes to represent musical structure?  One reason is that networks discover that notes that belong to the same strange circle are not typically used together to solve musical problems, such as classifying a musical chord.  Instead, the network discovers that combining notes from different strange circles is more successful.
 
This use of equivalence classes -- combining pitch-classes from different circles, but not from the same circle – suggests an alternative approach to composing atonal music.
 
Imagine a musical composition constructed from a set of different musical voices.  Each of these voices could be derived from a strange circle.  The notes sung by this voice are selected by randomly choosing from the set of pitch-classes that belong to the strange circle.  For instance, if one voice was associated with a particular circle of major thirds, then one could write its notes by randomly choosing one note at a time from the set [C, E, G#].  To make the voice more musically interesting, one could add a randomly selected rest to the mix by selecting from the set [C, E, G#, R] where R indicates a rest (i.e. no note is to be sung).
 
If one associated different voices with different strange circles, and composed via random selection as described above, then one would be following the general principle discovered by the network: pitch-classes from different strange circles can occur together, but pitch-classes from the same strange circle cannot.
 
Furthermore, one could use this method to compose atonal music by wisely choosing which strange circles to use to create different voices.  For instance, imagine creating a piece that included four voices, each associated with a different circle of major thirds.  This composition would be atonal, in Schoenberg’s sense, because the four circles combine to include all twelve possible pitch-classes.  Randomly selecting pitches from each of these circles would produce a composition that did not have a tonal center because each of the twelve pitch-classes would occur equally often when the composition was considered as a whole.
 
Figure I-8 provides a short score created by using the approach described above.  This score includes six staves, one for each voice.  Each voice is generated by randomly selecting from one strange circle (and including rests in this sampling procedure).  The top two staves, written in quarter notes, are each drawn from a different circle of major seconds.  The bottom four staves, written in half notes, are each drawn from a different circle of major thirds.
 
The score illustrated in Figure I-8 is created by applying two additional musical assumptions.  First, while each wheel generated a pitch-class name, I decided how high or low (in terms of octave) each note was positioned.  Second, in order to ensure that all notes tended to occur equally often in the score, I sampled the two circles of major seconds twice as frequently relative to the other four strange circles.  That is why the upper two staves use notes that are half the duration of those in the bottom four staves.
 
Figure I-8 provides the first four bars of a longer composition that can be found at this website: http://cognitionandreality.blogspot.ca/2013/03/composing-atonal-music-using-strange.html.  At the bottom of this web page one can find links that play some of the voices individually, some combinations of a small number of the voices, and all of the voices played together. 
 
On listening to these samples, one discovers that individual the strange circles are musical, but are not really musically interesting.  Music that is more interesting emerges from combining the random outputs of different circles.  For instance, I enjoyed the results of pairing the two circles of major seconds together.  I was also surprised at the musicality of the full composition.  My impression of this piece was that it is a modern, atonal composition.  I am no Schoenberg, but I humbly submit that composing music by combining strange circles provides an interesting and alternative method to dodecaphony.
 
Of course, there are other strange circles that could be incorporated into this approach to composing, such as the three circles of minor thirds or the six circles of tritones.  What kinds of atonal pieces can be created when many different strange circles are available?
 
To answer this question, I created a Java program that uses David Koelle’s music package jFugue (Koelle, 2008).  This package lets the programmer define strings of musical notes, and then takes care of playing them.  The program that I wrote lets the user choose a composition’s tempo and length with a mouse, and then make a checkmark beside every strange circle to be used in a piece.  All fifteen circles in Figure I-9 can be used at once!  The user can decide whether or not to include rests, and set the duration and the octave (2 is lowest, 5 is highest) for each set of circles.
 
A press of the compose button leads to a pause while the various voices are constructed, and then the piece is played through the computer’s speakers.  One can easily explore the possibilities of strange circle composing with this program and listening to the sounds that it creates.
 
This program is available for free as a Java jar file at this location: http://www.bcp.psych.ualberta.ca/~mike/BlogStuff/Circles/StrangeCircles.zip.  Save the zip file to your computer, move it to a desired location, and unpack it.  You will see a program called StrangeCircles.jar and a lib directory; these two items have to be in the same location on your computer.  To run the program from a command line, when you are in the proper location type: java –jar StrangCircles.jar.  On a windows machine, the program can also be run simply by double-clicking on the program’s icon after it has been downloaded.  The program requires that Java be installed on your program.
 

 



Figure I-9. A screenshot of a Java program that randomly selects from various strange circles to compose atonal music.  In the figure, one circle of major thirds, one circle of minor thirds, one circle of major seconds, and two circles of tritones have been selected to be used in a four bar composition that includes rests.  See text for details.

 References

Koelle, D. (2008). The Complete Guide to JFugue: Programming Music in Java: www.jfugue.org.