To represent parallel musical lines (like different voices or layers) in MusicXML, you must be able to move the musical counter independently of notes.
- Use the
<backup> element to move the musical counter backwards to a previous position. - Use the
<forward> element to move the musical counter forwards (often used to represent 'invisible' rests to fill a measure).
Approach 1: Using Layers
In a layer-based approach, each independent part typically covers a complete measure. To add a second layer after completing the first, use <backup> to return to the start of the measure, <forward> to insert necessary rests, and then the new notes.
Approach 2: Using Voices
For temporary splits (like a voice splitting on a specific beat), use <backup> to move the counter back over the duration of the notes in the primary voice so that the secondary voice's notes are positioned correctly relative to the beat.
<!-- Example: Layer approach for a second layer starting at beat 3 in a 4-division measure -->
<backup>
<duration>16</duration>
</backup>
<forward>
<duration>8</duration>
</forward>
<note>
<pitch>
<step>G</step>
<octave>3</octave>
</pitch>
<duration>4</duration>
</note>
<note>
<chord/>
<pitch>
<step>B</step>
<octave>3</octave>
</pitch>
<duration>4</duration>
</note>
<forward>
<duration>4</duration>
</forward>