You are here: MusicXML Reference > Score Schema (XSD) > Elements > Element: key

Element: key

Description

The key element represents a key signature. Both traditional and non-traditional key signatures are supported. The optional number attribute refers to staff numbers. If absent, the key signature applies to all staves in the part.

Derived By

Type key

Attributes
Name  Type  Required?  Default  Description 
number  staff-number  No  The optional number attribute refers to staff numbers.
default-x  tenths  No 
default-y  tenths  No 
relative-x  tenths  No 
relative-y  tenths  No 
font-family  comma-separated-text  No 
font-style  font-style  No 
font-size  font-size  No 
font-weight  font-weight  No 
color  color  No 
print-object  yes-no  No 
Content Model

Contains elements as defined in the following table.

Component  Type  Occurs  Default  Description 
  1..1 
  1..1 
  0..* 
key-step  step  1..1 

Non-traditional key signatures can be represented using the Humdrum/Scot concept of a list of altered tones. The key-step element indicates the pitch step to be altered, represented using the same names as in the step element.

key-alter  semitones  1..1 

Non-traditional key signatures can be represented using the Humdrum/Scot concept of a list of altered tones. The key-alter element represents the alteration for a given pitch step, represented with semitones in the same manner as the alter element.

key-accidental  accidental-value  0..1 

Non-traditional key signatures can be represented using the Humdrum/Scot concept of a list of altered tones. The key-accidental element indicates the accidental to be displayed in the key signature, represented in the same manner as the accidental element. It is used for disambiguating microtonal accidentals.

  1..1 
cancel  cancel  0..1 

A cancel element indicates that the old key signature should be cancelled before the new one appears. This will always happen when changing to C major or A minor and need not be specified then. The cancel value matches the fifths value of the cancelled key signature (e.g., a cancel of -2 will provide an explicit cancellation for changing from B flat major to F major).

fifths  fifths  1..1 

The fifths type represents the number of flats or sharps in a traditional key signature. Negative numbers are used for flats and positive numbers for sharps, reflecting the key's placement within the circle of fifths (hence the type name).

mode  mode  0..1  The mode type is used to specify major/minor and other mode distinctions. Valid mode values include major, minor, dorian, phrygian, lydian, mixolydian, aeolian, ionian, locrian, and none.
key-octave  key-octave  0..* 

The optional list of key-octave elements is used to specify in which octave each element of the key signature appears.

Referenced By
Example

Traditional

        <key>
          <fifths>-3</fifths>
          <mode>major</mode>
        </key>

Non-traditional

        <key>
          <key-step>B</key-step>
          <key-alter>-1</key-alter>
          <key-accidental>quarter-flat</key-accidental>
          <key-step>E</key-step>
          <key-alter>-2</key-alter>
          <key-accidental>slash-flat</key-accidental>
          <key-step>A</key-step>
          <key-alter>-2</key-alter>
          <key-accidental>slash-flat</key-accidental>
          <key-step>F</key-step>
          <key-alter>2</key-alter>
          <key-accidental>sharp</key-accidental>
        </key>

Definition

See attributes

 

MusicXML Documentation Home
Last built 2/20/2015

7007 Winchester Circle, Suite 140

Boulder, CO 80301