The duration elements in MusicXML move a musical counter. To play chords, we need to indicate that a note should start at the same time as the previous note, rather than following the previous note. To do this in MusicXML, add a chord element to the note.
In our example, the piano part does not have rhythms more complex than eighth notes, so our converter sets the divisions value to 2. With 2 divisions per quarter note, the sound portion of the first chord in the piano part is represented as:
<note> <pitch> <step>C</step> <octave>4</octave> </pitch> <duration>1</duration> </note> <note> <chord/> <pitch> <step>E</step> <alter>-1</alter> <octave>4</octave> </pitch> <duration>1</duration> </note> <note> <chord/> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>1</duration> </note>
clear
Each note in the chord following the first one includes a chord element before the pitch element.
If you find that you have notes in a chord with different durations, you are probably better representing this as multi-part music rather than a chord. If you must have notes with different durations in the chord, the longest note must be the first note in the chord.