Scale Degrees

This module explores how to identify the scale degree of notes in a melody.

All major and minor scales (known collectively as “diatonic” scales) contain seven different notes. After the seventh note, the first note repeats again. For example, the C major scale contains the notes C-D-E-F-G-A-B, then repeats C at the top.

We often refer to the notes of the scale by a number, called the scale degree, that describes its place in the scale. C is 1, D is 2, E is 3, F is 4, G is 5, A is 6, and B is 7. The C at the top is 1 again. This numbering system can be applied to any diatonic scale.

The first scale degree, also known as the tonic, always has the same name as the scale (the tonic of G major is G, the tonic of F minor is F, etc.). Melodies often exhibit a pattern where they emphasize the tonic at the beginning, move away from the tonic in the middle, and then return to the tonic at the end.

Let’s use the tinyNotation feature of music21 to enter a simple example:

from music21 import *

twinkle = converter.parse('tinyNotation: 4/4 c8 c8 g8 g8 a8 a8 g4 f8 f8 e8 e8 d8 d8 c4')

(To learn more about tinyNotation, check out this page.)

Play the example on the piano, or use MIDI playback if your XML viewer supports it.

This familiar melody (originally composed by Wolfgang Amadeus Mozart) is in C major and, following the pattern described above, begins and ends on the note C. It begins on the tonic, drifts away in the middle, and comes home to the tonic at the end.

Of course, it’s a rather simplistic example in some ways, but this basic principle holds true for quite a lot of music!

We already know that this example is in C major, but what if we didn’t? The music21 toolkit allows us to analyze the key of any given passage, and it will output its best guess:

> <music21.key.Key of C major>

This is a pretty clear-cut example, but if we need to, we can check how certain the algorithm is by asking for what’s called the correlation coefficient. In a nutshell, this value indicates how likely the algorithm’s guess is to be correct. Values range from -1 to 1, and the closer to 1 the value is, the more likely it is that the key is correct:

> 0.9181760752214703

The value of about 0.92 is quite solid–generally anything over 0.7 indicates a strong correlation, meaning a good guess.

The music21 library has numerous tools for working with scale degrees. Now that we’re certain of our key, let’s identify the scale degree (number) of each note in our melody. After saving the results of our analysis as a key object, we can use the “getScaleDegreeFromPitch” function:

twinkey = twinkle.analyze('key')

> 1

> 5

Rather than go through each of these one by one, however, let’s label each note with its scale degree, using a for loop to iterate over each note in the melody:

for each_note in twinkle.recurse().notes:

(We use the addLyric function to label, and we use recurse() to iterate through multiple hierarchical levels of the notation stream.)

Then close your notation display and re-load it:

Each note in your example should now display its scale degree beneath it.

Let’s try a different example. We’ll look at an art song by Robert Schumann called “Aus meinen Tränen sprießen,” or “From My Tears Spring,” from a well-known cycle of songs called the “Dichterliebe” or “Poet’s Love,” composed in 1840. We can import this song from the music21 corpus:

dichter = corpus.parse('schumann/dichterliebe_no2.xml')

The key signature of three sharps could indicate A major or F-sharp minor. Let’s check:

> <music21.key.Key of A major>

> 0.9584567342005961

This example is even more clearly in A major than the previous example was in C major. Let’s label the notes of the melody (the top line) with their scale degrees, as above:

dicht_key = dichter.analyze('key')

for each_note in[0].recurse().notes:

(Note that we add .parts[0] after dichter so that we only label the scale degree of the notes in the vocal melody, and not in the piano part.)

Interestingly, this vocal melody does not seem to have a strong attachment to the tonic. It begins on the third scale degree, ends on the second, and spends very little time on the tonic throughout. It might be interesting to see whether we get a different result if we analyze the key of the melody only, rather than including the piano part:[0].analyze('key')
> <music21.key.Key of f# minor>

Sure enough, without the piano part, the algorithm’s best guess is the relative minor of A major: F-sharp minor. Let’s see how certain this guess is:[0].analyze('key').correlationCoefficient
> 0.6116392575104956

A coefficient of 0.61 is not particularly strong–certainly much less than before. In other words, this seems to be a particularly ambiguous melody when it comes to a sense of key.

We can check what the next-best guesses were using the alternateInterpretations function:[0].analyze('key').alternateInterpretations[0:4]
> [<music21.key.Key of A major>, <music21.key.Key of b minor>, <music21.key.Key of F# major>, <music21.key.Key of g# minor>]

(The indices 0 to 4 specify to display the four next-best guesses–you can view any amount of guesses you like.)

As a composer, Robert Schumann was known for his innovative approach to harmony and melody, often emphasizing ambiguities where his contemporaries were more direct. The range of key possibilities in this short analysis speaks to the sense of ambiguity in his music, often described as dreamlike. It also demonstrates how much musical style depends on the presentation of scale degrees in the melody.


  1. Try playing or listening to the Schumann melody by itself. Can you hear it in F-sharp minor? What if you (or a friend) plays an F-sharp minor chord underneath?
  2. Try adding the scale degree labels for F-sharp minor, or another of the alternate key guesses, to the Schumann example.
  3. In listening to the Mozart and Schumann examples, do any of the scale degrees evoke a certain feeling or emotion? Is there a sense of drive or motion towards any? How would you compare the role of the tonic in both melodies?

Further Reading

Check out the Open Music Theory entry on scales and scale degrees.