In music, an interval is the distance between two notes--whether played simultaneously or one after the other. Intervals are calculated by first determining the "base interval," and then determining the "interval quality."
Let's begin by determining the base interval, which simply involves counting the lines and spaces between the notes (including the lines or spaces that the notes are on). For example, in the picture below there is a 4 below the notes C and F. This base interval of a fourth was determined by counting the C note, then the space above it (D), the line about that (E), and then the F note. Because four notes were named (C-D-E-F), the interval is "a fourth of some kind" (since we do not yet know the interval quality).
Sharps and flats have no effect when determining the base interval, as can be seen in the two pictures below:
Now let's look at the steps required for determining the interval quality. It's important to note that this step cannot change what we determined in the first step. If an interval is "a fourth of some kind" it will remain "a fourth of some kind" regardless of how it is impacted by flats and sharps. Interval quality is expressed using one of the following terms: diminished (d), minor (m), Major (M), Perfect (P) or Augmented (A). Intervals of 1, 4, 5 and 8 can only be Perfect, diminished or Augmented. In these intervals a half-step below the perfect interval is diminished and a half-step above the perfect interval is augmented. Intervals of 2, 3, 6 and 7 can be diminished, minor, Major, or Augmented. In these intervals a half-step above the major interval is augmented, a half-step below the major interval is minor, and 2 half-steps below the major interval is diminished.
Let's look at the same example we looked at before, the interval from C to F with "P4" listed below it in the first picture. We begin by counting the number of half steps between the notes (this time we don't count the first note). From a C to a C# is 1 half-step, then from C to D is 2 half-steps, from C to D# is 3 half-steps, from C to E is 4 half-steps, and from C to F is 5 half steps. An interval of a fourth (determined in the first step) that contains 5 half-steps is referred to as a Perfect 4th. The two pictures below show all of the diatonic intervals in the scale of C Major:
If an interval is greater than an octave, the highest note is transposed into the same octave as the lowest note and the base interval and interval quality are determined. Then 7 is added to the base interval for each octave transposition. For example, to calculate the interval from middle C to the D above high C, we first calculate the interval from middle C to the D two keys above it, which is a Major 2nd. Then we add 14, since we transposed the top note two octaves lower, and describe the interval is a Major 16th.
When calculating interval quality, first determine the number of half-steps between the two notes. Then start with the C note and move up that same number of half-steps. The pictures below display every possible chromatic interval within a single octave beginning with middle C.
Sometimes intervals must be written by using a double sharp, as in the example below:
The process of calculating musical intervals, while difficult at first, will become easier with time and practice.