ALGORITHMIC STOCHASTIC MUSIC

by

ALEX COOKE

Submitted in partial fulfillment of the requirements for the degree of Master of Science

Departments of Mathematics, Applied Mathematics, and Statistics

CASE WESTERN RESERVE UNIVERSITY

May 2017 CASE WESTERN RESERVE UNIVERSITY

SCHOOL OF GRADUATE STUDIES

We hereby approve the thesis/dissertation of

Alex Cooke

Candidate for the degree of Master of Science

Committee Chair

Wojbor Woyczynski

Committee Member

Wanda Strychalski

Committee Member

David Gurarie

Date of Defense

4/5/2016

*We also certify that written approval has been obtained for any proprietary material contained therein. 4.3 Bibliography 47 List of Figures

1 The C ...... 4 2 The a , relative minor of C Major...... 4 3 The triads in C Major: C major, d minor, e minor, F major, G major, a minor, and b diminished...... 5 4 The movement between functions...... 5 5 Some typical harmonic progressions...... 8 6 An example melody...... 9 7 A sample realization...... 11 8 A modulation via a secondary dominant...... 12 9 Modulation to new random walk...... 13 10 A stochastic matrix of frequency and intensity, slices of time with corresponding frequencies, and a sample screen and its evolution in time...... 16 11 The musical realization. Note that slots two and three are combined into one note; this provides some rhythmic variation. 29 12 The musical realization...... 32 13 The pitch set {0, 1, 4, 6, 7}...... 40 14 Pitch set harmonies...... 41 15 The minor heat map and an example of re-weighting it to emphasize a somber mood...... 46

47 Algorithmic Stochastic Music

Abstract

by

ALEX COOKE

The aim of this project is to develop a system of tonal musical generation that can recognize shifts in tonal center via random processes and reorient itself accordingly. One might liken this to a random walk with the added property of boundary crossings. These weights can be conveniently encoded in the discrete probability mass functions corresponding to each scale degree. The result is a self-generating system of music that follow tonal rules in a convincing way. 1 Introduction

1.1 Musical Motivations and Background

Tonal music is by far the most recognizable form of Western music to the majority of musicians and non-musicians alike. From pop music to a large portion of classical repertoire, the majority of music is built upon or deriva- tive of the tonal system, which uses an asymmetric organization of a series of pitches to induce relationships based on movements between three types of triadic harmony (harmonies built on the interval of a third).

A key is a collection of pitches around a certain pitch, based on the order- ing set forth by a major or minor scale. A major scale is given by the se- quence of whole steps (two semitones, or adjacent pitches) and half steps (one semitone): WWHWWWH, whereas a minor scale is given by: WH- WWHWW. Note that a minor scale is equivalent to a major scale begin- ning on the sixth scale degree. Such a relationship is called the ”relative” key.

Figure 1: The C Major scale.

Figure 2: The a minor scale, relative minor of C Major.

4 By stacking notes together that are a third apart, one creates ”triads”; these harmonies form the basis of motion in music. Triads are named based on their root (the note of the scale upon which two other notes are stacked) and their ”quality,” the size of the steps between notes. A major third (four semitones) followed by a minor third (three semitones) is a major triad, a minor third followed by a major third is a minor triad, and two minor thirds form a .

Figure 3: The triads in C Major: C major, d minor, e minor, F major, G major, a minor, and b diminished.

The three basic categories of harmonies are tonic, predominant, and dom- inant, so named because of their respective functions. Whereas chords can be augmented by other tones, substituted for one another, or borrowed from other keys, their individual functions can all be placed in one of these three categories, within which certain rules govern their movement within and between the categories.

Figure 4: The movement between functions.

5 Tonic is the most the versatile of the functions and is typically thought of as the ”home” of a key. Harmonies that belong to the tonic category are either the chord built on the root of the key, or share two of their three notes with the chord built upon the root (called tonic substitutes). Pre- dominant chords serve as an intermediary for tonic and dominant chords; they overwhelmingly move to the dominant. Rarely, they move back to the tonic in a motion called a ”plagal .” This is both rare and highly specific and does not drastically alter the function of a predominant har- mony. Dominant chords serve to move back to tonic to reinforce it as the base of a key. They accomplish this through two main mechanisms: a de- scending fifth motion, considered the strongest relationship in tonality, and the half-step relationship between the seventh scale degree and the tonic degree, which creates a strong pull toward the tonic, so strong that it is called the ”leading tone.”

6 In major, triads are categorized as follows:

Scale Degree Triad Quality Function

I Major Tonic

ii minor Predominant

iii minor Tonic

IV Major Predominant

V Major Dominant

vi minor Tonic

vii° diminished Dominant

In minor, triads are categorized as follows:

Scale Degree Triad Quality Function

i minor Tonic

ii° diminished Predominant III Major Tonic

iv minor Predominant

v minor Dominant

VI minor Tonic

VII Major Dominant

One may stay in a category as long as one pleases, but when one moves be- tween categories, the rules of Figure 4 must generally be followed. There are other rules of good harmonic practice that dictate the motion between individual harmonies (namely, the vertical arrangement of the harmony, known as ””) that are beyond the scope of this thesis; they will often be simplified or overlooked for the sake of illustration. Some typ- ical harmonic progressions are shown next:

7 Figure 5: Some typical harmonic progressions.

The first progression is the most basic harmonic motion: I-V-I (T-D-T). The second progression introduces a very typical , the IV chord (also known as the ). The third example illustrates the same progression in minor. Very often, the v chord in minor will be replaced with the V chord from the parallel major (the major key sharing the same tonic), as the this replaces the seventh scale degree (the third of the chord) with the major seventh scale degree, which is a half-step from tonic, creating a stronger tendency to resolve. So often is this done that it is not often labeled as a . The final chord illustrates a ”de- ceptive” cadence, a movement from V to vi, which subverts the expectation of a V-I movement. Such a movement could be used to modulate (intro- duce a new key) to the relative minor, which would make vi the new i.

While harmonies provide the basis of motion within a piece, melodies can be thought of as the ”singable” part of music. They are typically single note lines that consist of notes taken from the underlying harmony; whereas harmony is the vertical component, melody is the horizontal. The contour of a melody may also be improved by the use of non-harmonic tones that make for a smoother line or create musical tension and resolution. Such non-harmonic tones may include steps (passing tones), neighbors (a move to a note directly above or below and back), anticipations (a sounding of a

8 note in the next harmony), or other variations.

Figure 6: An example melody.

In this example, the melody starts on A, both the root of the opening har- mony and the tonic of the key, moves through a lower neighbor G for orna- mentation, jumps to D on the second beat, before a passing tone C moves it smoothly to the harmonic tone B on the third beat, where it outlines the e minor harmony, finally ending on the harmonic tone A of the fourth beat.

9 1.2 From Music to Math

The inherent asymmetry of the tonal organization of pitch induces relation- ships that have been repeated in many variations throughout the history of classical music. These tendencies and relationships are so prevalent that they have been essentially ingrained in the Western listener’s ear; whereas musical training lends the vocabulary necessary to articulate these phe- nomena, it is hard to argue that most people have a musical instinct that musicians consistently exploit in their work by constantly building, sub- verting, and rewarding aural expectations. As seen, at a higher level, the driving force of these aural expectations is the harmonic functions of chords. Within these functional groups, com- posers make decisions on usage of individual harmonies based on mood, musical direction, form, length, etc. Nonetheless, we can examine the rela- tive frequency of each harmonic motion in repertoire and encode this as a probability:

n(Hi → Hj) P → P [Hi → Hj] n(Hi → Hj) i

10 A set of harmonic motions might then be thought of as a random walk:

H1 → H3 → H5 → H2 → H1

Figure 7: A sample realization.

While the idea of a random tonal walk is interesting in its own right, the notion takes on much more interest and ability to create long-form pieces when we open it to modulation. Modulation is a shift in tonal center, a reorientation of our scale using another note as the base. Usually, this in- volves moving to a closely related key (a key that differs in only one tone), but any modulation is possible and permissible (often by a chain of mod- ulations). This can be achieved through many methods; most often, it is achieved via a pivot chord, borrowed chord, or secondary dominant chord that tonicizes another chord.

A pivot chord is a chord shared by two keys and thus, one can simply con- tinue into the new key convincingly by treating its function as that it holds in the new key rather than the old. Borrowed chords are chords built on the same scale degree, but taken from the (the key that shares the same tonic). For example, the IV chord in C Major is F Major, but the borrowed IV chord is the chord built upon the fourth scale degree in c mi- nor, namely f minor. These chords are useful as they allow more distant

11 modulations, while their strong relation to the original key still preserves them as convincing choices for harmonic motion. Lastly, a secondary dom- inant (or secondary diminished) chord tonicizes another chord by making use of a dominant-to-tonic movement in that key. These chords often share the majority of their tones with the original key.

Figure 8: A modulation via a secondary dominant.

In Figure 8, a D Dominant replaces the d (ii6) seen in the first measure. This chord functions as V7/V, resolving to a G , the V chord in C Major.

Modulations provide another means of musical interest and in particular, a means of temporal extension by reorienting and thus, reseting the listener’s expectations. If the movement through each key represents a random walk, we might liken the overall process that includes modulation to a set of ran- dom walks, each independent of one another, with the transitions between different walks being dependent on the unique musical properties inherent to them and the derived mathematical situation. In particular, the melody will play a key role in many of these situations; while the harmony is the driving force underlying the direction of the music, the melody is the musi- cal device the listener most adamantly latches onto and thus, is the device the can lend credence to a potential modulation as being either a brief or- nament or a legitimate shift.

12 Figure 9: Modulation to new random walk.

P8 ∗ ∗ • If i=1 mi > T (m ) then K1 → K2

13 2 Prior Work

While the idea of algorithmic music generation via mathematical models is not entirely new, prior work has taken a different direction than the present project. Such ideas can be traced to the ancient Greeks; Ptolemy believed that math ”underlie(s) the systems both of musical intervals and of the heavenly bodies.” He extended this in building musical relationships that corresponded with heavenly bodies.

In the 1400s, the introduction of canon can be seen as the first such in- stance of these processes in modern music. A single melodic line for one voice would typically be notated, from which performers knew to derive their respective melodies based on standard temporal shifts and musical manipulations of the original melody.

The first well-known examples involving chance music occurred in the 18th century. Johann Kirnberger, C.P.E. Bach, Maximillian Stadler, and Mozart all composed music that used dice or the choice of random numbers to as- semble small musical fragments into larger pieces. These games enjoyed wide popularity throughout Western Europe during this time. John Cage would extend these ideas quite a bit in the mid-20th century, using squares on a chessboard associated with musical fragments, other chance processes, and even natural phenomena to determine musical creation.

Other 20th century models included twelve-tone music and serialism, pop- ularized by Schoenberg, Berg, Webern, and Stravinsky, which sought to abstract musical creation to the highest level by removing as much of the subjective process as possible.

Computers allowed a new frontier is algorithmic music. Hiller and Isaac-

14 son used the Illiac computer at the University of Illinois to create the Illiac Suite (1957), which generated raw materials that were then culled and pol- ished through an iterative process. Iannis Xenakis can be seen as one of the pioneers of algorithmic music and probably the leading figure of the 20th century regarding its theory and usage.

Xeankis used stochastic processes and was a major catalyst for mathe- matically generated music. He proposed ”clouds of sounds,” which can be thought of as clusters of musical events drawn from the standard Poisson process: µµ P = 0 e−µ0 µ µ!

By varying µ, he could vary the density of musical events. After choosing a value for µ, Xenakis would slice a piece temporally into n cells; the cor- responding probabilities of k events given the chosen distribution would determine the proportion of cells that would contain that density of events. The musical prowess of the composer entered in the arrangement of these events.

Xenakis also vectorized musical events by parameters and times, then sub- jected them to similar processes. By creating stochastic matrices for musi- cal parameters such as frequency and intensity (”grains of sound”), he was able to generate complex events that evolved as four-dimensional musical ”screens”: frequency, intensity, duration, and density.

15 f1 f2 f3 ··· f1 f1 f2 f1 f2 f3 ··· g1 0.5 0 0 ··· A B C D E F ··· g2 0 0.3 1 ··· ∆t ∆t ∆t ∆t ∆t ∆t ··· g3 0.5 0.7 0 ···

Figure 10: A stochastic matrix of frequency and intensity, slices of time with corresponding frequencies, and a sample screen and its evolution in time.

16 3 The Model

3.1 Included Harmonies

3.1.1 Major

In the standard 12-tone Western system, the major scale includes 0, 2, 4, 5, 7, 9, and 11. The following harmonies were included in the major scale model and were chosen based on their relative prevalence in repertoire.

Harmony Scale Degrees Pitch Set Function

I 1, 3, 5 0, 4, 7 Tonic

ii 2, 4, 6 2, 5, 9 Predominant

iii 3, 5, 7 4, 7, 11 Tonic Substitute

IV 4, 6, 1 5, 9, 0 Predominant

V 5, 7, 2 7, 11, 2 Dominant

vi 6, 1, 3 9, 0, 4 Tonic Substitute

vii° 7, 2, 4 11, 2, 5 Dominant V7 5, 7, 2, 4 7, 11, 2, 5 Dominant

6 I4 1, 3, 5 0, 4, 7 Dominant vii7 7, 2, 4, 6 11, 2, 5, 9 Dominant

vii7/V ]4, 6, 1, 3 6, 9, 0, 4 Secondary Diminished

V7/V 2, ]4, 6, 1 2, 6, 9, 0 Secondary Dominant

BVI [6, 1, [3 8, 0, 3 Borrowed Chord (Tonic Substitute)

V7/IV 1, 3, 5, [7 0, 4, 7, 10 Secondary Dominant

N[II6 [2, 4, [6 1, 5, 8 Predominant

Bi 1, [3, 5 0, 3, 7 Borrowed Chord (Tonic Substitute)

BIII [3, 5, [7 3, 7, 10 Borrowed Chord (Tonic Substitute)

17 The first seven harmonies in the list are those built from triads consisting of the standard scale degrees, as discussed earlier. The rest of the included harmonies were chosen because they are the most commonly occurring in standard repertoire; they provide a suitably diverse palette that is both musically interesting and mathematically rich.

18 By examining repertoire and making slight adjustments both for taste and to promote highlighting of the process, the major scale stochastic matrix was created as follows:

7 6 7 7 7 7 6 I ii iii IV V vi vii° V I4 vii vii /V V /V BVI V /IV N[II Bi BIII

I 0 .15 .05 .26 .16 .05 0 .08 0 0 .03 .06 .04 .03 .05 0 .04

ii 0 0 0 .1 .6 0 0 0 .05 0 0 .25 0 0 0 0 0

iii .1 0 0 .35 .45 .1 0 0 0 0 0 0 0 0 0 0 0

IV .1 0 0 0 .35 0 .1 .35 .1 0 0 0 0 0 0 0 0

V .6 0 0 0 0 .1 0 .15 .1 0 0 0 .05 0 0 0 0

vi .2 0 0 0 .55 .15 .1 0 0 0 0 0 0 0 0 0 0

vii° .7 0 0 0 0 0 0 0 0 .2 0 0 0 0 0 .1 0

V7 .7 0 0 0 0 .15 0 0 0 0 0 0 .03 0 0 .02 0

6 I4 0 0 0 0 .6 0 0 .4 0 0 0 0 0 0 0 0 0

vii7 .95 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .05 0 vii7 0 0 0 0 .8 0 0 .2 0 0 0 0 0 0 0 0 0 V V 7 0 0 0 0 .8 0 0 .2 0 0 0 0 0 0 0 0 0 V BVI 0 0 0 0 .7 0 0 0 0 0 0 0 0 0 0 .3 0 V 7 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 IV N[II 6 0 0 0 0 .7 0 0 .2 .1 0 0 0 0 0 0 0 0

Bi 0 .2 0 .2 .5 0 0 .1 0 0 0 0 0 0 0 0 0

BIII 0 0 0 .4 .5 0 0 .1 0 0 0 0 0 0 0 0 0

19 We can get a decent idea of the total occurrence of a harmony by looking at its column sum: Pm i=1 P [Hij] n(Hj) = min n(Hj) j Of course, this is not a perfect representation as it is also dependent on the likelihood of the path that led to said harmony occurring. Neverthe- less, summing the columns and normalizing produces an appropriate result (even if taken more qualitatively as opposed to direct proportions), with the top four harmonies matching those found in literature.

Harmony Occurrence Harmony Occurrence

V 223.7 V7/V 10.3

I 111.7 vii7 6.7

IV 77 vii° 6.7 V7 59.3 BVI 4

Bi 19 N[II6 1.7

vi 18.3 iii 1.7

6 I4 11.7 BIII 1.3 ii 11.7 V7/IV 1

vii7/V 1

20 Categorically, we see the following behavior:

Harmony Occurrence

Tonic 156

Predominant 102.7

Dominant 308

Musically, this is unsurprising. Predominant lags the most, reflecting its optional nature, while dominant leads, since a dominant harmony will of- ten pass through another dominant harmony before resolving to a tonic of some sort.

21 A MATLAB simulation of 100,000 harmonies was performed via the follow- ing code: count=zeros(1,17); state=1; cdf = cumsum(Major,2); n=100000 for t=1:n state=min(find(rand < cdf(state,:))); count(1,state)=count(1,state)+1; t end count=count./min(count(count>0))

This produced the following normalized results:

Harmony Occurrence Harmony Occurrence

I 87.68 BVI 8.51

V 78.97 Bi 8.22

V7 39.64 vii° 5.24 IV 31.10 N[II6 4.47

vi 21.64 iii 4.33

ii 14.73 BIII 3.5

6 7 I4 12.02 vii /V 2.66 V7/V 9.30 V7/IV 2.55

vii7 1

Categorically, we see the following behavior:

Harmony Occurrence

Tonic 133.89

Predominant 64.81

Dominant 136.87

Proportionally, this is more musically in line with what we would expect. Dominant and tonic are roughly equal, as every tonic motion is preceded

22 by a dominant, with dominant holding a slight lead owing to the fact that a dominant function harmony often passes to another dominant form more often than a tonic proceeds to a tonic substitute. Predominant is propor- tionally smaller, reflecting its generally optional nature.

23 3.1.2 Minor

In the standard 12-tone Western system, the minor scale includes 0, 2, 3, 5, 7, 8, and 10. The following harmonies were included in the minor scale model and were chosen based on their relative prevalence in repertoire.

Harmony Scale Degrees Pitch Set Function

i 1, 3, 5 0, 3, 7 Tonic

ii° 2, 4, 6 2, 5, 8 Predominant III 3, 5, 7 3, 7, 10 Tonic Substitute

iv 4, 6, 1 5, 8, 0 Predominant

v 5, 7, 2 7, 10, 2 Dominant

V 5, \7, 2 7, 11, 2 Dominant

VI 6, 1, 3 8, 0, 3 Tonic Substitute

VII 7, 2, 4 10, 2, 5, Dominant

V7 5, \7, 2, 4 7, 11, 2, 5 Dominant

6 i4 1, 3, 5 0, 3, 7 Dominant N[II6 [2, 4, 6 1, 5, 8 Predominant

BI 1, \3, 5 0, 4, 7 Tonic Substitute

BIV 4, \6, 0 8, 0, 3 Predominant

vii° \7, 2, 4 11, 2, 5 Dominant

vii°7 \7, 2, 4, 6 11, 2, 5, 8 Dominant V7/v 2, ]4, \6, 1 2, 6, 9, 0 Secondary Dominant

V7/iv 1, \3, 5, 7 0, 4, 7, 10 Secondary Dominant

Similarly to major, the first seven harmonies are built from triads consist- ing of the standard scale degrees, while the rest were included based on both commonality and diversity.

24 This produced the following stochastic matrix for the minor scale.

7 6 6 ø7 7 7 I ii° III iv v V VI VII V i4 N[II BI BIV vii° vii V /V V /IV

I 0 .1 .05 .1 .15 .1 0 0 .15 0 .05 0 .1 0 0 .1 .1

ii° 0 0 0 .15 .2 .25 0 0 .3 .1 0 0 0 0 0 0 0

III .1 0 0 .2 .2 .15 .1 0 .15 0 0 0 0 0 0 .1 0

iv .1 0 0 0 .1 .15 0 .1 .25 .1 0 0 0 .05 .05 .1 0

v .4 0 0 0 0 0 .2 .1 .1 0 0 0 0 .1 .1 0 0

V .4 0 0 0 0 0 2 .1 .1 0 0 0 0 .1 .1 0 0

VI .2 0 0 0 .2 .2 0 .1 .2 0 0 0 0 .05 .05 0 0

VII .6 0 .2 0 0 0 0 0 0 0 0 .2 0 0 0 0 0

V7 .5 0 0 0 0 0 .3 0 0 0 0 .2 0 0 0 0 0

6 i4 0 0 0 0 .25 .25 0 0 .5 0 0 0 0 0 0 0 0

N[II6 0 0 0 0 .15 .3 0 0 .3 .1 0 0 0 0 0 .15 0

BI 0 .05 0 .1 .05 .05 0 .05 .1 0 .1 0 .2 0 0 .3 0

BIV 0 0 0 0 .1 .2 0 .15 .2 .05 0 0 0 0 .1 .2 0

vii° .6 0 0 0 0 0 0 0 0 0 0 .3 0 0 .1 0 0 viiø7 .7 0 0 0 0 0 0 0 0 0 .3 0 0 0 0 0

V7/V 0 0 0 0 .3 .3 0 0 .4 0 0 0 0 0 0 0 0

V7/IV 0 0 0 .6 0 0 0 0 0 0 0 0 .4 0 0 0 0

25 Following the same procedure as in major, we produce the following nor- malized column sums:

Harmony Occurrence Harmony Occurrence

i 36 VII 6

V7 27.5 viiø7 5

6 V 19.5 i4 3.5 v 17 vii° 3 iv 11.5 III 2.5

BI 10 ii° 1.5 V7/V 9.5 N[II6 1.5

VI 8 V7/IV 1

BIV 7

Categorically, we see the following behavior:

Harmony Occurrence

Tonic 56.5

Predominant 21.5

Dominant 92

Again, the categories behave as expected. One should note, however, the relatively lower occurrences for individual harmonies. This reflects the greater harmonic freedom generally found in minor, which is a consequence of the seventh scale degree being optionally raised or naturalized in minor. When naturalized, the resolution to tonic is weakened, giving greater free- dom of movement.

26 A simulation of 100,000 harmonies was performed in MATLAB and pro- duced the following normalized results:

Harmony Occurrence Harmony Occurrence

i 20.22 VII 3.64

V7 12.39 viiø7 2.74

v 8.39 vii° 2.26

V 8.05 ii° 2.19 VI 7.25 V7/iv 2.01

V7/V 5.04 III 1.79

BI 4.68 N[II6 1.47

6 iv 4.42 i4 1 BIV 3.64

Categorically, we see the following behavior:

Harmony Occurrence

Tonic 33.94

Predominant 18.90

Dominant 38.48

Proportionally, this is exactly as expected, once again. As before, tonic and dominant are roughly equal, with dominant holding a slight lead due to the appearance of multiple dominant harmonies in sequence at times.

27 3.2 Melody and Modulation Mechanisms

3.2.1 Major

Whereas harmony provides movement within a key and the opportunity to move outside it, melody can be that which determines a modulation’s oc- currence or an unusual harmony as mere ornamentation. In this project, we assume all measures will be in the 4/4 meter, one harmony per mea- sure, with note values between a half note and an eighth note, giving eight slots for melody notes; note that individual slots can be combined into a single larger slot as well. Modulation is then based either on the behavior of the melody during a potential modulation harmony, or by a binary deci- sion; the reasoning behind the individual choices will be explained.

Harmony Yes No

Bi .8 .2

vii7/V ≥ 37.5% ]4 else

V7/V ≥ 37.5% ]4 else

V7/IV ≥ 37.5% [7 else

vi .3 .7

BVI ≥ 37.5% total [3 and [6 else

Melodies are constructed by a draw from the uniform distribution for the each of the eight slots, each draw corresponding to a note in the harmony. 1 For H = {hi , . . . , hi }, P [mi = hi ] = . We then have a melody vector for i 1 n k j n each measure:

i i i i i i i i m(i) = (m1, m2, m3, m4, m5, m6, m7, m8)

i i It may be that mj = mj+1, in which case the notes are rhythmically com- bined.

28 Modulation is then based either on the melody’s behavior or a binary deci- sion if a harmony is particularly prone to modulation.

• Type One:   p K1 → K2  1 − p K1 → K1

8 P ∗ ∗ • Type Two: mi > T (m ) then K1 → K2 i=1

For example, consider the following melody construction: Harmony: V7/V (2, ]4, 6, 1)

Slot 1 2 3 4 5 6 7 8

Draw 2 4 4 1 3 1 2 1

Notes ]4 1 1 2 6 2 ]4 2

8 ∗ P ∗ ∗ m = 2, mi = 2 < T (m ) = 3 =⇒ No modulation i=1

Figure 11: The musical realization. Note that slots two and three are com- bined into one note; this provides some rhythmic variation.

The four harmonies that rely on the proportion of the nonscale tones do so either because they are secondary in function (the three ”slash” chords)

29 or because they are not stark enough in musical context (BVI) to immedi- ately elicit a modulation solely based on their harmonic content. The sec- ondary chords naturally resolve to scalar harmonies, while the BVI chord is not musically striking enough based on its relatively weak scalar posi- tion to necessitate a key change solely on its presence alone. On the other hand, Bi is in the stronger scalar position, and thus, its presence is rather noticeable. The vi chord is contained completely within the original key, being the relative minor, so it is not as striking; nonetheless, it is not un- usual to modulate to its key. Shown on the next page is an example piece of 20 measures beginning in major.

30 Score Major Example

4 œ œ œ j œ œ œ. œ. & 4 œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ J J J f ˙ ˙ ˙ ˙ ? 4 ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ 4 ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ P 5 œ. œ bb b œ œ œ œ œ œ. œ œ œ œ œ & b˙ œbœ œ œ b œ œ œ œ J J

b˙ ˙ ˙ ˙ ˙ ˙ ? b ˙ ˙ b b ˙ ˙ ˙ ˙ ˙ ˙ b˙ ˙ b b ˙ ˙ ˙ ˙ ˙ ˙

9 œ œ œ œ b b œ œ j œ œ œ œ œ & b b œ œ œ œ œ œ œ j œ œ œ œ œ œ. œ œ. ˙ ˙ ˙ ˙ ˙ ˙ ? b b ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ b b ˙ ˙ ˙ ˙

13 b œ œ b bb œ œ œ j œ œ œ œ œ œ œ j & œ œ nœ œ œ œ œ. œ œ œ œ. œ œ ˙ ˙ ˙ ˙ ˙ ˙ ? b ˙ ˙ n˙ ˙ ˙ ˙ ˙ ˙ b bb ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙

17 œ b œ œ œ œ œ œ œ œ œ œ œ b bb œ œ œ œ œ œ œ ˙ & œ œ œ œ œ œ œ ˙ ˙ ˙ ˙ ? b ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ b bb ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ 3.2.2 Minor

In minor, we have the following modulation mechanisms:

Harmony Yes No

III .4 .6

V7/iv ≥ 37.5% \3 else

V7/v ≥ 37.5% ]4,]7 else

vi .3 .7

BI .8 .2

Shown next is an example melody construction: Harmony: BI (1, \3, 5 )

Slot 1 2 3 4 5 6 7 8

Draw 1 2 1 2 2 3 1 2

Notes 1 \3 1 \3 \3 5 1 \3

Random Draw: .78 (Modulation)

Figure 12: The musical realization.

32 Score Minor Example q = 140 4 œ œ. j j j & 4 œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ f œ œ œ œ ˙ ˙ ? 4 œ œ œ œ œ œ œ œ œ œ œ œ œ œ ˙ ˙ 4 œ œ œ œ œ œ ˙ ˙

5 P P œ œ œ œ # # œ œ J œ œ # œ œ œ œ j œ œ & œ #œ œ J ˙ J œ œ œ œ œ œ

#˙ ˙ N˙ ˙ # ˙ ˙ ˙ ˙ ? ˙ ˙ ˙ ˙ ## ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙

9 # œ ## œ œ œ œ œ œ & œ œ œ œ œ ˙ œ œ œ œ œ œ œ œ œ œ œ ˙ ˙ ˙ ˙ ? # # ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ # ˙ ˙ ˙ ˙ ˙ ˙ ˙˙ ˙˙

13 œ œ # # œ œ œ œ œ œ œ œ œ œ ˙ & # œ œ œ œ œ œ œ œ œ œ œ œ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ? # # ˙ ˙ ˙ ˙ ˙ ˙ ˙˙ ˙˙ # ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙

17 # # œ & # œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ ˙ ˙ # ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ? ## ˙ ˙ #˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ 2 Minor Example

21 œ œ # # n# œ œ œ œ œ œ #œ œ # œ œ & # #˙ œ œ œ # œ œ n œ œ œ œ J J œ œ œ #˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ? ### ˙ ˙ n## ˙ ˙ #˙ ˙ n# ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙

25 # œ œ œ œ j j œ œ œ œ œ œ œ #œ œ œ & œ œ œ œ œ œ œ œ œ œ œ ˙ ˙ ˙ ˙ ? # ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ #˙ ˙

29 œ . œ œ œ œ œ œ œ # œ œ œ œ œ œ J œ œ œ œ œ œ œ & œ œ œ œ

˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ? # ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙

33 œ # #œ œ œ œ œ œ #œ œ œ œ. œ #œ œ & J œ œ œ nœ j œ œ . œ œ #œ ? # ˙ ˙ #˙ ˙ n˙ ˙ a˙ ˙ #˙ ˙ ˙ ˙ ˙ ˙ # ˙ ˙ ˙ ˙ ˙ ˙ ˙ ˙

37 # œ œ œ œ. œ œ œ œ œ œ œ œ œ #œ œ w & œ œ œ J œ œ œ œ w œ œ w ˙ ˙ ˙ ˙ ˙˙ ˙˙ w w ? # ˙ ˙ ˙ ˙ # ˙ ˙ ww w w w ˙ w 3.3 Entropy

One of the most interesting properties of system we can measure is the en- tropy of each harmony. This was done via the standard formula:

X H = pi log2 pi i

3.3.1 Major

In major, we have the following results:

Harmony Entropy Rank

I 3.20 1

ii 1.49 6

iii 1.72 4

IV 1.72 4

V 1.73 3

vi 0.72 14

vii° 0.72 14 V7 1.29 8

6 I4 0.97 10 vii7 0.29 16

vii7/V 0.72 12

V7/V 0.72 12

BVI 0.88 10

V7/IV 0 17

N[II6 1.16 8

Bi 1.76 2

BIII 1.36 7

35 Categorically, we see the following behavior:

Category Average Entropy Rank

Tonic 1.61 1

Predominant .968 3

Dominant 1.00 2

Musically, this is a telling analysis. We see that while predominant and dominant harmonies are essentially the same, tonic harmonies hold a sig- nificantly higher entropy on average. This is indicative of a musical idea generally accepted as fact: tonic harmonies are both more flexible and are superior in the sense that predominant and dominant harmonies are sub- servient. In other words, tonic harmonies have more freedom of movement; this essentially confirms the long-held musical tenet of Figure 4.

36 3.3.2 Minor

In minor, we have the following results:

Harmony Entropy Rank

i 3.25 1

ii° 2.23 7 III 2.75 4

iv 3.00 2

v 2.32 7

V 2.32 7

VI 2.62 6

VII 1.37 14

V7 1.49 13

6 i4 1.50 12 N[II6 2.20 10

BI 2.85 3

BIV 2.68 5

vii° 1.30 15

vii°7 0.88 17 V7/v 1.57 11

V7/iv 0.97 16

Categorically, we see the following behavior:

Category Average Entropy Rank

Tonic 2.87 1

Predominant 2.53 2

Dominant 1.52 3

37 Interestingly, unlike in major, we see that while tonic is still the most flex- ible harmony, predominant far outpaces dominant harmonies. Musically, this is in line with the fact that minor keys tend to be a bit more flexible in harmonic movement. In particular, the greater number of dominant har- monies (as a result of the flattened seventh scale degree that is sometimes raised a half step) in minor means those harmonies that precede the domi- nant function have greater freedom in which to move toward said function.

38 3.4 Simulation Code

The probability matrices were programmed into MATLAB. Entropy was calculated as follows: for i=1:17 entsum=0; for j=1:17 if Major(i,j)>0 entsum=entsum+(Major(i,j)*log2(Major(i,j))); else end end EntropyMajor(i)=-entsum; end

The process was simulated as follows: countmin=zeros(1,17); state=1; cdf2 = cumsum(Minor,2); n=100000 SelectionMinor=zeros(1,n); for t=1:n state=min(find(rand < cdf2(state,:))); countmin(1,state)=countmin(1,state)+1; SelectionMinor(t)=state; end

39 4 Extensions

4.1 Arbitrary Pitch Sets

Whereas this method was developed with tonal music in mind, there is re- ally no reason why the idea cannot be applied to arbitrary pitch sets. In fact, most modern music lives outside tonality, whether that be through an extended idea of it, or in an entirely atonal realm. In this area, music is analyzed via pitch sets, which simply choose a base pitch, and number all other pitches based on their distance from the base pitch, using the direc- tional orientation and base pitch that minimize the numbers. For example, the pitch set corresponding to a D major chord (D, F], A) is {0, 3, 7}, cor- responding to the ordered set {A, F], D}. Interestingly, a major chord and minor chord are equivalent in this system.

For example, a common pitch class set is {0, 1, 4, 6, 7}.

Figure 13: The pitch set {0, 1, 4, 6, 7}.

The idea of triadic harmony is a bit more nebulous in this case, as pitch sets will often not lend themselves to triadic spacing. Nonetheless, we can still define harmonies simply as combinations of notes drawn from the set. Really, we needn’t use triadic harmony in the original procedure; quartic harmony (popular in the 20th century) would have been equally viable. Triadic harmony was chosen simply for its familiarity to most listeners. For example, we might define the following harmonies in the above pitch set:

40 Harmony Set Harmony Set

1 {0, 1, 4} 5 {0, 4, 7}

2 {0, 1, 6} 6 {1, 4, 7}

3 {0, 1, 7} 7 {1, 6, 7}

4 {0, 4, 6}

Figure 14: Pitch set harmonies.

It doesn’t make sense to talk about function in this case; nonetheless, we can define a probability table for this case. In fact, if we want to truly treat this as atonal, thus equalizing all pitches, we’ll assign uniform proba- bilities for all harmonies:

1 2 3 4 5 6 7

1 .1428 .1428 .1428 .1428 .1428 .1428 .1428

2 .1428 .1428 .1428 .1428 .1428 .1428 .1428

3 .1428 .1428 .1428 .1428 .1428 .1428 .1428

4 .1428 .1428 .1428 .1428 .1428 .1428 .1428

5 .1428 .1428 .1428 .1428 .1428 .1428 .1428

6 .1428 .1428 .1428 .1428 .1428 .1428 .1428

7 .1428 .1428 .1428 .1428 .1428 .1428 .1428

In this case, the idea of entropy doesn’t make much sense, save to say we might define atonality as the case in which harmonies have equal entropy and thus, equal flexibility. We can then run the same simulation.

41 Pitch Set Example

4 b˙ œ œ œ bœ œ œ œ œ œ œ œ & 4 J J œ œ œ œ œ ˙ bœ œ œ œ ˙ ˙ ˙ ˙ ? 4 ˙ ˙ ˙ ˙ ˙ ˙ 4 b˙˙ ˙˙ b˙˙ ˙˙ ˙ ˙ b˙˙ ˙˙

5 bœ œ œ œ œ œ #œbœ œ œ œ œ & œ œ b˙ #œ bœ œ œ œ œ œ œ ˙ ˙ ˙ ˙ ˙ ˙ ? b˙˙ ˙˙ b#˙˙ ˙˙ b#˙˙ ˙˙ b˙˙ ˙˙ Nonetheless, perhaps the most interesting expansion of the concept is a middle ground between tonality and completely atonal music. Whereas tonality represents a relatively rigid system and atonality represents com- plete equalization of pitches, a lot of modern music, whether it be jazz, modern classical, or popular lives in a middle ground where harmonic mo- tion is much freer, but a clear tonal center still exists. An example of this is seen on the next page; notice the large amount of accidentals and the modulation to a very distant key. Nonetheless, this passage clearly empha- sizes a tonality centered around e[, moving to g].

While the system could be readily adapted to this expansion in its cur- rent iteration, a more subtle handling of accidentals and moving between harmonies would benefit it; namely, where the current system only cares about the i step to generate the i + 1 step, this system should likely take into account multiple prior steps, as the accumulation of accidentals in the neighborhood of a harmony influences its subsequent movements. Such a model would take the form:

n n k X k−l X P [Hi→j] = alP [H(i−l)→(j−l)], al = 1 l=1 l=1

43 Wistful Musings 9

63 Mute string lunga nœ arco œ œ Vc. ? œ œ œ œ œ œ œ U bb b œ œ Œ Œ b b ˙. ¿ > > ƒ lunga >œ U b b n˙˙. > œ n>œ bb>œ ? ˙ & b b b ˙. œ nœ œ œ . œ nnœ œ Pno. > > lunga F ƒ p P f Ÿ~~~~~~~~~~ ƒ U Œ ‰ ^ bb b ? j œ nœ œ Œ ‰ ® ® & b b ˙. œ œ œœ nnœ bbœ œ nœœ #n˙˙. > > > œ nœ œ œ œ œ œ œ > > > ◊ 66 ◊ Vc. ? b b ˙. ˙. 9 b b b & 16 P f P f > > > > œ bœ œ œ œ bœ œ œ ? b b œ œ œ œ ‰ Œ œ œ œ œ ‰ Œ 9 b b b 16 Pno. F ? 9 bb b ‰ Œ ‰ Œ 16 b b œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ œ 68 ◊ ◊ j Vc. gliss. # # bb b 9 æ æ j nn n # # 7 œ œ œ & b b 16 nœ œ ( ) n n # 8 aœ. œœ œ œ œ œ . œ impetuouslyœ œ œ p f

? 9 œ n n # ## 7 ˙ ? bb b 16 œ œ œ & œ œ nnœ n n n # # 8 œ. b b bœ œ Pno. p f œ œ nœ ? 9 œ œ # # 7 bb b 16 œ œ nn n # # 8 ˙ œ. b b œ œ n n # ˙ œ. 4.2 Commercial Applications and

Perhaps one of the most exciting applications of this system is the poten- tial for commercial applications in film scoring. While most would agree that music is an integral part of the filmic experience, adjoining music to film can be problematic in that it is often prohibitively expensive for lower budget or independent films to hire a composer, performers, and recording engineer to write and record a soundtrack. Another option is to license mu- sic, and while this is cheaper, it’s still not an inexpensive option, and the concession of customization is made; being that the music is prerecorded without regard for the film, it can be a struggle to find music that matches both mood and the timing of pivotal points.

The beauty of this method is that mood can be tweaked quite simply through weighting the transition matrix. Non-musicians could use a graphical inter- face in which they simply draw on a representation of the transition ma- trix that translates harmonies to moods and feelings. Hit points could be used to determine tempo and key musical cadence points. In other words, a filmmaker could mark hit points in their video editing software, select a mood, and the program would automatically output matching music. This would be both cheaper and arguably more artistically effective than licens- ing unrelated music. Nevertheless, this author encourages artistic collabo- ration with actual composers and performers, as this is far more musically rich; the aim of this process is to fill the void where such collaboration is not financially feasible.

Another musical application would be for improvisation and idea genera- tion. Because the process is indifferent to style, needing only a set of har- monies and probabilities, a musician looking to improvise in a certain style

45 could theoretically load a file containing the appropriate transition matrix and instantly have backing music generated. Similarly, this could be used as a means of idea generation for a composer.

Another interesting application is in the field of music theory. Most analy- sis of classical music centers on single pieces. Analyses about more general tendencies of composers can be found, but truly stringent macroanalyses are essentially nonexistent. However, by analyzing a composer’s use of har- mony across their entire output, or looking at a temporal slice of pieces, one can generate a very precise and easily interpreted heat map based on the corresponding transition matrix. This would allow for an easily in- terpreted, but highly informative representation of large-scale tendencies, thereby enabling deeper insight into stylistic trends:

Figure 15: The minor heat map and an example of re-weighting it to em- phasize a somber mood.

46 Bibliography

Xenakis, Iannis. Formalized music; thought and mathematics in composition. Bloomington: Indiana University Press, 1971.