# # Calculating interval names

8th November, 2018

Given two notes, how might we work out the name of the interval between?

What makes an interval a minor third or major third, a perfect fourth or an augmented fourth, and so on? And in keeping with the approach of this site, how might we write an algorithm to calculate interval names?

There are often multiple approaches to introducing a concept in music theory, just as there are in pure mathematics. You can start with X and develop Y from that, or start with Y and develop it into X. So this is just one way to think about interval naming but it's precise and hopefully insightful at some level. We'll explore alternatives in future posts.

There are multiple ways to characterise intervals: frequency ratios, semitone distance, etc. But in this post we're particularly interested in names like "major third" and "diminished seventh" consisting of a ordinal number (such as "third" or "fourth") and a quality (such as "major", "minor", or "perfect").

Like the notation of pitch we discussed in How a five-line stave does so much, this naming of intervals is deeply associated with diatonic scales.

In fact, the derivation of the number part of the interval name is simple:

the number part of the interval name is always an indication of the distance in letter name between the pitches (and therefore the distance on the staff).

Somewhat confusingly for programmers and the mathematically inclined, the distance between a letter and itself is 1, not 0; and the distance between, say, A and B is 2.

The interval between a C-something and an E-something above it is always a third regardless of whether the C or E is natural, sharp, flat, double-sharp, or double-flat. Equivalently, if two notes are in adjacent spaces on the staff or on adjacent lines, then the number part of the interval is a "third" regardless of the key or any accidentals.

In the above example, we know this is a third even without knowing the clef or key.

This immediately gives just one example of why, say, A-sharp and B-flat are not the same. They are not only notated differently on a staff but the interval between, say, G and A-sharp is a second whereas that between G and B-flat is a third. Letter names, interval numbers, and the placement of notes on a musical staff are all closely related.

This also means that the number of semitones between two pitches is not enough to give you the interval name. Both the G to A-sharp and G to B-flat interval are three semitones but, as we've said, one is a second and the other a third. The semitone distance is, however, relevant to the interval quality.

One way of approaching the naming of interval quality is to look at whether the semitone distance matches or deviates from what we would expect for the letter difference in a major key starting with the lower of the two notes.

scale degree major scale semitones
1† 0
2 2
3 4
4† 5
5† 7
6 9
7 11
8† 12

The naming of a match (or of deviations) depends on whether the scale degree is marked with an † or not.

If the letter difference is the same as one of the scale degrees marked † (i.e. unison, fourth, fifth or octave) then the quality is named as follows:

deviation quality
-1 diminished
0 perfect
+1 augmented

If the letter difference is the same as one of the other scale degrees (i.e. second, third, sixth, seventh) then the quality is named as follows:

deviation quality
-2 diminished
-1 minor
0 major
+1 augmented

Further deviations, although rare, can be accommodated with the notion of a double-diminished interval, a double-augmented interval, and so on.

So by looking at the letter difference, the expected semitone difference, and the deviation of the actual semitone difference from that expectation, we can produce the complete interval name.

In a later post, I'll provide Python code for doing exactly this. We'll also look at different ways of representing pitches that has an impact on the complexity of the interval name calculation.

Notice that both the names of pitches and of intervals have multiple components. Pitch names have a letter (C, D, E, etc) with some modifier (natural, flat, sharp, etc) and intervals have a number (unison, second, third, fourth, etc) and quality (perfect, minor, major, diminished, augmented, etc). These are both results of the diatonic bias we've seen before and will explore in a lot more detail later.

And if you're wondering what is special about the "perfect" scale degrees marked †, we'll talk about that in a future post too. It might be tempting to think they are the ones whose expected semitone interval is the same in both the major and minor scales. This would be nice because it would also justify the names "major" and "minor" for the other interval qualities. This is almost true but falls down in the case of scale degree 2 which is "major" in both the major and minor keys.

As with everything here, there's still lots more to say. This is just the beginning of modelling intervals.