# Is it possible that a music piece written in a “flat key signature” contains sharp-accidentals (and vice versa)?

E.g. the key signature G Major contains one sharp (which is why I consider it as a "sharp key signature"). Can a music piece written in G Major contain a Db? Or can it only be a C# because the key siganture "doesn't allow for flats"?

Even if a Db is "allowed", is it common to not use C#?

(Sorry for my sloppy technical terms)

• Accidentals don't necessarily match the key signature. In a G major song, you can have a chromatic passage like D-Db-C – Shevliaskovic Apr 4 '16 at 16:33
• Possible duplicate of Can a scale contain both a sharp and a flat note? – leftaroundabout Apr 4 '16 at 19:18
• @leftaroundabout I looked at that other question before posting my answer and I didn't see it as a duplicate. The reason why is because the other question is about constructing scales that have mixed accidentals - in which case one could write a key signature with mixed accidentals as a way to make notation easier. This question is about whether one would see the opposite accidental to a traditional key signature in a piece. – Todd Wilcox Apr 4 '16 at 19:58

As an example (this is fairly common) below is an excerpt from a Bagatelle in C minor by Beethoven (imslp link).

Notice the F and C (!!) are sharpened. Also notice As and Es are natural. So what's happening here is that Beethoven is going outside the key for a bit, probably using borrowed chords (I'm not as fast an analyzer as I should be).

Why does he use F♯ and C♯ instead of D♭ and G♭? I hand analysis over to MattPutnam (emphasis mine):

The first measure starts and ends with a G minor chord. The middle beat is acting as a secondary dominant to that G minor, which needs an F♯ (I would call it vii°/V). Similarly in the next bar, the middle beat is C♯° leading into D. Using a D♭ or G♭ would be a harmonic mess, not to mention the difficulty of reading G-G♭-G♮ and D-D♭-D♮.

Another good reason would be to make the piece easier to read and/or play. See this question: Temporarily Changing Keys - Which accidentals to use?

• In your example: The first measure starts and ends with a G minor chord. The middle beat is acting as a secondary dominant to that G minor, which needs an F# (I would call it vii°/V). Similarly in the next bar, the middle beat is C#° leading into D. Using a Db or Gb would be a harmonic mess, not to mention the difficulty of reading G-Gb-Gnatural and D-Db-Dnatural. – MattPutnam Apr 4 '16 at 15:54

You can definitely encounter things like this for a variety of reasons. One place you would frequently see this is within a key such as D minor (1 flat); in common practice theory, the seventh degree is altered (when needed) to create a leading tone and within D minor, this would be C#. Other chromatic activity will also be best spelled out through #s even when it could be written in flats/double flats and vice versa. The Db from your example would would make a lot of sense in a descending line (D-Db-C). This is due to a convention within the music community to have linear chromatic motion spelled with the direction of the motion (# when ascending/b when descending). This makes things easier to read as well as indicating what is happening in the music, ie which direction the reader should expect to go. Melodic minor is a good example, where ascending lines will use 6 and 7 and descending lines will use b6 and b7 (in D minor: b6=Bb; 6=B; b7=C; 7=C#). For one last example (though there are plenty), borrowing chords from parallel keys/modes: in G major (1 sharp) you could 'borrow' a Bb major chord (which comes from the parallel minor).

So there are a variety of reasons you might see this sort of activity. Some more you can look into on your own: Augmented 6 chords; b9/#9 chords; contemporary music with scales containing more than 7 notes; tone clusters; and more!!!

For accidentals, one often chooses to write a sharp if the next note moves upwards and a flat if it moves downward. For example, in G major, a Db would usually moved down to C and a C# move upwards to D. This avoids having a large number of naturals (C,C#,D vs C,Db,Dn for example.) Likewise, were the current chord an A major chord, C# would be preferred to Db regardless of melodic movement. To some extent, it's just the composer's preference. I would try to write what's easiest to read.

Technically speaking, you can use any number of accidentals and occasionally it is appropriate to use double accidentals. Another thing to keep in mind is that a c sharp is NOT the same note as a d flat. They are only the same on a piano or other statically tuned instruments which have to use a single temperament to play all keys (there's probably a better source but this'll get you started: https://en.wikipedia.org/wiki/Piano_tuning#Temperament). On all other instruments, like wind instruments and string instruments, you can adjust the precise pitch of every note to match the key you're in or the chord you're playing. This makes the c sharp higher than a d flat.