I have worked during the previous weeks on some transpositions features for Flat. I will try to explain in this post what is the logic behind music intervals.
Intervals are defined with 2 values: diatonic and chromatic.
This is all a matters of intervals. Let's take a simple piano keyboard.
We will start from the C. The diatonic shift is the number of white keys you you have to move to reach the destination pitch. If you move to a D, you shift of one white key: the diatonic value is 1. If you move to F, you shift of 3 white keys, the diatonic value is 3.
There is a specific vocabulary for each diatonic value: if you stay on the C, this is called unison. If you move to the D, it is called a second. For a F, it is called a fourth.
Let's add that to the table:
The chromatic value is the number of keys you have to move, including black keys. To move from C to E, you move of 4 keys, but to move from C to F, you move of 5 keys. There are also musical terms for these values of chromatic. Let's update the table:
You can add alterations to base pitch steps: from G, you can make a Gb, or a G#. What are the corresponding intervals? Since the base pitch step is G, the diatonic value will stay the same, 4. It is the chromatic value that will change: 6 for Gb, 8 for G#. And each of these variation has a musical name.
But wait, E# has the same chromatic value than F. This is because they are on the same key: they have the same sound. It is the chromatic value that will tell what is the actual sound. The diatonic value will tell us how do we write this sound. Two notes with the same sound but different writting are called enharmonic. For instance: E# and F, E and Fb, B and Cb.