G# is a magic note. It takes the vanilla, banal, bland sound of a major scale and makes it into music. Here’s how.
Now read an listen to the start to Invention 13 by Bach. Again, pay attention to the G sharps, but also what the sound is where he leaves them as G natural.
Both pieces are nominally in A minor (relative to C Major) but make heavy use of modulation to G Sharp.
Lets start with the basic C scale
For every major scale, there is a relative minor. The relative minor scale is created by playing the major scale but starting and ending on the 6th note. For the Key of C major, the relative minor is A minor. It has no accidentals.
The harmonic minor scale is created by lifting the G one Half step:
By raising that note, it makes an interval of a a minor third between the F and the G#. This strongly emphasizes the minor effect.
When we start working with the relative minor, using the G sharp converts what was originally an E minor chord into an E major chord
Conversion to the blues scale.
This sound is used for so much more than just Baroque. Lets go back to our C scale, but this time play it from D to D. This is called the Dorian mode.
If We drop out the E and the B, we end up with a minor Pentatonic scale.
If we add in that G# again, we get a blues scale.
If we rotate back to the Root position, we have a major blues scale:
Back in the late 1930s, a Jazz musicians were looking for ways to get their lines of eighth notes to flow. The problem is that a major scale has 7 distinct pitches in it, but a measure has 8 spaces to fill. This means that a pattern of eighth notes does not fallout on the same down beat after a measure. Note where the chord tones fall on the following phrase.
For the first 7 beats, the C Maj 7 Chord tones are on the down beat. C On 1, E on 2, G on 3, and B on 4. But the C repeats on the upbeat of 4, and the downbeat of one in the second measure is, again, a non chord tone. This is much closer to a a D minor line than a C major line.
If we add in the G Sharp, the line now falls out so that all the major chord tones are on down beats. We adjust our expectation so that A (the Sixth) is the fourth tone of the scale.
This works for the minor and Seventh chords as well. A D minor riff:
A G 7 Riff
All this by adding the blues note.
Of course, this is only for the Key of C. The same relationship works in any key. You take the Fifth tone and sharp it. For example, in the Key of G, you sharp the D.
I tried to illuminate this concept on the Saxophone a while back. There is a gaffe here where I mixed up the keys, but it does make the point.