Describing Melodies with Metrics

One of the patents granted to Skiptune LLC by the U.S. Patent Office involves the use of metrics to compare tunes or melodies. We introduced the idea of comparing melodies in the section on Chernoff Faces, which use human faces to compare tunes and genres with each other. That technique, while both useful and entertaining, is highly subjective, depending as it does on our individual ability to discern human faces, as well as the somewhat arbitrary way of assigning metrics to face parts. Here, we use the metrics we developed to describe tunes or melodies to compare them with each other.  The concept is simple:  calculate each metric for each tune, sum the metrics for each tune, and subtract the two sums to find the difference.  The closer the difference is to zero, the more likely the two tunes will be similar.

To demonstrate how the metrics can be used to compare tunes, we use as our example a dancing tune from the 17th century called Devil’s Dream, found in the 1657 and 1670 versions of the Dancing Master, compiled by John Playford.  Here are the two tunes:

Figure 1 -- Devil's Dream, second strain, from Dancing Master 1657
Figure 1 — Devil’s Dream, second strain, from Dancing Master 1657
Figure 2 -- Devil's Dream, second strain, from Dancing Master 1670
Figure 2 — Devil’s Dream, second strain, from Dancing Master 1670

These tunes are almost, but not quite, identical. The only differences between the two melodies are in the second and sixth measures.  In each of those measures, the change is the same:  The “C#” half note and the “D” quarter note switch places.  Table 1, following, lists how our music metrics describe each tune numerically.

Table 1 — Comparing Two Versions of ‘Devil’s Dreams’

Metric NumberName of MetricRaw Metric,
1670 version
Normalized Metric, 1670 versionRaw Metric, 1657 versionNormalized Metric, 1657 versionDifference (Normalized)
0Patterns/Note (%)390.407390.4070
1# One-Time Patterns 40.04240.0420
2One-Time Patterns/Tune Patterns (%)310.31310.310
3One-Time Patterns/Note (%)120.13120.130
4# Rests/Note00000
5Avg Pitch Diff w/Rests 1.70.021.70.020
6Avg Pitch Diff w/o Rests 1.70.121.70.120
7Common Patterns (%) 1.90.231.90.230
9Range 100.1510.0150
10Avg Duration Ratio 1.40.11.40.10
11# Runs/Note (%) 640.64640.640
12Run Length/Note 1.430.111.430.110
13Max Run Length 40.1340.130
14# Repeating Durations 180.18180.180
15# Repeating Pitches 60.0660.060
16Spread of Pattern Frequencies (Wtd) 2.90.62.90.60
17Spread of Pattern Frequencies (Un-Wtd) 3.30.683.30.680
18Pick-Up Note Duration 00000
19Pick-Up Note Duration (%)00000
20Duration Ratio to Rests 00000
21Duration Ratio from Rests 00000
22# Different Pitches 70.170.10
23# Different Pitch Differentials 60.1460.140
24# Different Durations 60.1960.190
25# Different Duration Ratios 80.180.10
26Normalized # Different Pitches 210.23210.230
27Normalized # Different Intervals 180.25180.250
28Normalized # Durations 180.28180.280
29Normalized # Duration Ratios 240.33240.330
30# Repeated Pitch Diff (%) 00000
31# Repeated DurR (%) 60.0660.060
323-Note Palindromes (%) 300.37240.30.07
TOTAL0.07
List of metrics and their numerical values for each of the versions of Devil’s Dreams, one from 1657 and the other from 1670
NOTE: Metrics #8 and #33 are missing because they do not apply to individual tunes.
The only difference in any of the metrics between the two tunes is the number of 3-note palindromes, metric #32 in the table. This is somewhat surprising because one would expect that any change in notes between two otherwise identical tunes would produce a larger difference in the metrics.  But on inspection we find that these tunes really have identical 2-note patterns differing primarily in their order. This feature results in almost identical metrics.  Following are some examples explaining this phenomenon in these two melodies:
  • Patterns per note: There are 13 patterns in each tune.  Examine the swapped notes in the second and seventh measure and you will see that in each case the order of the patterns are changed, but not the patterns themselves.
  • Number of one-time patterns, one-time patterns per tune, and one-time patterns per note: Because only the order of the 2-note patterns changes, the number of each kind of pattern remains the same. And because each tune is the same length, the normalized pattern metrics remains the same.
  • Intervals (pitch differences) and common patterns: Because the patterns themselves are the same in each tune, both the interval metrics and the percent of common patterns used are also the same.
  • Range metrics: The changes in measures 2 and 7 do not affect the range because while they involve the highest note (a “D”), they don’t change it to another pitch.

Observation— When the primary or only difference between two tunes is the order of their 2-note patterns, most of the metrics will be the same because many metrics depend on the count of individual patterns.

  • Average duration ratio: Because only the order of patterns changes, the duration ratios themselves do not change.
  • Run metrics: The changes in measures 2 and 7 do not affect the number of runs or their average length, and are not involved in the maximum run (measure 4).
  • Repeating pitches and durations: This particular difference in tunes, because of the particular notes that precede and follow the changed notes, keep the number of repeating pitches and durations the same.
  • The order change of the patterns does not affect their spread (standard deviation).
  • Number of different pitches, durations, intervals, duration ratios, and the normalized versions of these metrics: The changed order of the patterns leaves these counts intact between the tunes. The tunes contain the same number of notes, so the normalized versions are also the same.
  • Repeated intervals (pitch differentials) and repeated duration ratios: The changes in measures 2 and 7 do not involve the notes that either repeat intervals or repeat duration ratios.
Musical Palindromes

We now turn to the single difference between the two tunes as far as our metrics are concerned: palindromes. There are eight 3-note palindromes in the 1657 version of “Devil’s Dreams” and 10 palindromes in the 1670 version.  (The palindromes are easy to count as they are all either a D quarter-C# half-D quarter note or C# half-D quarter-C# half note.)  This difference in palindrome count results in the palindrome metric having a difference between the two tunes of 0.07.

This page introduced and explained in detail how the Skiptune metrics can be used to assess the similarities between tunes in an analytic, numerical manner.  Other pages on this topic provide more examples but without the detail of marching through each metric.