key a set of sharps or flats

Key signatures are the fast way to indicate flat and sharp notes for an entire melody. Keys can be Major or Minor and exist for every note in the 12 tone scale.

Major Key Signature

In a multiline song, indicate key signatures with a K: line, like this:

play """
  K: Db 
  DEFGABC'D'
"""

In the key of D flat major, every D, E, G, A and B is flat.

Names of key signatures are written using b (lowercase b) for flat and # (shift-3) for sharp. This is different from the way sharps and flats are written for individual notes in a melody.

Minor Key Signature

In the key of D sharp minor, every D, E, F, G, A, and C is sharp.

play """
  K: D# minor 
  DEFGABC'D'
"""

Notice how the scale has a very different character when written in a different key signature.

Extra Sharp for Harmonic Minor

Individual accidentals can be added to the key signature by listing the notes with ^ for sharp and _ for flat.

For example, the harmonic D# minor key adds a double-C-sharp to the melodic D# minor scale. It can be written like this:

play """
  K: D# minor ^^C 
  DEFGABC'D'
"""