Sunday, April 19, 2015

Riemannian Tonics and Symmetry

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.

Figure I-6. Connection weights from input pitch-classes to two different output units (D and D#) in a network trained to identify Riemann’s roots for major and minor triads.

Hugo Riemann (b. 1849, d. 1919) was one of the most important music theorists (Rehding, 2003).  Riemann was strongly influenced by the natural science of music that flourished in the 19th century (Burnham, 1992; Hui, 2013), such as the prototypical and pioneering work of Helmholtz which was introduced in Chapter 1.  Riemann’s goal was to provide the natural laws that governed music; he argued that these laws are rooted in musical harmony (Riemann, 1895).  For Riemann, an understanding of the logic of harmony was tantamount to an understanding of the universal structure of music.

In his own analysis of harmony, Riemann was particularly interested in the triad.  In modern musical theory a triad is a three note chord that is built upwards from a tonic note.  For instance, the A major triad is built upon the tonic A, and includes C# (which is a major third higher than A) and E (which is a minor third higher than C#).

A minor triad can be described as a distortion of a major triad.  In general, one creates a minor triad by lowering the middle note of a major triad by one semitone.  For instance, to produce the A minor triad, one takes the A major triad [A, C#, E] and lowers the middle note to create the triad [A, C, E].  Another way to consider a minor triad is that it too is built upwards from a tonic, but using different musical intervals.

Riemann conceived triad structure in a different fashion.  He proposed an idea known as harmonic dualism.  According to harmonic dualism, major and minor triads are constructed from processes that are identical in structure.  However, these processes are opposite in direction.

Harmonic dualism conceives of major triads in the same way as modern theory: by building upwards from a tonic with a note that is first a major third higher than the tonic, and then another note a minor third higher than this middle note.

However, harmonic dualism departs from modern theory in its conception of minor triads.  Harmonic dualism highlights structural symmetry between minor and major triads.  According to Riemann, minor triads are built downwards from the tonic using the same procedure used (in an upwards direction) to create a major triad.

For instance, consider the minor triad [A, C, E].  For Riemann, the tonic of this triad is not A, but is instead E.  To create the triad, one first adds a note a major third below the tonic, and then adds a second note a minor third below the middle note.  Riemann would not call this triad A minor; instead he would call it ‘under E’ or °E.  Furthermore, its symmetric structure decreases its relationship to one major triad (A major) and increases its relationship to another (E major).  E major and °E both start from the same tonic, and have identical structure one as moves away from this tonic.

Harmonic dualism assigns different tonics to the minor triads than are assigned by modern music theory.  Table I-1 provides each approach’s tonics for the 12 major and 12 minor triads.

Table I-1 provides two qualitatively different theories about the tonic notes of triads.  How might the differences between these theories be reflected in network structure?  Is modern theory harder or easier for a network to learn than is harmonic dualism?

To explore such questions, perceptrons can be trained to identify the tonics of input triads.  This requires 12 input and 12 output units.  The input units use pitch-class representation to encode the three component pitch-classes of a triad, and the output units use pitch-class representation to encode the triad’s tonic.  The output units are all value units, and each has its ยต set to 0, and a learning rate of 0.01 is employed.  Two different training sets are used to teach two different types of perceptrons: one that uses the Riemann tonics of the input triads, the other that uses their modern tonics.

Both training sets are learned very quickly: the Riemann tonics require an average of about 73 epochs of training, while the modern tonics are acquired after about 65 epochs of training.  This difference is not statistically significant.

Harmonic dualism enforces symmetric processes for constructing major and minor triads.  As a result, one constructs °D in exactly the same manner as one constructs D major, except in opposite directions.  This symmetry of structure is elegantly evident in the connection weights of a perceptron trained to detect the Riemann tonics.

Consider the left hand side of Figure I-6.  It plots the connection weights from each of the 12 pitch-class input units to the output unit that detects the Riemann tonic of D.  Note the beautiful mirror symmetry of connection weights as you move either to the left or to the right from the D input weight.

How does the output unit use these weights to detect a Riemann tonic of D?  The only positive connection weight is associated with the input pitch-class D, shown in black in the graph.  The output unit will only activate when the signal sent through this positive connection weight is cancelled out by two signals sent through negative connection weights.  Only two pairs of signals accomplish this: signals from A and F# (which combine with D to represent D major) and signals from A# and G (which combine with D to represent °D).  These four connection weights are also shown in black.  All of the other connection weights are so extremely negative that they turn this output unit off if any of their associated pitch-classes are present.

Because the symmetric pattern of connection weights emanates outwards from either side of one weight (e.g. from the left or right of the weight for D) there must be one pitch-class that breaks this symmetry.  In this case, it is the weight for G# which is shown in white in the figure.  Importantly, this outlier weight corresponds to the pitch class that is a tritone away from D.  This means that if one was to wrap the x-axis of the graph in a circle (i.e. the circle of minor seconds), the connection weights would be perfectly symmetric across the diameter from D to G# which cuts this circle in half.

Essentially the same pattern of connection weights is found in this perceptron for the other output units.  The only difference is that the pattern is shifted to be centered on a different output unit.  This is illustrated on the right side of Figure I-6, which illustrates the weights of the connections that feed into the output unit for D#.  It provides the identical pattern as shown on the figure’s left, but the pattern has been shifted one pitch-class to the right.

The wonderful symmetry in the Figure I-6 connection weights is completely consistent with the symmetry that is the foundation of harmonic dualism.  Such symmetry -- perhaps sadly -- is not found when a perceptron is trained to generate the modern tonics of triads, as can be seen from the weights illustrated in Figure I-7.


Figure I-7. The connection weights from the input units to the output unit representing the tonic D in a perceptron trained to detect modern tonics.
Figure I-7 provides the connection weights that feed into the D output unit of a perceptron trained on modern tonics.  Its bars are colored according to the same scheme used in Figure I-6: black bars show pitch-classes involved in turning this output unit on, grey bars show pitch-classes involved in turning this output unit off, and the white bar is associated with the pitch-class a tritone away from D.  These weights function in a fashion similar to those of Figure I-6: A signal from D and two other input units produce a net input close enough to zero to turn the output unit on.  The combinations are [D, F#, A] for D major and [D, F, A] for D minor.  This identical pattern is found for other output units, once again shifted along the x-axis.

The symmetry that is present in Figure I-6, and missing from Figure I-7, is enchanting.  There are clearly additional properties to be gleaned from the Figure I-6 weights that involve considering the relationships between pairs of pitch-classes that are assigned the same weight.  These relationships, for instance, could be considered in the context of Riemann’s theories about tonal relationships.

In short, training networks to detect regularities defined by opposing musical theories provides a new paradigm – network interpretation – that could be applied to consider their advantages and disadvantages.