

In traditional notation, this influence of the new accidental applies for the duration of the measure before the key signature resumes its "dominion", or until canceled by a subsequent new accidental. (For instance, in our example, if the key signature contains F-sharp but a written note F appears with a natural sign written in front of it, F-natural should be played). An accidental immediately preceding the written note always takes precedence.

Often, however, an accidental contradicting the direction of the key signature will appear immediately before the written note. For example, if the key signature consists of only F-sharp, each written note F in the piece should be played as F-sharp, even though no sharp immediately precedes the written note. (In this way it differs from a time signature, which need be written only once). The key signature determines the pattern of accidentals - sharps and flats - to be played, and reappears at the beginning of each staff. A key signature serves as a guide for the performer of a piece of music.
