
April 29, 2004
Assessment of Similarity Using the Spiral Array Model
Similarity in music is difficult to quantify. We learned of some approaches to measuring similarity in Tillman Weyde’s papers. His papers discuss segmentation and similarity. Segmentation is identifying the building blocks of a melody. Similarity is a measurement of motif relations such that “understanding a melody depends on the recognition of the motif as intended by the composer.”1 An attempt is made to quantify how a musical piece is understood and determine if motif relations are similar.
To quantify the underlying structure of a piece, the Spiral Array Model2 is used. The Spiral Array is a geometric representation of tonality that mimics how humans understand tonality. The location of a tonality in the Spiral Array is called the Center of Effect (CE). Graphically, the CE is a summation of pitches for a given time.
Once a numerical value of tonality is generated, similarity can be calculated mathematically using the Pearson Coefficient. Inspiration for this approach is from Humdrum’s3 correlation command. The Pearson coefficient measures the amount of linear relation that exists between two arrays of numbers.
The theory that prompts this study is if motifs or variations are derived from a theme, they have the same underlying structure as the theme. The test data used is Mozart’s Variations of “Twinkle Twinkle Little Star.” The CE values are generated for the theme and the variations using Matlab. Three approaches to CE generation are used. For the analysis, the CE values from the theme are compared to CE values from each variation and the presence of similarity is determined.
The process of data generation, collection, and analysis is described in this section.
The input data is generated using Matlab’s text editor. Each pitch uses three character spaces for input. For example, the pitch A is entered as ‘a _ _’. The note B flat is entered as ‘b f _’. Similarly, F double sharp is entered as ‘f s s’. The note index consists of all possible pitch spellings ignoring octave effects. Below is the first section of the Theme and the corresponding input file. Notice that there are eight lines of data per measure. The time interval of each line for all data files is one 16th note. This interval is chosen because it is the shortest note present in the theme and variations 1-10.

'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'g ','e ','r '
'g ','e ','r '
'g ','e ','r '
'g ','e ','r '
'g ','c ','r '
'g ','c ','r '
'g ','c ','r '
'g ','c ','r '
'a ','f ','r '
'a ','f ','r '
'a ','f ','r '
'a ','f ','r '
'a ','c ','r '
'a ','c ','r '
'a ','c ','r '
'a ','c ','r '
'g ','e ','r '
'g ','e ','r '
'g ','e ','r '
'g ','e ','r '
'g ','c ','r '
'g ','c ','r '
'g ','c ','r '
'g ','c ','r '
'f ','d ','r '
'f ','d ','r '
'f ','d ','r '
'f ','d ','r '
'f ','g ','r '
'f ','g ','r '
'f ','g ','r '
'f ','g ','r '
'e ','c ','r '
'e ','c ','r '
'e ','c ','r '
'e ','c ','r '
'e ','a ','r '
'e ','a ','r '
'e ','a ','r '
'e ','a ','r '
'd ','f ','r '
'd ','f ','r '
'd ','f ','r '
'd ','f ','r '
'd ','g ','r '
'd ','g ','r '
'd ','g ','r '
'e ','g ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
'c ','c ','r '
For a list of all possible inputs, see the function noteindex.
The program consists of various functions to convert the text input into the CE values. The first step of this conversion is the note2number function. This function takes the text values from the input files and outputs a location matrix. The numbers in the matrix indicates the order in which the pitch appears in the spiral array starting from the base. Next, the positioner function is used to convert the location number into the XYZ coordinates of the pitch location. This position matrix is the used by the CE functions to generate the desired output.
Three CE generation methods are observed. The first method is CE calculation by measure. The function MeasureCE calculates the CE values for each measure.




The second method is by section. The function SectionCE calculates the CE for each part of the theme or variations. A section is defined as the notes located between repeat signs.


The third method is a cumulative method. The function CumulativeCE calculates the first CE value as the CE of the first measure. The second CE value is the CE of the first and second measures. The third CE value is the CE of the first, second, and third measure. Each measure is given equal weight. This continues for the entire data file.




The method of assessment for similarity is inspired by Humdrum’s similarity command. In humdrum, the correl command is used to measure similarity between two arrays of numeric data. The command calculates Pearson’s coefficient of correlation between the two arrays. The equation used to calculate the coefficient, r, is:

The two array are x and y. The average of each array is xbar and ybar.
The range of this coefficient is between +1 and -1. A value of +1 indicates the path of the arrays rise and fall in precise synchrony. A value of -1 indicates that the two arrays are exactly reversed. A value of zero indicates that the two arrays are statistically independent of each other.
The CE values for a dimension of the theme is compared to the CE values of the same dimension for a variation. For example, the x dimension of the theme is compared to the x dimension of variation 1. The y and z dimensions are compared as well in this manner. The result is a three dimensional value of the Pearson coefficient for each variation.
The table below shows the Pearson Coefficients for each variation compared to the theme.
|
|
X |
Y |
Z |
|
Variation1 |
0.534 |
0.895 |
0.447 |
|
Variation2 |
0.850 |
0.829 |
0.341 |
|
Variation3 |
0.623 |
0.865 |
0.483 |
|
Variation4 |
0.875 |
0.813 |
0.066 |
|
Variation5 |
0.894 |
0.877 |
0.060 |
|
Variation6 |
0.744 |
0.886 |
0.472 |
|
Variation7 |
0.651 |
0.856 |
0.517 |
|
Variation8 |
0.336 |
0.672 |
-0.323 |
|
Variation9 |
0.657 |
0.746 |
-0.163 |
|
Mary |
0.028973 |
-0.06711 |
0.070669 |
To help visualize these values, the graph below shows the x, y, and z values for each variation. From left to right is variation 1 through 9.

For variations 1 through 7, all Pearson coefficient values are greater than zero which indicates that the values rise and fall in the same manner, but not necessarily in precise synchrony. Variation 8 is a minor version of the theme. The coefficients for this variation are not near zero which indicates a level of relation between the theme and this minor variation. The z dimension appears to have a reversed relation to the theme. Variation 9 is a cannon version of the theme. It is interesting that although this variation returns to the original major key, it has a similar relation to the theme as the minor variation. In general, it appears that the form of similarity comes in pairs. The Pearson coefficients of Variation 1 and 3 have a similar relation between the x, y, and z dimensions. This is also noticeable for variations 4 and 5, 6 and 7, and 8 and 9.
The values to on the far right side of the graph are the Pearson coefficients for the theme compared to “Mary had a little lamb.” In theory, if the two arrays are statistically independent, the value of the Pearson coefficient should be zero. The coefficient in all three dimensions is significantly closer to zero than the variations.
The variations do not appear to behave in precise synchrony with the theme. To determine if any precise synchrony exists between the theme and the variations, the CE values for each section of the pieces are observed. A section is defined as the notes that occur between repeat signs. This definition is sufficient because at each repeat sign, a full cadence occurs (dominant to tonic) and tonality is established. Below is a table of the Pearson coefficients for each variation using the section method:
|
|
X |
Y |
Z |
|
Variation1 |
1 |
1 |
1 |
|
Variation2 |
1 |
1 |
1 |
|
Variation3 |
1 |
1 |
1 |
|
Variation4 |
1 |
1 |
1 |
|
Variation5 |
1 |
1 |
1 |
|
Variation6 |
1 |
1 |
1 |
|
Variation7 |
1 |
1 |
1 |
|
Variation8 |
-1 |
1 |
1 |
|
Variation9 |
1 |
1 |
1 |
For all dimensions, variations 1-7 and 9 establish tonality in precise synchrony even though the actual CE values for the sections are not equal. This indicates there is definite similarity between the theme and its variations. Variation 8 has a -1 value for the x dimension. This indicates that the x dimension is not in precise synchrony; rather, it is exactly reversed. This dimension is similar and opposite of its corresponding theme dimension.
The table below shows the Pearson Coefficients for each variation compared to the theme using the cumulative method.
|
|
X |
Y |
Z |
|
Variation1 |
0.439423 |
0.999304 |
0.994816 |
|
Variation2 |
0.783676 |
0.975289 |
0.948379 |
|
Variation3 |
0.26967 |
0.984178 |
0.93925 |
|
Variation4 |
0.552499 |
0.988937 |
0.9707 |
|
Variation5 |
0.975552 |
0.998043 |
0.951154 |
|
Variation6 |
0.334394 |
0.994814 |
0.9364 |
|
Variation7 |
0.21404 |
0.999666 |
0.993617 |
|
Variation8 |
0.516818 |
0.125388 |
0.830378 |
|
Variation9 |
0.983016 |
0.98422 |
0.954086 |
|
Mary |
-0.24758 |
-0.02441 |
0.181535 |
To help visualize these values, the graph below shows the x, y, and z values for each variation. From left to right is variation 1 through 9.

For the cumulative approach, it appears that there is a high level of similarity between each variation and the theme. Variations 5 and 9 are in nearly precise synchrony to the theme. Variations 1-7, and 9 have at least two dimensions that a very near synchrony. Variation 8 is the least similar, yet still maintains a positive relation to the theme.
Again, the values to on the far right side of the graph are the Pearson coefficients for the theme compared to “Mary had a little lamb.” The coefficient in all three dimensions is significantly closer to zero than the variations however less so than in the CE by measure method. One possible reason for this is that the theme and the new data set establish the same tonality of C Major.
A possible improvement to the cumulative method would be a weighted calculation of the CE or a sliding window of observation. The weighted method would place a greater strength on the most recently played notes. A sliding window approach would calculate the CE values of overlapping segments of the piece. Whether these approaches would result in greater similarity is uncertain.
This experiment was performed to determine if variations of a theme have a similar tonal structure to the theme. The Spiral Array Model creates a geometric representation of how tonality is established in a piece. This model was used to quantify how the theme and its variations established tonality. A statistical approach was used to measure how similar the tonal structure of a variation is to the tonal structure of its theme. The results indicate a significant relation between a theme and its variations. The perception that a variation sounds similar to a theme is no longer an abstract concept, but is now a quantifiable characteristic.
The Spiral Array Model has been proven to be a good way to represent the underlying structure of tonality. This experiment additionally verifies the model’s strength by quantifying the similarity between a theme and its variations.
1. “Integrating Segmentation and Similarity in Melodic Analysis,” Tillman Weyde
2. “Modeling Tonality: Applications to Music Cognition,” Elaine Chew
3. “Humdrum Toolkit User’s Guide,” www.music-cog.ohio-state.edu/Humdrum