A Transformational Modiﬁed Markov Process for Chord-Based Algorithmic Composition

: The goal of this research is to maximize chord-based composition possibilities given a relatively small amount of information. A transformational approach, based in group theory, was chosen, focusing on chord intervals as the components of a modiﬁed Markov process. The Markov process was modiﬁed to balance between average harmony, representing familiarity, and entropy, representing novelty. Uniform triadic transformations are suggested as a further extension of the transformational approach, improving the quality of tonality. The composition algorithms are demonstrated given a short chord progression and also given a larger database of albums by the Beatles. Results demonstrate capabilities and limitations of the algorithms.


Introduction
Algorithmic composition occurs on a plane where science, technology and art, specifically music, meet, and refers to musical composition techniques which were studied and developed well before the advent of digital computers [1]. Development of musical technologies has always been related to general technological advance. Specifically, computer-aided algorithmic composition begun in the mid twentieth century, with the increasing availability of computer technologies [2]. It has since become a significant field of research that has artistic and commercial representation.
The algorithm presented in this paper was developed for an on-going research involving audio-based synchronization of guitar playing robot manipulators. The interactive goal of the robotic system is to follow a given chord progression, played by a human musician, then modify it and develop it in an interactive environment [3]. This demanded maximizing compositional possibilities given a relatively short chord progression. A transformational approach was considered due to its firm mathematical basis and potential to expand compositional capabilities. According to music theorist David Lewin (1933Lewin ( -2003, transformational music theory has the potential to describe music not from an objective outside perspective, but from the perspective of a musician thinking within the music [4,5]. This, together with the limited input data scenario, provides the motivation for the research presented herewith. Transformational music theory involves analysis, characterization and formulation of transformations in musical composition [6]. In [7], Hook suggests a generalized formulation, termed the uniform triadic transformation (UTT), relates to two transformations between major and minor triads. Transformational notions such as neo-Riemannian transformations and Tonnetz have appeared in recent research as methods of exploring harmonic relations in algorithmic composition. The research appearing in [8] introduces a method of harmonization, given the melody and the desired style, based on a database of music. A tree-based process of analyzing, constructing and trimming the harmony using neo-Riemannian transformations is suggested. The Tonnetz is a graphical representation of the relation between notes and triads and is applied in [9] for interactive composition. In [10] and [11], interactive composition is designed using methods of tonal interval space [12]. An application of transformational theory in music appear in [13], which focuses on specific groups as the basis for composition. Finally, an example of composition using uniform triadic transformations (UTTs) appears in [14].
A Markov process was used as the basic structure for the current algorithm. Markov processes have been applied to music over almost a century, being versatile and easy to implement [1,15,16]. However, due to data storage problems on one hand, and the difficulty producing musically acceptable results on the other, Markov processes usually appear as part of a more complex algorithm [17]. In the context of chord progression analysis, recent examples can be found in [18] and [19]. In [20], the factor oracle is a structural basis for musical improvisation algorithms, addressing harmony, rhythm, melody and style. An interval-based approach was suggested as a possibility for expanding the compositional possibilities. The factor oracle was recently developed into a wider structure termed the variable Markov oracle [21].
The modified Markov process described below was presented in [22], and optimally adjusts the transition probabilities to control a balance between average source probability and entropy, representing familiarity and novelty, respectively.

Transformational Music Theory
This section describes harmonic relations in music and triadic operations in the language and notation provided by group theory, following [7].
All definitions below relate to pitch-class, and to the 12 tones of which western music is comprised. This means that a tone r represents the same tone as r + 12.
A chord refers to several musical tones resonating simultaneously. The two main chord types in western music are major and minor triads, made up of three tones each. The major triad with root r is composed of three tones, (r, r + 4, r + 7). As r represents the same note as r + 12, the respective intervals within the triad are the differences along the cycle, namely (4,3,5). Similarly, the minor triad with root r is composed of the three notes (r, r + 3, r + 7), giving the differences (3,4,5).

Definition 1.
A triad can be represented by the ordered pair ∆ = (r, σ), where r is the root of the triad expressed as an integer (mod 12), which is the relative shift in terms of semi-tones; and σ is a sign representing its mode (+ for major, − for minor).
Hugo Riemann (1849-1919) defined three triadic operations (transformations), known today as Neo-Riemannian operations: 1. The parallel operation (P) shifts the second note of the triad up or down a semitone transforming between the major and minor triads of the same root. This can be seen, for example, in the shift between C major and C minor. This transformation switches the intervals (4, 3,5) and (3,4,5), so it transforms a major triad to a minor one, and vice versa. More explicitly, P : (r, +) → (r, −), (r, −) → (r, +).
2. The leading tone exchange (L) moves the bottom note of the major triad down a semitone or the top note of the minor triad up a semitone. For example, transforming between C major and E minor. By rotating the triad observe that 3. The relative operation (R) transforms between relative major and relative minor triads by shifting the top note of the major triad up a whole tone or by shifting the bottom note of a minor triad down a whole tone. Here As a result that L • R : (r, +) → (r − 7, +), (r, −) → (r + 7, −) preserves the type, and because 7 is prime to 12, it is clear that every triad can be transformed by L, R to any other triad (i.e., the group of transformations generated by L, R acts transitively on Γ).

Uniform Triadic Transformations
The uniform triadic transformation, presented in [7], expands upon the neo-Riemannian transformations, and provides a generalized algebraic framework for the study of triadic transformations. A given uniform triadic transformation, or UTT, operates on major triads by a certain shift, and on minor triads by another. The UTT is denoted by σ, t + , t − , where σ ∈ {+, −} is the sign factor, t + is the transposition level given a major triad, and t − is the transposition level given a minor triad. In this notation, As major and minor triads are being rotated independently, we have a set of 144 operations, and this set { +, t + , t − | t + , t − ∈ Z 12 } clearly forms a group, isomorphic to Z 12 × Z 12 , which does not contain the operation P. It is easy to check that and it follows that the group of all the UTTs, is isomorphic to the semidirect product Z 2 (Z 12 × Z 12 ), which has order 288.

Modified Markov Process
The composition method is based on an extended Markov process, given a desired musical progression to be improvised upon. The method takes into account two competing factors: • Familiarity: The outcome is musical-theoretically coherent with the initial progression. This property will be measured in terms of average probability. • Novelty: Given the same input sequence, several possible outcomes are appropriate. This property will be measured in terms of entropy.
Denote by C the given input data (which in our case is a sequence of triads). Let h C be the distribution of consecutive pairs of triads. This distribution defines a Markov process on triads, where the distribution of the next triad is taken from the data (see for example Table 2). However, as stated, this process only relates to the familiarity condition. We therefore modify the process by incorporating the entropy.
A new distribution is defined that maximizes a linear combination of familiarity vs. novelty. Let δ be a distribution on Γ, so that ∑ c∈Γ δ(c) = 1. (2) The average favors repeating the most common symbols of C, while the entropy favors a uniform distribution. To balance the two competing effects, the distribution δ is chosen to maximize the function where the parameter µ is fixed and determines the degree of familiarity relative to the input data. Rewrite (5) as follows: where n denotes the number of possible states, which in this case is the cardinality of Γ, namely 24. T is maximized under the constraint ∑ δ i = 1. Define the Lagrange function as follows: Taking the derivative of L by δ i and comparing to zero, yields: More explicitly, Extracting δ i : and summing all arguments: Therefore, leading to the optimal distribution vector Maximizing using the Hessian matrix, It follows that the vector that maximizes the target function is: . Figure 1 shows an example row of a transition probability matrix (h j ) and the effect of µ on the respective output probabilities. Given µ = 1, the transition with highest probability will always be chosen. As µ decreases, the transition probability flattens out. Low values of µ yield a distribution that appears uniform. This can be observed also in Figure 2.

Demonstration Database
In order to demonstrate the modified Markov process and the transformational approach in the following sections, two Beatles' albums were chosen. The first was the Beatles' debut album, "Please Please Me" and the second was the extended LP, "Magical Mystery Tour", their ninth album. The Beatles music is considered as a significant influence on modern popular music and has been well documented [23,24]. In the two albums, song structure is similar, but arrangements and production are extremely different. In terms of style and harmony, Please Please Me is traditional sixties pop music, and contains mainly diatonic chord sequences and blues-based chord sequences. The songs in Magical Mystery Tour include a large degree of repetition, partly influenced by traditional Indian music. Diatonic and blues merge to yield a mixture of major chord based songs as well as songs with very intricate harmonies.
The chords of all the songs used appear in [25]. This book does not include cover versions or instrumental tracks and these were, therefore, omitted. In order to maintain structure, songs were separated into two main parts, 'A' and 'B'. Each A-part or B-part was typically made up of four chords units that were repeated or modified, so for demonstration purposes, four chord progressions were composed using the Markov process. A Markov process was created for each set of parts in each album, and the modified probability matrices were created for various values of µ. New progressions were chosen to begin with the E major chord which happens to be the most frequent chord in Beatles music [23]. This was also important for comparing the results of the algorithms presented below.
Evaluation of new chord progressions depends on the purpose of the algorithm. For example, a method for determining consonance of music, based on Euclidean distance within a tonal interval space, appears in [12]. In [26], evaluation was related to the Wundt curve which describes the relation between complexity and enjoyment.
In the results presented below, evaluation considers two factors-tonality and similarity to the intervals and interval sequences of the input data. As both factors are significant in the quality of the algorithms, the evaluation score was chosen to be the higher value of the two. Table 1 shows sets of four-chord progressions created using the chords in the A-parts of the album Please Please Me as input data. The sets were created for the original Markov probability matrix and for the modified Markov process given µ = 1, 0.9, 0.8, 0.7, 0.6. Table 1. New chord progressions given A-parts of Please Please Me.

0.3
At µ = 1, only the most dominant state is chosen, which happens to be repetition-remaining on the same chord. For high values of µ, new chord combinations appear, with the score remaining similar to that of the original Markov process. Below µ = 0.8, chord combinations become arbitrary as transition probabilities approach uniformity. The score decreases with the decrease in the quality of tonality and compatibility with the original progressions. Although these examples are not statistically significant, they demonstrate the modified Markov method and concur with the tendencies in Figures  1 and 2. The modified Markov process itself does not add new chords to the input database. The transformational will be shown to significantly increase the selection of new chords given the same input progression.

A Transformational Approach
In order to explain the transformational approach, a short chord progression will be analyzed. The two bar progression in Figure 3 was chosen for demonstration. Major chords are represented by upper case letters and minor chords by upper case letters followed by a lower case 'm'. Below the musical stave is the triadic notation of the progression, where (9, −) represents A minor and so on (modulu 12). Below the triads, slightly indented, are the triadic transformations. For example, the triadic transformation between (9, −) and (0, +) is (3, −). Musical notes represent pitch-class rather than actual voice leading. The repetition sign (:) at the end adds transition from G major (7, +) back to A minor (9, −). The triadic transformation is, therefore, (2, −). Transition probabilities were calculated for the triads and for the transformations. For demonstration purposes, and without loss of generality, the new progressions were chosen to be eight bars long, with the first triad and transformation kept at their original values.

Modified Markov Process
As a result that each triad in the progression leads to a different triad, and because the last triad leads back to the first, the average probability of the progression is given by the unit matrix. Using the modified Markov process given µ = 1, the output probability (delta) matrix is identical to the average probability, and the resulting four bar progression would be identical to the original one. Modifying the values of µ would rearrange the given chords into new progressions.

Transformational Modified Markov Process
The probability matrix for the transformations in the progression appears in Table 2.  A sample output progression, given µ = 0.9, appears in Figure 4.  Notice that after the first two bars, which happen to be identical to the original progression, the transformation (4, −) is chosen, leading to B minor rather than to A minor. B minor leads to D major, which follows the original (3, −) transformation; but then, a (3, −) transformation is chosen. This interval, a (3, −) after a major chord, did not appear in the original progression and is non-diatonic. It is an example of an interval that would be used rarely and carefully in composition. Choosing µ = 0.5 yielded the output in Figure 6. The selection of new chords has increased, but the outcome is somewhat random and has little in common with the original progression. This follows from the fact that the transformational approach is atonal and, therefore, does not always correctly capture the tonal nature of the original progression. This limitation of the transformational approach can be moderated by distinguishing between intervals following major or minor chords, an approach inspired by the uniform triadic transformation (UTT) [7].

UTT-Based Approach
Using this approach, given the transition probabilities appearing in Table 2, the decision process would be applied separately for transformations following major chords and transformations following minor chords. In the example, given a minor chord, which occurs after either a (4, −) or a (2, −) transformation, the output transformation is always (3, −), yielding a major chord. Given a major chord, the opposite occurs, and (4, −) or (2, −) will be chosen, yielding a minor chord. Output results are, in this case, independent of the values of µ. Possible output progressions include the original progression ( Figure 3) and the first output progression of the transformational method displayed above ( Figure 4).
In Figure 7, each minor triad is followed by a (3, −) transformation, and each major triad is followed by (4, −) transformation. This progression may be described by the UTT −, 4, 3 . In Figure  8, each minor triad is, again, followed by a (3, −) transformation, but each major triad is followed by a (2, −) transformation. This progression is described by the UTT −, 2, 3 .  Extending these two progressions would eventually include all major and minor triads following what is known as the circle of fifths (consecutive (5, +) transformations) or circle of fourths (consecutive (4, +) transformations).

Large Database
To test the transformational approach, the chords of both Beatles albums were simplified to triads and new chord progressions were created given each album as a separate database. Table 3 shows new four-chord progressions created with the original and modified Markov processes created using the triadic transformations between chords, for µ = 1, 0.9, 0.8, 0.7, 0. At µ = 1 only the most dominant state is chosen, which happens to be repetition-remaining on the same chord. The average score gradually decreases with µ. It is beyond the scope of the current study to actually compare the musical results, however it is interesting to notice that as µ decreases, there is a difference in the new progressions between the two albums. Employing the UTT-based approach is also expected to improve tonality of new progressions.

Sequence Matching
Sequence matching is an essential tool in the fields of bio-informatics and genetics. It is also used as a method for comparing musical compositions [27,28].
Three examples of short progressions were chosen. The first is a repetitive transformational passage from the piece 'Wilde Jagd' by Liszt; the second is a simplification of the main theme of the Radiohead song 'Morning Bell'; and the third is a modified version of the chorus of the Beatles' song 'Hello Goodbye'. The transformational and UTT approaches were applied to the transformations of each progression, given 0 < µ < 1. A thousand new progressions of the same length were created and compared to the original progression in terms of the transformations and the actual triads of each input progression. The following figures show the percentage of maximal sequence matching. Some examples of triad chains generated by order-24 UTTs, chosen from the musical literature, appear in [7]. One of them is an excerpt from Wild Jagd by Franz Liszt. Figure 9 shows the maximal matching of the transformations chosen ( Figure 9a) and the respective output triads (Figure 9b). In this example, the UTT-based approach succeeds in recreating the original progression for all values of µ until just below 1. The transformational approach succeeds in recreating the original progression for all values above approximately µ = 0.7. However, when µ is very close to 1, the results deteriorate. This follows the fact that for µ ≈ 1, only the transformation with the highest probability is chosen, preventing the new progression from completing the original progression (see Figure 1). In [29], the song Morning Bell by Radiohead was analyzed in terms of neo-Riemannian transformations. In terms of maximal sequence matching (Figure 10), the UTT-based method achieves higher results, indicating its capability to reproduce the original progression.

Conclusion
A transformational approach to chord-based composition was suggested within the framework of a modified Markov process. The system optimizes the balance between familiarity, represented by average harmony, and novelty, represented by entropy. The modified Markov itself is not actually limited to harmony and can be used for algorithmic composition of melody, rhythm and possibly other parameters. Combining the modified Markov process with the transformational approach can significantly expand the chord range in the new progressions. one of the disadvantages of using triadic transformations in the Markov process is the atonality of the transformations. The UTT-based approach moderates this problem as it maintains the mode of chord being followed, thus improving tonality as well as sequence matching. The algorithms were demonstrated given a short chord progression and also given a larger database of albums by the Beatles. Further work is expected to include more evaluation examples, on the one hand, and real-time application, on the other.