Many melodies use notes from outside the major scale, particularly in styles such as Blues, Jazz, Rock and Funk. These extra notes relate to the chromatic scale starting on the same note as the major scale of the key the music is written in.
Therefore, if you have a piece of music in the key of C which contains notes which are not in the C major scale, you can relate those notes to the C chromatic scale.
The "in between" notes in the chromatic scale can be described as either sharps or flats. Because of the way scales and chords are constructed, flats are used more often than sharps. Here once again is the C chromatic scale with scale degrees written under the notes. The scale degrees written here relate to the natural notes and the flat notes. The sharps are enharmonic equivalents, which means they are the same pitch (e.g C# = Db, and F# = Gb).
The following example demonstrates a melody in the key of C which contains notes from outside the major scale.
Here is the melody from the previous example transposed to the keys of F and G. Once again, you should transpose it to all the other keys. Before doing this it is worth learning to play the chromatic scale starting on any note. Once you can do this, you will find it easier to play melodies in any key and also make it easier to transpose any melody that you learn in any key.
Chromatic notes are commonly used to create smooth lines connecting one chord tone with another. They can also be used between any two notes of any scale. Here are some examples.
In this example, chromatic notes are used to create tension. This is common in Metal playing and also in Jazz and Fusion.