The whole rest in 3/4 that begins the voice part is represented as: Decimal values can be used for microtones (e.g., 0.5 for a quarter-tone sharp), but not all programs may convert this into MIDI pitch-bend data.įor rests, a element is used instead of the pitch element. This is why the E-flat contains an element, though there is no accidental on the note.Īlter values of -2 and 2 can be used for double-flat and double-sharp. Although the element does not change how the pitch is notated, it ensures proper playback and transposition. The element requires an element, even if the accidental is already in the key signature. MusicXML divides pitch into three parts: the element (A, B, C, D, E, F, or G), an optional element (-1 for flat, 1 for sharp), and an element (4 for the octave starting with middle C). In MIDI, a pitch is represented by a single number. For example, the E-flat that starts bar 3 in the voice part has the following MIDI-compatible elements: Pitch, duration, ties, and lyrics are all represented within the MusicXML element. The element is used when the part should be doubled an octave lower or higher, as when a single part is used for both cello and string bass, or for both flute and piccolo. The element is used when transpositions exceed an octave in either direction. The element is not needed for correct MIDI output, but it helps get transposition notation correct and programs are encouraged to use it wherever possible. This transposition is one diatonic step down (C to B) and two chromatic half steps down (C to B to B-flat). A written "C" on this part will sound as a B-flat on a piano. Say we have a part written for a trumpet in B-flat. The, , and elements are optional elements. The element, representing the number of chromatic steps to add to the written pitch, is the one required element. The element represents what must be added to the written pitch to get the correct sounding pitch. If you are writing a part for a transposing instrument, the transposition must be specified in MusicXML in order for the sound output to be correct. Many variations are possible, including composite and interchangeable time signatures. The element represents the time signature numerator, and the element represents the time signature denominator. Standard time signatures are represented more directly in MusicXML than in MIDI 1.0.
MusicXML uses the element to indicate major or minor key signatures. The fifths name indicates that this value represents the key signature's position on the circle of fifths. The element specifies the number of flats or sharps in the key signature - negative for flats, positive for sharps. Standard key signatures are represented like MIDI key signatures. The divisions value of 24 in this example allows for both triplet eighth notes (being divisible by 3) and regular sixteenth notes (being divisible by 4). However for the broadest app compatibility, it is best to compute just one value per part, placed at the beginning of the first measure.
MusicXML allows the element value to change in the middle of a part. While each musical note could have a fraction associated with it, MusicXML instead follows MIDI by specifying the number of divisions per quarter note at the start of a musical part, and then specifying note durations in terms of these divisions. Musical durations are commonly referred to as fractions: whole notes, half notes, quarter notes, and the like. In this example, we have the following MIDI-compatible attributes: Other elements like and are discussed later in this tutorial. We discuss the MIDI-compatible elements here. The element contains information about time signatures, key signatures, transpositions, clefs, and other musical data that is usually specified at the beginning of a piece or at the start of a measure. This is where we will start in introducing the musical elements of a MusicXML file.Īs an example, we will use the first four bars of "Après un rêve" by Gabriel Fauré: The only elements that are required, though, are the sounding elements that relate directly to creating a MIDI file from MusicXML. We encourage programs writing MusicXML to write as much accurate data as they can. The other set of elements are used to represent a sonic realization of the score, and are commonly used for MIDI playback. These elements are used for displaying sheet music on screen or in print. One set of elements is used to represent how a piece of music is notated. MusicXML consists of two main types of elements.