.. _usersGuide_90_musicxmlTest:

.. WARNING: DO NOT EDIT THIS FILE:
   AUTOMATICALLY GENERATED.
   PLEASE EDIT THE .py FILE DIRECTLY.


.. code:: ipython3


User's Guide, Chapter 90: Lilypond Unofficial MusicXML Test Suite
=================================================================

.. code:: ipython3

    from music21 import *
    print(musicxml.lilypondTestSuite.__doc__)


.. parsed-literal::
   :class: ipython-result

    
    The Lilypond MusicXML Test Suite comes from 
    https://github.com/cuthbertLab/musicxmlTestSuite
    and is a fork of
    http://lilypond.org/doc/v2.18/input/regression/musicxml/collated-files
    
    The test suite is licensed under the MIT license 
    (https://opensource.org/licenses/mit-license.php)
    and copyrighted by the Lilypond project.
    


.. code:: ipython3

    import os
    import re
    
    allF = musicxml.lilypondTestSuite.allFiles()
    untested = [f.split(os.sep)[-1] for f in allF]
    scores = {}
    musicxmlOut = {}
    
    def s(i):
        if isinstance(i, int):
            longFp = allF[i]
        else:
            for longFp in allF:
                shortFp = longFp.split(os.sep)[-1] 
                if i in shortFp:
                    break
            else:
                raise Exception("Cannot find: " + str(i))
        shortFp = longFp.split(os.sep)[-1] 
        if shortFp in untested:
            untested.remove(shortFp)
        sc = converter.parse(longFp, forceSource=True)    
        scores[i] = sc
        fp = sc.filePath.split(os.sep)[-1]    
        print(fp + '\n')
        desc = sc.metadata.description
        desc = re.sub(r'\s+', ' ', desc)
        print(desc)
        fpOut = sc.write('musicxml')
        with open(fpOut, 'r') as musicxmlOutFile:
            allOut = musicxmlOutFile.read()
        musicxmlOut[i] = allOut
        return sc.show()


01 ... Pitches
--------------

.. code:: ipython3

    s('01a')


.. parsed-literal::
   :class: ipython-result

    01a-Pitches-Pitches.xml
    
    All pitches from G to c'''' in ascending steps; First without accidentals, then with a sharp and then with a flat accidental, then with explicit natural accidentals. Double alterations and cautionary accidentals are tested at the end.



.. image:: usersGuide_90_musicxmlTest_5_1.png
   :width: 753px
   :height: 678px


.. code:: ipython3

    s('01b')


.. parsed-literal::
   :class: ipython-result

    01b-Pitches-Intervals.xml
    
    All pitch intervals in ascending jump size.



.. image:: usersGuide_90_musicxmlTest_6_1.png
   :width: 753px
   :height: 575px


.. code:: ipython3

    s('01c')


.. parsed-literal::
   :class: ipython-result

    01c-Pitches-NoVoiceElement.xml
    
    The <voice> element of notes is optional in MusicXML (although Dolet always writes it out). Here, there is one note with lyrics, but without a voice assigned. It should still be correctly converted.



.. image:: usersGuide_90_musicxmlTest_7_1.png
   :width: 601px
   :height: 175px


.. code:: ipython3

    s('01d')


.. parsed-literal::
   :class: ipython-result

    01d-Pitches-Microtones.xml
    
    Some microtones: c flat-and-a-half, d half-flat, e half-sharp, f sharp-and-a half. Once in the lower and once in the upper region of the staff.



.. image:: usersGuide_90_musicxmlTest_8_1.png
   :width: 748px
   :height: 156px


.. code:: ipython3

    s('01e') # no visual distinctions are necessary


.. parsed-literal::
   :class: ipython-result

    01e-Pitches-EditorialCautionaryAccidentals.xml
    
    Accidentals can be cautionary or editorial. Each measure has a normal accidental, an editorial, a cautionary and an editorial and cautionary accidental. These do not need to be graphically distinguished in later XML Versions. 



.. image:: usersGuide_90_musicxmlTest_9_1.png
   :width: 748px
   :height: 162px


.. code:: ipython3

    s('01ea') # only parentheses supported by m21 or MuseScore/Finale


.. parsed-literal::
   :class: ipython-result

    01ea-Pitches-Parenthesis-Changed-Accidentals.xml
    
     Accidentals have styling attributes. The first measure's accidentals should be normal, parenthesized, bracketed, and praenthesized-and-bracketed. Measure 2 has the sharp shifted to the right of the note, while Measure 3 has the sharp shifted above the note. Measure 4 should have a red accidental. Measure 5 and 6 should have a large accidental, created using the size and font-size attributes respectively. 



.. image:: usersGuide_90_musicxmlTest_10_1.png
   :width: 748px
   :height: 162px


.. code:: ipython3

    s('01f') # no visual distinctions are necessary


.. parsed-literal::
   :class: ipython-result

    01f-Pitches-ParenthesizedMicrotoneAccidentals.xml
    
    Microtone accidentals can be cautionary or editorial. Each measure has a normal accidental, an editorial, a cautionary and an editorial and cautionary accidental. No visual distinctions are necessary



.. image:: usersGuide_90_musicxmlTest_11_1.png
   :width: 748px
   :height: 162px


02 ... Rests
------------

.. code:: ipython3

    s('02a')


.. parsed-literal::
   :class: ipython-result

    02a-Rests-Durations.xml
    
    All different rest lengths: A two-bar multi-measure rest, a whole rest, a half, etc. until a 128th-rest; Then the same with dotted durations.



.. image:: usersGuide_90_musicxmlTest_13_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('02b')


.. parsed-literal::
   :class: ipython-result

    02b-Rests-PitchedRests.xml
    
    Rests can have explicit pitches, where they are displayed. The first rest uses no explicit position and should use the default position, all others are explicitly positioned somewhere else.



.. image:: usersGuide_90_musicxmlTest_14_1.png
   :width: 560px
   :height: 167px


.. code:: ipython3

    s('02c')


.. parsed-literal::
   :class: ipython-result

    02c-Rests-MultiMeasureRests.xml
    
    Four multi-measure rests: 3 measures, 15 measures, 1 measure, and 12 measures.



.. image:: usersGuide_90_musicxmlTest_15_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('02d')


.. parsed-literal::
   :class: ipython-result

    02d-Rests-Multimeasure-TimeSignatures.xml
    
    Multi-Measure rests should always be converted into durations that are a multiple of the time signature.



.. image:: usersGuide_90_musicxmlTest_16_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('02e')


.. parsed-literal::
   :class: ipython-result

    02e-Rests-NoType.xml
    
    In some cases, a rest might not have its type attribute set (this happens, for example, with voices in Finale, where you don't manually insert a rest).



.. image:: usersGuide_90_musicxmlTest_17_1.png
   :width: 748px
   :height: 224px


03 ... Rhythm
-------------

.. code:: ipython3

    s('03aa')


.. parsed-literal::
   :class: ipython-result

    03aa-Rhythm-Durations.xml
    
    All common note durations, from brevis, whole until 64th; First with their plain values, then dotted and finally doubly-dotted (to 32nd).



.. image:: usersGuide_90_musicxmlTest_19_1.png
   :width: 748px
   :height: 158px


.. code:: ipython3

    s('03ab')


.. parsed-literal::
   :class: ipython-result

    03ab-Rhythm-Durations.xml
    
    Extreme note durations (pre 3.0): long and 128th; First with their plain values, then dotted and finally doubly-dotted.



.. image:: usersGuide_90_musicxmlTest_20_1.png
   :width: 748px
   :height: 170px


.. code:: ipython3

    s('03b') # music21 creates a Rest w/ hideObjectOnPrint in this case.


.. parsed-literal::
   :class: ipython-result

    03b-Rhythm-Backup.xml
    
    Two voices with a backup, that does not jump to the beginning for the measure for voice 2, but somewhere in the middle. Voice 2 thus won't have any notes or rests for the first beat of the measures.



.. image:: usersGuide_90_musicxmlTest_21_1.png
   :width: 543px
   :height: 174px


.. code:: ipython3

    s('03c')


.. parsed-literal::
   :class: ipython-result

    03c-Rhythm-DivisionChange.xml
    
    Although uncommon, the divisions of a quarter note can change somewhere in the middle of a MusicXML file. Here, the first half measure uses a division of 1, which then changes to 8 in the middle of the first measure and to 38 in the middle of the second measure.



.. image:: usersGuide_90_musicxmlTest_22_1.png
   :width: 598px
   :height: 155px


.. code:: ipython3

    s('03d') # failing on not recognizing a way around 5/16, 9/8


.. parsed-literal::
   :class: ipython-result

    03d-Rhythm-DottedDurations-Factors.xml
    
    Several durations can be written with dots. For multimeasure rests, we can also have durations that cannot be expressed with dotted notes (5/16 and 9/8).



.. image:: usersGuide_90_musicxmlTest_23_1.png
   :width: 753px
   :height: 286px


.. code:: ipython3

    scores['03d'].show('text') # import is fine.


.. parsed-literal::
   :class: ipython-result

    {0.0} <music21.metadata.Metadata object at 0x107997710>
    {0.0} <music21.stream.Part MusicXML Part>
        {0.0} <music21.instrument.Instrument P1: MusicXML Part: >
        {0.0} <music21.stream.Measure 1 offset=0.0>
            {0.0} <music21.meter.TimeSignature 1/8>
            {0.0} <music21.note.Note C>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.0} <music21.spanner.MultiMeasureRest 1 measure>
        {0.5} <music21.stream.Measure 2 offset=0.5>
            {0.0} <music21.note.Rest rest>
        {1.0} <music21.stream.Measure 3 offset=1.0>
            {0.0} <music21.meter.TimeSignature 2/8>
            {0.0} <music21.note.Note C>
        {2.0} <music21.stream.Measure 4 offset=2.0>
            {0.0} <music21.note.Rest rest>
        {3.0} <music21.stream.Measure 5 offset=3.0>
            {0.0} <music21.meter.TimeSignature 3/4>
            {0.0} <music21.note.Note C>
        {6.0} <music21.stream.Measure 6 offset=6.0>
            {0.0} <music21.note.Rest rest>
        {9.0} <music21.stream.Measure 7 offset=9.0>
            {0.0} <music21.meter.TimeSignature 4/4>
            {0.0} <music21.note.Note C>
        {13.0} <music21.stream.Measure 8 offset=13.0>
            {0.0} <music21.note.Rest rest>
        {17.0} <music21.stream.Measure 9 offset=17.0>
            {0.0} <music21.meter.TimeSignature 5/16>
            {0.0} <music21.note.Note C>
            {1.0} <music21.note.Note C>
        {18.25} <music21.stream.Measure 10 offset=18.25>
            {0.0} <music21.note.Rest rest>
        {19.5} <music21.stream.Measure 11 offset=19.5>
            {0.0} <music21.meter.TimeSignature 7/8>
            {0.0} <music21.note.Note C>
        {23.0} <music21.stream.Measure 12 offset=23.0>
            {0.0} <music21.note.Rest rest>
        {26.5} <music21.stream.Measure 13 offset=26.5>
            {0.0} <music21.meter.TimeSignature 9/8>
            {0.0} <music21.note.Note C>
            {4.0} <music21.note.Note C>
        {31.0} <music21.stream.Measure 14 offset=31.0>
            {0.0} <music21.note.Rest rest>
        {35.5} <music21.stream.Measure 15 offset=35.5>
            {0.0} <music21.meter.TimeSignature 31/8>
            {0.0} <music21.note.Note C>
        {51.0} <music21.stream.Measure 16 offset=51.0>
            {0.0} <music21.note.Rest rest>
        {66.5} <music21.stream.Measure 17 offset=66.5>
            {0.0} <music21.meter.TimeSignature 2/2>
            {0.0} <music21.note.Note C>


11 ... Time signatures
----------------------

.. code:: ipython3

    s('11a')


.. parsed-literal::
   :class: ipython-result

    11a-TimeSignatures.xml
    
    Various time signatures: 2/2 (alla breve), 4/4 (C), 2/2, 3/2, 2/4, 3/4, 4/4, 5/4, 3/8, 6/8, 12/8



.. image:: usersGuide_90_musicxmlTest_26_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('11b') # failing on additional clef...


.. parsed-literal::
   :class: ipython-result

    11b-TimeSignatures-NoTime.xml
    
    A score without a time signature (but with a key and clefs)



.. image:: usersGuide_90_musicxmlTest_27_1.png
   :width: 598px
   :height: 224px


.. code:: ipython3

    s('11c')


.. parsed-literal::
   :class: ipython-result

    11c-TimeSignatures-CompoundSimple.xml
    
    Compound time signatures with same denominator: (3+2)/8 and (5+3+1)/4.



.. image:: usersGuide_90_musicxmlTest_28_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('11d') # blocking: MuseScore.  Finale OK


.. parsed-literal::
   :class: ipython-result

    11d-TimeSignatures-CompoundMultiple.xml
    
    Compound time signatures with separate fractions displayed: 3/8+2/8+3/4 and 5/2+1/8.



.. image:: usersGuide_90_musicxmlTest_29_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    for m in scores['11d'].recurse().getElementsByClass('TimeSignature'):
        print(m, m.displaySequence.flat)


.. parsed-literal::
   :class: ipython-result

    <music21.meter.TimeSignature 3/8+2/8+3/4> {3/8+2/8+3/4}
    <music21.meter.TimeSignature 5/2+1/8> {5/2+1/8}


.. code:: ipython3

    s('11e') # blocking: MuseScore, Finale OK


.. parsed-literal::
   :class: ipython-result

    11e-TimeSignatures-CompoundMixed.xml
    
    Compound time signatures of mixed type: (3+2)/8+3/4.



.. image:: usersGuide_90_musicxmlTest_31_1.png
   :width: 659px
   :height: 155px


.. code:: ipython3

    s('11f') # acceptable though different meaning from Lilypond


.. parsed-literal::
   :class: ipython-result

    11f-TimeSignatures-SymbolMeaning.xml
    
    A time signature of 3/8 with the symbol="cut" attribute and two symbol="single-number" attributes with compound time signatures. Shall the symbol be ignored in this case?



.. image:: usersGuide_90_musicxmlTest_32_1.png
   :width: 649px
   :height: 155px


.. code:: ipython3

    s('11g') # block: MuseScore


.. parsed-literal::
   :class: ipython-result

    11g-TimeSignatures-SingleNumber.xml
    
    Time signature displayed as a single number.



.. image:: usersGuide_90_musicxmlTest_33_1.png
   :width: 638px
   :height: 155px


.. code:: ipython3

    ts = scores['11g'].recurse().getElementsByClass('TimeSignature')[0]
    ts.symbol




.. parsed-literal::
   :class: ipython-result

    'single-number'



.. code:: ipython3

    s('11h')


.. parsed-literal::
   :class: ipython-result

    11h-TimeSignatures-SenzaMisura.xml
    
    Senza-misura time signature



.. image:: usersGuide_90_musicxmlTest_35_1.png
   :width: 628px
   :height: 155px


.. code:: ipython3

    sc = scores['11h']
    sc.recurse().getElementsByClass('SenzaMisuraTimeSignature')[0]




.. parsed-literal::
   :class: ipython-result

    <music21.meter.SenzaMisuraTimeSignature>



12 ... Clefs
------------

.. code:: ipython3

    s('12aa')


.. parsed-literal::
   :class: ipython-result

    12aa-Clefs_Pitch_Traditional.xml
    
    Four traditional clefs: G-treble, C-alto, C-tenor, F-bass



.. image:: usersGuide_90_musicxmlTest_38_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('12ab')


.. parsed-literal::
   :class: ipython-result

    12ab-Clefs-Percussion-NonTrad.xml
    
    Clefs with octave shifts, clefs on staff lines other than default, and percussion. Order: Percussion, treble 8vb, bass 8vb, F3, G1, C5, C2, C1, treble 8va, bass 8va, 



.. image:: usersGuide_90_musicxmlTest_39_1.png
   :width: 748px
   :height: 179px


.. code:: ipython3

    s('12ac') # block: MuseScore


.. parsed-literal::
   :class: ipython-result

    12ac-Clefs-TAB-Switch.xml
    
    none clef, TAB clef, Treble



.. image:: usersGuide_90_musicxmlTest_40_1.png
   :width: 564px
   :height: 179px


.. code:: ipython3

    s('12ad') # block: MuseScore on treble 15vb, treble 22va, bass 22vb.


.. parsed-literal::
   :class: ipython-result

    12ad-Clefs-Extreme-Octave.xml
    
    Clefs with |octave shifts| > 1 Order: treble 15vb (C2), bass 15vb (C2), treble 15va (C6), bass 15va (C6), treble 22va (C7), bass 22vb (C1). Should all display as middle C if clef octavation is ignored 



.. image:: usersGuide_90_musicxmlTest_41_1.png
   :width: 748px
   :height: 227px


.. code:: ipython3

    s('12b')


.. parsed-literal::
   :class: ipython-result

    12b-Clefs-NoKeyOrClef.xml
    
    A score without any key or clef defined. The default (4/4 in treble clef) should be used.



.. image:: usersGuide_90_musicxmlTest_42_1.png
   :width: 569px
   :height: 155px


13 ... Key signatures
---------------------

.. code:: ipython3

    s('13a')


.. parsed-literal::
   :class: ipython-result

    13a-KeySignatures.xml
    
    Various standard key signatures: from 7 flats to 7 sharps (each one first one measure in major, then one measure in minor)



.. image:: usersGuide_90_musicxmlTest_44_1.png
   :width: 753px
   :height: 424px


.. code:: ipython3

    s('13aa') # blocked: MuseScore and Finale (on flats; sharps import fine)


.. parsed-literal::
   :class: ipython-result

    13aa-KeySignatures-Extreme.xml
    
    Various extreme key signatures: from 11 flats to 7 flats and 7 sharps to 11 sharps (all marked as major)



.. image:: usersGuide_90_musicxmlTest_45_1.png
   :width: 748px
   :height: 162px


.. code:: ipython3

    print([ks.sharps for ks in scores['13aa'].recurse().getElementsByClass('KeySignature')])


.. parsed-literal::
   :class: ipython-result

    [-11, -10, -9, -8, -7, 7, 8, 9, 10, 11]


.. code:: ipython3

    s('13ab') # no music21 support; blocked MuseScore


.. parsed-literal::
   :class: ipython-result

    13ab-KeySignatures-Cancel.xml
    
    Tests of key signature cancelation, at default location, at right, and before-barline, then cancelling a key signature that does not exist... 



.. image:: usersGuide_90_musicxmlTest_47_1.png
   :width: 748px
   :height: 162px


.. code:: ipython3

    s('13ac') # no music21 support; blocked MuseScore + Finale


.. parsed-literal::
   :class: ipython-result

    13ac-KeySignatures-Octaves.xml
    
    Three tests of key signatures at octaves other than defaults. The third example uses the cancel element to cancel previous key signature octaves 



.. image:: usersGuide_90_musicxmlTest_48_1.png
   :width: 748px
   :height: 162px


.. code:: ipython3

    s('13b')


.. parsed-literal::
   :class: ipython-result

    13b-KeySignatures-ChurchModes.xml
    
    All different modes: major, minor, ionian, dorian, phrygian, lydian, mixolydian, aeolian, and locrian; All modes are given with 2 sharps.



.. image:: usersGuide_90_musicxmlTest_49_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    print([k.mode for k in scores['13b'].recurse().getElementsByClass('Key')])


.. parsed-literal::
   :class: ipython-result

    ['major', 'minor', 'ionian', 'dorian', 'phrygian', 'lydian', 'mixolydian', 'aeolian', 'locrian']


.. code:: ipython3

    s('13c') # no octave support on musescore or finale


.. parsed-literal::
   :class: ipython-result

    13c-KeySignatures-NonTraditional.xml
    
    Non-traditional key signatures, where each alteration is separately given. Here we have (f sharp, a flat, b flat) and (c flatflat, g sharp sharp, d flat, b sharp, f natural), where in the second case an explicit octave is given for each alteration.



.. image:: usersGuide_90_musicxmlTest_51_1.png
   :width: 748px
   :height: 162px


.. code:: ipython3

    s('13d') # great musescore support except octaves. no Finale support; 


.. parsed-literal::
   :class: ipython-result

    13d-KeySignatures-Microtones.xml
    
    Non-traditional key signatures with microtone alterations: (g flat-and-a-half, a flat, b half-flat, c natural, d half-sharp, e sharp, f sharp-and-a-half).



.. image:: usersGuide_90_musicxmlTest_52_1.png
   :width: 610px
   :height: 162px


.. code:: ipython3

    s('13e') # lack of cancellation of 0 is fixed in MuseScore 3 beta


.. parsed-literal::
   :class: ipython-result

    13e-KeySignatures-MidMeasure-Change.xml
    
    Mid-Measure Key-Change: 2 sharps, 2 flats, 0 sharps/flats, 7 sharps, no mode.



.. image:: usersGuide_90_musicxmlTest_53_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    scores['13e'].show('text')


.. parsed-literal::
   :class: ipython-result

    {0.0} <music21.metadata.Metadata object at 0x107f83668>
    {0.0} <music21.stream.Part MusicXML Part>
        {0.0} <music21.instrument.Instrument P1: MusicXML Part: >
        {0.0} <music21.stream.Measure 1 offset=0.0>
            {0.0} <music21.clef.TrebleClef>
            {0.0} <music21.key.KeySignature of 2 sharps>
            {0.0} <music21.meter.TimeSignature 4/4>
            {0.0} <music21.note.Note G>
            {1.0} <music21.key.KeySignature of 2 flats>
            {1.0} <music21.note.Note G>
            {2.0} <music21.key.KeySignature of no sharps or flats>
            {2.0} <music21.note.Note G>
            {3.0} <music21.key.KeySignature of 7 sharps>
            {3.0} <music21.note.Note G>


14 ... Staff attributes
-----------------------

.. code:: ipython3

    # failing on mid-measure staff-details change. 
    # Incorrect interpretation of lines is MuseScore; finale incorrect also
    s('14a') 


.. parsed-literal::
   :class: ipython-result

    14a-StaffDetails-LineChanges.xml
    
    The number of staff lines can be modified by using the staff-lines child of the staff-details attribute. This can happen globally (the first staff has one line globally) or during the part at the beginning of a measure and even inside a measure (the second part has 5 lines initially, 4 at the beginning of the second measure, and 3 starting in the middle of the third measure).



.. image:: usersGuide_90_musicxmlTest_56_1.png
   :width: 748px
   :height: 213px


21 ... Chorded notes
--------------------

.. code:: ipython3

    s('21a')


.. parsed-literal::
   :class: ipython-result

    21a-Chord-Basic.xml
    
    One simple chord consisting of two notes.



.. image:: usersGuide_90_musicxmlTest_58_1.png
   :width: 516px
   :height: 155px


.. code:: ipython3

    s('21b')


.. parsed-literal::
   :class: ipython-result

    21b-Chords-TwoNotes.xml
    
    Some subsequent (identical) two-note chords.



.. image:: usersGuide_90_musicxmlTest_59_1.png
   :width: 555px
   :height: 155px


.. code:: ipython3

    s('21c')


.. parsed-literal::
   :class: ipython-result

    21c-Chords-ThreeNotesDuration.xml
    
    Some three-note chords, with various durations.



.. image:: usersGuide_90_musicxmlTest_60_1.png
   :width: 622px
   :height: 160px


.. code:: ipython3

    s('21d')


.. parsed-literal::
   :class: ipython-result

    21d-Chords-SchubertStabatMater.xml
    
    Chords in the second measure, after several ornaments in the first measure and a p at the beginning of the second measure.



.. image:: usersGuide_90_musicxmlTest_61_1.png
   :width: 627px
   :height: 172px


.. code:: ipython3

    s('21e')


.. parsed-literal::
   :class: ipython-result

    21e-Chords-PickupMeasures.xml
    
    Check for proper chord detection after a pickup measure (i.e. the first beat of the measure is not aligned with multiples of the time signature)!



.. image:: usersGuide_90_musicxmlTest_62_1.png
   :width: 596px
   :height: 155px


.. code:: ipython3

    s('21f') # failing -- finale interprets chord correctly, but not the p; musescore, perfect.


.. parsed-literal::
   :class: ipython-result

    21f-Chord-ElementInBetween.xml
    
    Between the individual notes of a chord there can be direction or harmony elements, which should be properly assigned to the chord (or the position of the chord).



.. image:: usersGuide_90_musicxmlTest_63_1.png
   :width: 610px
   :height: 176px


22 ... Note settings, heads, etc.
---------------------------------

.. code:: ipython3

    s('22a') # block: MuseScore; finale gets all but Cluster


.. parsed-literal::
   :class: ipython-result

    22a-Noteheads.xml
    
    Different note styles, using the <notehead> element. First, each note head style is printed with four quarter notes, two with filled heads, two with unfilled heads, where first the stem is up and then the stem is down. After that, each note head style is printed with a half note (should have an unfilled head by default). Finally, the Aiken note head styles are tested, once with stem up and once with stem down.



.. image:: usersGuide_90_musicxmlTest_65_1.png
   :width: 753px
   :height: 830px


.. code:: ipython3

    s('22b') # failing; finale gets right; musescore: as shown.


.. parsed-literal::
   :class: ipython-result

    22b-Staff-Notestyles.xml
    
    Staff-connected note styles: slash notation, hidden notes (with and without hidden staff lines)



.. image:: usersGuide_90_musicxmlTest_66_1.png
   :width: 751px
   :height: 306px


.. code:: ipython3

    s('22c') # blocked by MuseScore: 22a


.. parsed-literal::
   :class: ipython-result

    22c-Noteheads-Chords.xml
    
    Different note styles for individual notes inside a chord, using the <notehead> element.



.. image:: usersGuide_90_musicxmlTest_67_1.png
   :width: 748px
   :height: 212px


.. code:: ipython3

    s('22d') # failing parenthesized rest; block MuseScore.  Finale no support.


.. parsed-literal::
   :class: ipython-result

    22d-Parenthesized-Noteheads.xml
    
    Parenthesized note heads. First, a single parenthesized note is tested, once with a normal and then with a non-standard notehead, then two chords with some/all parenthesized noteheads and finally a parenthesized rest.



.. image:: usersGuide_90_musicxmlTest_68_1.png
   :width: 601px
   :height: 155px


23 ... Triplets, Tuplets
------------------------

.. code:: ipython3

    s('23a') # blocking on MuseScore not liking 4:2 (but okay on 4:1)


.. parsed-literal::
   :class: ipython-result

    23a-Tuplets.xml
    
    Some tuplets (3:2, 3:2, 3:2, 4:2, 4:1, 7:3, 6:2) with the default tuplet bracket displaying the number of actual notes played. The second tuplet does not have a number attribute set.



.. image:: usersGuide_90_musicxmlTest_70_1.png
   :width: 748px
   :height: 166px


.. code:: ipython3

    for n in scores['23a'].recurse().notes:
        if n.duration.tuplets:
            print(n.duration.tuplets[0], n.duration.tuplets[0].type)


.. parsed-literal::
   :class: ipython-result

    <music21.duration.Tuplet 3/2/quarter> start
    <music21.duration.Tuplet 3/2/quarter> None
    <music21.duration.Tuplet 3/2/quarter> stop
    <music21.duration.Tuplet 3/2/quarter> start
    <music21.duration.Tuplet 3/2/quarter> None
    <music21.duration.Tuplet 3/2/quarter> stop
    <music21.duration.Tuplet 3/2/quarter> start
    <music21.duration.Tuplet 3/2/quarter> None
    <music21.duration.Tuplet 3/2/quarter> stop
    <music21.duration.Tuplet 4/2/quarter> start
    <music21.duration.Tuplet 4/2/quarter> None
    <music21.duration.Tuplet 4/2/quarter> None
    <music21.duration.Tuplet 4/2/quarter> stop
    <music21.duration.Tuplet 4/1/quarter> start
    <music21.duration.Tuplet 4/1/quarter> None
    <music21.duration.Tuplet 4/1/quarter> None
    <music21.duration.Tuplet 4/1/quarter> stop
    <music21.duration.Tuplet 7/3/quarter> start
    <music21.duration.Tuplet 7/3/quarter> None
    <music21.duration.Tuplet 7/3/quarter> None
    <music21.duration.Tuplet 7/3/quarter> None
    <music21.duration.Tuplet 7/3/quarter> None
    <music21.duration.Tuplet 7/3/quarter> None
    <music21.duration.Tuplet 7/3/quarter> stop
    <music21.duration.Tuplet 6/2/quarter> start
    <music21.duration.Tuplet 6/2/quarter> None
    <music21.duration.Tuplet 6/2/quarter> None
    <music21.duration.Tuplet 6/2/quarter> None
    <music21.duration.Tuplet 6/2/quarter> None
    <music21.duration.Tuplet 6/2/quarter> stop


.. code:: ipython3

    scores['23a'].show('text')


.. parsed-literal::
   :class: ipython-result

    {0.0} <music21.metadata.Metadata object at 0x107ece7b8>
    {0.0} <music21.stream.Part MusicXML Part>
        {0.0} <music21.instrument.Instrument P1: MusicXML Part: >
        {0.0} <music21.stream.Measure 1 offset=0.0>
            {0.0} <music21.clef.TrebleClef>
            {0.0} <music21.key.Key of C major>
            {0.0} <music21.meter.TimeSignature 4/4>
            {0.0} <music21.note.Note C>
            {0.6667} <music21.note.Note D>
            {1.3333} <music21.note.Note E>
            {2.0} <music21.note.Note F>
            {2.6667} <music21.note.Note G>
            {3.3333} <music21.note.Note A>
        {4.0} <music21.stream.Measure 2 offset=4.0>
            {0.0} <music21.note.Note B>
            {0.6667} <music21.note.Note C>
            {1.3333} <music21.note.Note D>
            {2.0} <music21.note.Note E>
            {2.5} <music21.note.Note F>
            {3.0} <music21.note.Note G>
            {3.5} <music21.note.Note A>
        {8.0} <music21.stream.Measure 3 offset=8.0>
            {0.0} <music21.note.Note B>
            {0.25} <music21.note.Note C>
            {0.5} <music21.note.Note C>
            {0.75} <music21.note.Note B>
            {1.0} <music21.note.Note A>
            {1.4286} <music21.note.Note G>
            {1.8571} <music21.note.Note F>
            {2.2857} <music21.note.Note E>
            {2.7143} <music21.note.Note D>
            {3.1429} <music21.note.Note C>
            {3.5714} <music21.note.Note B>
        {12.0} <music21.stream.Measure 4 offset=12.0>
            {0.0} <music21.note.Note A>
            {0.3333} <music21.note.Note G>
            {0.6667} <music21.note.Note F>
            {1.0} <music21.note.Note E>
            {1.3333} <music21.note.Note D>
            {1.6667} <music21.note.Note C>
            {2.0} <music21.note.Note C>
            {4.0} <music21.bar.Barline style=final>


.. code:: ipython3

    s('23b') # block MuseScore + Finale.  Bad beaming is a separate problem.


.. parsed-literal::
   :class: ipython-result

    23b-Tuplets-Styles.xml
    
    Different tuplet styles: default, none, x:y, x:y-note; Each with bracket, slur and none. Finally, non-standard 4:3 and 17:2 tuplets are given.



.. image:: usersGuide_90_musicxmlTest_73_1.png
   :width: 751px
   :height: 295px


.. code:: ipython3

    s('23c') # acceptable...


.. parsed-literal::
   :class: ipython-result

    23c-Tuplet-Display-NonStandard.xml
    
    Displaying tuplet note types, that might not coincide with the displayed note. The first two tuplets take the type from the note, the second two from the <time-modification> element, the remaining pair of tuplets from the <tuplet> notation element. The tuplets in measure 3 specify both a number of notes and a type inside the <tuplet-actual> and <tuplet-normal> elements, the ones in measure 4 specify only a note type (but no number), and the ones in measure 5 specify only a number of tuplet-notes (but no type, which is deduced from the note's type). The first tuplet of measures 3-5 uses 'display-type="actual"', the second one 'display-type="both"'. FIXME: The tuplet-normal should coincide with the real notes!



.. image:: usersGuide_90_musicxmlTest_74_1.png
   :width: 748px
   :height: 166px


.. code:: ipython3

    s('23d') # block: musescore


.. parsed-literal::
   :class: ipython-result

    23d-Tuplets-Nested.xml
    
    Tuplets can be nested. Here there is a 5:2 tuplet inside a 3:2 tuple (all consisting of written eighth notes).



.. image:: usersGuide_90_musicxmlTest_75_1.png
   :width: 534px
   :height: 170px


.. code:: ipython3

    s('23e') 


.. parsed-literal::
   :class: ipython-result

    23e-Tuplets-Tremolo.xml
    
    Tremolo tuplets are tuplets on single notes with a tremolo ornament. The application shall correctly import these notes with 2/3 or their time...



.. image:: usersGuide_90_musicxmlTest_76_1.png
   :width: 748px
   :height: 172px


.. code:: ipython3

    s('23f') # acceptable behavior unless supports Tuplet is explicit.


.. parsed-literal::
   :class: ipython-result

    23f-Tuplets-DurationButNoBracket.xml
    
    Some "triplets" on the end of the first and in the second staff, using only <time-modification>, but not explicit tuplet bracket. Thus, the duration of the notes in the second staff should be scaled properly in comparison to staff 1, but no visual indication about the tuplets is given.



.. image:: usersGuide_90_musicxmlTest_77_1.png
   :width: 748px
   :height: 244px


24 ... Grace notes
------------------

.. code:: ipython3

    s('24a') # are slurs default?


.. parsed-literal::
   :class: ipython-result

    24a-GraceNotes.xml
    
    Different kinds of grace notes: acciaccatura, appoggiatura; beamed grace notes; grace notes with accidentals; different durations of the grace notes.



.. image:: usersGuide_90_musicxmlTest_79_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('24b')


.. parsed-literal::
   :class: ipython-result

    24b-ChordAsGraceNote.xml
    
    Chords as grace notes.



.. image:: usersGuide_90_musicxmlTest_80_1.png
   :width: 566px
   :height: 155px


.. code:: ipython3

    s('24c')


.. parsed-literal::
   :class: ipython-result

    24c-GraceNote-MeasureEnd.xml
    
    A grace note that appears at the measure end (without any steal-from-* attribute set). Some applications need to convert this into an after-grace.



.. image:: usersGuide_90_musicxmlTest_81_1.png
   :width: 594px
   :height: 155px


.. code:: ipython3

    s('24d')


.. parsed-literal::
   :class: ipython-result

    24d-AfterGrace.xml
    
    Some grace notes and after-graces (indicated by steal-time-previous and steal-time-following).



.. image:: usersGuide_90_musicxmlTest_82_1.png
   :width: 510px
   :height: 155px


.. code:: ipython3

    s('24e') # failing but blocked by MuseScore and Finale


.. parsed-literal::
   :class: ipython-result

    24e-GraceNote-StaffChange.xml
    
    A grace note on a different staff than the actual note.



.. image:: usersGuide_90_musicxmlTest_83_1.png
   :width: 594px
   :height: 155px


.. code:: ipython3

    s('24f')


.. parsed-literal::
   :class: ipython-result

    24f-GraceNote-Slur.xml
    
    A grace note with a slur to the actual note. This can be interpreted as acciaccatura or appoggiatura, depending on the existence of a slash.



.. image:: usersGuide_90_musicxmlTest_84_1.png
   :width: 536px
   :height: 155px


.. code:: ipython3

    grace = scores['24f'].recurse().notes[1]
    grace.duration.isGrace




.. parsed-literal::
   :class: ipython-result

    True



.. code:: ipython3

    sl = scores['24f'].recurse().getElementsByClass('Slur')[0]
    sl[0]




.. parsed-literal::
   :class: ipython-result

    <music21.note.Note G>



.. code:: ipython3

    sl[0] is grace




.. parsed-literal::
   :class: ipython-result

    True



31 ... Dynamics and other single symbols
----------------------------------------

.. code:: ipython3

    s('31a') # todo, split...


.. parsed-literal::
   :class: ipython-result

    31a-Directions.xml
    
    All <direction> elements defined in MusicXML. The lyrics for each note describes the direction element assigned to that note.



.. image:: usersGuide_90_musicxmlTest_89_1.png
   :width: 753px
   :height: 582px


.. code:: ipython3

    s('31c') # todo, split


.. parsed-literal::
   :class: ipython-result

    31c-MetronomeMarks.xml
    
    Tempo Markings: note=bpm, text (note=bpm), note=note, (note=note), (note=bpm)



.. image:: usersGuide_90_musicxmlTest_90_1.png
   :width: 748px
   :height: 155px


32 ... Notations and Articulations
----------------------------------

.. code:: ipython3

    # failling on normal from, angled ferm, squareferm position; 
    # arp., non-arp., acc.mark (block museScore -- what is this?), 
    # stress + unstressed (block musescore)
    s('32a') 


.. parsed-literal::
   :class: ipython-result

    32a-Notations.xml
    
    All <notation> elements defined in MusicXML. The lyrics show the notation assigned to each note.



.. image:: usersGuide_90_musicxmlTest_92_1.png
   :width: 751px
   :height: 437px


.. code:: ipython3

    # failing on delayed turn (at least a turn should be put in), 
    # turn + accidental (block: museScore).
    s('32aa')


.. parsed-literal::
   :class: ipython-result

    32aa-Notations2_Ornaments.xml
    
    All <ornament> elements defined in MusicXML. The lyrics show the ornament assigned to each note.



.. image:: usersGuide_90_musicxmlTest_93_1.png
   :width: 751px
   :height: 306px


.. code:: ipython3

    # harmonics -- all: block museScore
    # dbl + trp. tongue (block MS), fre1, fret0 (block MS)
    # str.1-5 failing m21
    # hammer to end: blocked by MS.
    s('32ab')


.. parsed-literal::
   :class: ipython-result

    32ab-Notations3.xml
    
    All <technical> elements defined in MusicXML. The lyrics show the technical assigned to each note.



.. image:: usersGuide_90_musicxmlTest_94_1.png
   :width: 751px
   :height: 568px


.. code:: ipython3

    # failing: dynamics in misc notations
    # accent positions not working on MS either -- may be a change in standard.
    s('32ac')


.. parsed-literal::
   :class: ipython-result

    32ac-Notations4.xml
    
    Some miscellanious <notation> elements defined in MusicXML including dynamics in notations. The lyrics show the notation assigned to each note.



.. image:: usersGuide_90_musicxmlTest_95_1.png
   :width: 748px
   :height: 212px


.. code:: ipython3

    s('32b')


.. parsed-literal::
   :class: ipython-result

    32b-Articulations-Texts.xml
    
    Text markup: different font sizes, weights and colors.



.. image:: usersGuide_90_musicxmlTest_96_1.png
   :width: 562px
   :height: 155px


.. code:: ipython3

    s('32c')


.. parsed-literal::
   :class: ipython-result

    32c-MultipleNotationChildren.xml
    
     It should not make any difference whether two articulations are given inside two different notation elements, inside two different articulations children of the same notation element or inside the same articulations element. Thus, all three notes should have a staccato and an accent. 



.. image:: usersGuide_90_musicxmlTest_97_1.png
   :width: 605px
   :height: 155px


.. code:: ipython3

    s('32d') # not supported; musescore supports all.


.. parsed-literal::
   :class: ipython-result

    32d-Arpeggio.xml
    
    Different Arpeggio directions (normal, up, down, non-arpeggiate)



.. image:: usersGuide_90_musicxmlTest_98_1.png
   :width: 748px
   :height: 175px


33 ... Spanners
---------------

.. code:: ipython3

    # block MuseScore: trill one note, gliss (wavy line is m21), 
    #    bend-alter, hammer, pull, ped change
    # failing: dashed slur, octave shift mark, bend-alter, slide, 
    #    grouping. hammer, pull, all ped.
    s('33a')


.. parsed-literal::
   :class: ipython-result

    33a-Spanners.xml
    
    Several spanners defined in MusicXML: tuplet, slur (solid, dashed), tie, wedge (cresc, dim), tr + wavy-line, single-note trill spanner, octave-shift (8va,15mb), bracket (solid down/down, dashed down/down, solid none/down, dashed none/up, solid none/none), dashes, glissando (wavy), bend-alter, slide (solid), grouping, two-note tremolo (B to D#), hammer-on, pull-off, pedal (down, change, up).



.. image:: usersGuide_90_musicxmlTest_100_1.png
   :width: 753px
   :height: 416px


.. code:: ipython3

    s('33b') # not necessarily a spanner except in Lilypond


.. parsed-literal::
   :class: ipython-result

    33b-Spanners-Tie.xml
    
    Two simple tied whole notes



.. image:: usersGuide_90_musicxmlTest_101_1.png
   :width: 521px
   :height: 155px


.. code:: ipython3

    s('33c')


.. parsed-literal::
   :class: ipython-result

    33c-Spanners-Slurs.xml
    
    A note can be the end of one slur and the start of a new slur. Also, in MusicXML, nested slurs are possible like in the second measure where one slur goes over all four notes, and another slur goes from the second to the third note.



.. image:: usersGuide_90_musicxmlTest_102_1.png
   :width: 531px
   :height: 155px


.. code:: ipython3

    s('33d') # overinterpreting.


.. parsed-literal::
   :class: ipython-result

    33d-Spanners-OctaveShifts.xml
    
    All types of octave shifts (15ma, 15mb, 8va, 8vb)



.. image:: usersGuide_90_musicxmlTest_103_1.png
   :width: 585px
   :height: 196px


.. code:: ipython3

    s('33e') # check if actually invalid


.. parsed-literal::
   :class: ipython-result

    33e-Spanners-OctaveShifts-InvalidSize.xml
    
    Invalid octave-shifts: 27 down, 11 up.



.. image:: usersGuide_90_musicxmlTest_104_1.png
   :width: 663px
   :height: 179px


.. code:: ipython3

    s('33f') # blocking: MuseScore


.. parsed-literal::
   :class: ipython-result

    33f-Trill-EndingOnGraceNote.xml
    
    A trill spanner that spans a grace note and ends on an after-grace note at the end of the measure.



.. image:: usersGuide_90_musicxmlTest_105_1.png
   :width: 748px
   :height: 224px


.. code:: ipython3

    s('33g')


.. parsed-literal::
   :class: ipython-result

    33g-Slur-ChordedNotes.xml
    
    Slurs on chorded notes: Only the first note of the chord should get the slur notation. Some applications print out the slur for all notes -- these should be ignored. Edited by MSC to not reuse the same slur number in generating the overlapping slurs. 



.. image:: usersGuide_90_musicxmlTest_106_1.png
   :width: 562px
   :height: 158px


.. code:: ipython3

    # failing except for normal/wavy glissando
    # museScore blocking: solid, dashed, dotted for gliss, and 
    #    dashed, dotted, wavy for slide.  Text works great!
    s('33h')


.. parsed-literal::
   :class: ipython-result

    33h-Spanners-Glissando.xml
    
    All different types of glissando defined in MusicXML



.. image:: usersGuide_90_musicxmlTest_107_1.png
   :width: 751px
   :height: 306px


.. code:: ipython3

    s('33i')


.. parsed-literal::
   :class: ipython-result

    33i-Ties-NotEnded.xml
    
    Several ties that have their end tag missing.



.. image:: usersGuide_90_musicxmlTest_108_1.png
   :width: 748px
   :height: 175px


41 ... Multiple parts (staves)
------------------------------

.. code:: ipython3

    s('41a')


.. parsed-literal::
   :class: ipython-result

    41a-MultiParts-Partorder.xml
    
    A piece with four parts (P0, P1, P2, P3; different from what Finale creates!). Are they converted in the correct order?



.. image:: usersGuide_90_musicxmlTest_110_1.png
   :width: 571px
   :height: 372px


.. code:: ipython3

    s('41b') # blocking: MuseScore? needs instruments?


.. parsed-literal::
   :class: ipython-result

    41b-MultiParts-MoreThan10.xml
    
    A piece with 20 parts to check whether an application supports that many parts and whether they are correctly sorted.



.. image:: usersGuide_90_musicxmlTest_111_1.png
   :width: 444px
   :height: 36px


.. code:: ipython3

    s('41c')


.. parsed-literal::
   :class: ipython-result

    41c-StaffGroups.xml
    
    A huge orchestra score with 28 parts and different kinds of nested bracketed groups. Each part/group is assigned a name and an abbreviation to be shown before the staff. Also, most of the groups show unbroken barlines, while the barlines are broken between the groups.



.. image:: usersGuide_90_musicxmlTest_112_1.png
   :width: 281px
   :height: 36px


.. code:: ipython3

    s('41d')


.. parsed-literal::
   :class: ipython-result

    41d-StaffGroups-Nested.xml
    
    Two properly nested part groups: One group (with a square bracket) goes from staff 2 to 4) and another group (with a curly bracket) goes from staff 3 to 4.



.. image:: usersGuide_90_musicxmlTest_113_1.png
   :width: 748px
   :height: 444px


.. code:: ipython3

    s('41e') # failing


.. parsed-literal::
   :class: ipython-result

    41e-StaffGroups-InstrumentNames-Linebroken.xml
    
    Part names and abbreviations can contain line breaks.



.. image:: usersGuide_90_musicxmlTest_114_1.png
   :width: 753px
   :height: 416px


.. code:: ipython3

    s('41f')


.. parsed-literal::
   :class: ipython-result

    41f-StaffGroups-Overlapping.xml
    
    MusicXML allows for overlapping part-groups, while many applications do not allow overlapping groups, but require them to be properly nested. In this case, one group (with a square bracket) goes from staff 2 to 4) and another group (with a curly bracket) goes from staff 3 to 5.



.. image:: usersGuide_90_musicxmlTest_115_1.png
   :width: 601px
   :height: 446px


.. code:: ipython3

    s('41g')


.. parsed-literal::
   :class: ipython-result

    41g-PartNoId.xml
    
    A part with no id attribute. Since this piece has only one part, it is clear which part is described by the one part element.



.. image:: usersGuide_90_musicxmlTest_116_1.png
   :width: 495px
   :height: 155px


.. code:: ipython3

    s('41h') # warns, skips the part -- acceptable behavior


.. parsed-literal::
   :class: ipython-result

    musicxml.xmlToM21: WARNING: Cannot find info for part with name P3, skipping the part
    musicxml.xmlToM21: WARNING: Cannot find info for part with name P4, skipping the part


.. parsed-literal::
   :class: ipython-result

    41h-TooManyParts.xml
    
    This piece has more part elements than the part-list section gives. One can either convert all the parts present, but not listed in the part-list, or simply not import / ignore them.



.. image:: usersGuide_90_musicxmlTest_117_2.png
   :width: 532px
   :height: 155px


.. code:: ipython3

    s('41i')


.. parsed-literal::
   :class: ipython-result

    41i-PartNameDisplay-Override.xml
    
    MusicXML allows part-name and part-name-display in the score-part element. If part-name-display is given, it overrides the part-name for display. The first staff uses only part-name, while the second one (same part-name) overrides it with a custom text. Similar for the part-abbreviation used in subsequent staves. 



.. image:: usersGuide_90_musicxmlTest_118_1.png
   :width: 748px
   :height: 431px


42 ... Multiple voices per staff
--------------------------------

.. code:: ipython3

    s('42a') # failing (works in musescore.)


.. parsed-literal::
   :class: ipython-result

    42a-MultiVoice-TwoVoicesOnStaff-Lyrics.xml
    
    Two voices share one staff. Each voice is assigned some lyrics.



.. image:: usersGuide_90_musicxmlTest_120_1.png
   :width: 748px
   :height: 183px


.. code:: ipython3

    s('42b')


.. parsed-literal::
   :class: ipython-result

    42b-MultiVoice-MidMeasureClefChange.xml
    
    A multi-voice / multi-staff part with a clef change in the middle of a measure and a <backward> for voice 2 jumping back beyond that clef change.



.. image:: usersGuide_90_musicxmlTest_121_1.png
   :width: 748px
   :height: 236px


43 ... One part on multiple staves
----------------------------------

.. code:: ipython3

    s('43a')


.. parsed-literal::
   :class: ipython-result

    43a-PianoStaff.xml
    
    A simple piano staff



.. image:: usersGuide_90_musicxmlTest_123_1.png
   :width: 504px
   :height: 224px


.. code:: ipython3

    s('43b')


.. parsed-literal::
   :class: ipython-result

    43b-MultiStaff-DifferentKeys.xml
    
    A piano staff with different keys and clefs for each of its staves. The keys and clefs for both staves are given at the very beginning of the measure.



.. image:: usersGuide_90_musicxmlTest_124_1.png
   :width: 605px
   :height: 224px


.. code:: ipython3

    s('43c')


.. parsed-literal::
   :class: ipython-result

    43c-MultiStaff-DifferentKeysAfterBackup.xml
    
    A piano staff with different keys and clefs for each of its staves. The key and clef for the second staff is given only after a backward, just before the first note of the second staff is given, but after the whole measure for staff 1 has been given.



.. image:: usersGuide_90_musicxmlTest_125_1.png
   :width: 690px
   :height: 224px


.. code:: ipython3

    s('43d') # failing # cross-staff-beaming. fails utterly in m21 so far. 
    # chord tones fail to cross on musescore; perfect on Finale.


.. parsed-literal::
   :class: ipython-result

    43d-MultiStaff-StaffChange.xml
    
    Staff changes in a piano staff. The voice from the second staff has some notes/chords on the first staff. The final two chords have some notes on the first, some on the second staff.



.. image:: usersGuide_90_musicxmlTest_126_1.png
   :width: 748px
   :height: 227px


.. code:: ipython3

    s('43e')


.. parsed-literal::
   :class: ipython-result

    43e-Multistaff-ClefDynamics.xml
    
    A piano staff with dynamics and clef changes, where each element (ffff, wedge and clef changes) applies only to one voice or one staff, respectively.



.. image:: usersGuide_90_musicxmlTest_127_1.png
   :width: 748px
   :height: 239px


45 ... Repeats
--------------

.. code:: ipython3

    s('45a')


.. parsed-literal::
   :class: ipython-result

    45a-SimpleRepeat.xml
    
    A simple, repeated measure (repeated 5 times)



.. image:: usersGuide_90_musicxmlTest_129_1.png
   :width: 525px
   :height: 155px


.. code:: ipython3

    s('45b')


.. parsed-literal::
   :class: ipython-result

    45b-RepeatWithAlternatives.xml
    
    A simple repeat with two alternative endings (volta brackets).



.. image:: usersGuide_90_musicxmlTest_130_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('45c')


.. parsed-literal::
   :class: ipython-result

    45c-RepeatMultipleTimes.xml
    
    Repeats can also be nested.



.. image:: usersGuide_90_musicxmlTest_131_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    print(musicxmlOut['45c'])


.. parsed-literal::
   :class: ipython-result

    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE score-partwise
      PUBLIC '-//Recordare//DTD MusicXML 2.0 Partwise//EN'
      'http://www.musicxml.org/dtds/partwise.dtd'>
    <score-partwise>
      <work>
        <work-title>45c-RepeatMultipleTimes.xml</work-title>
        </work>
      <movement-title>45c-RepeatMultipleTimes.xml</movement-title>
      <identification>
        <creator type="composer">Music21</creator>
        <encoding>
          <encoding-date>2017-05-15</encoding-date>
          <software>Music21</software>
          </encoding>
        </identification>
      <defaults>
        <scaling>
          <millimeters>7</millimeters>
          <tenths>40</tenths>
          </scaling>
        </defaults>
      <part-list>
        <score-part id="P1">
          <part-name>MusicXML Part</part-name>
          </score-part>
        </part-list>
      <part id="P1">
        <measure number="1">
          <attributes>
            <divisions>10080</divisions>
            <key>
              <fifths>0</fifths>
              <mode>major</mode>
              </key>
            <time symbol="common">
              <beats>4</beats>
              <beat-type>4</beat-type>
              </time>
            <clef>
              <sign>G</sign>
              <line>2</line>
              </clef>
            </attributes>
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          </measure>
        <measure number="2">
          <attributes />
          <barline location="left">
            <repeat direction="forward" />
            </barline>
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          </measure>
        <measure number="3">
          <attributes />
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          <barline location="right">
            <repeat direction="backward" times="5" />
            </barline>
          </measure>
        <measure number="4">
          <attributes />
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          </measure>
        <measure number="5">
          <attributes />
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          </measure>
        <measure number="6">
          <attributes />
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          </measure>
        <measure number="7">
          <attributes />
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          <barline location="right">
            <repeat direction="backward" times="3" />
            </barline>
          </measure>
        <measure number="8">
          <attributes />
          <note>
            <rest measure="yes" />
            <duration>40320</duration>
            </note>
          <barline location="right">
            <bar-style>light-heavy</bar-style>
            </barline>
          </measure>
        </part>
      </score-partwise>
    


.. code:: ipython3

    s('45d')


.. parsed-literal::
   :class: ipython-result

    45d-Repeats-Nested-Alternatives.xml
    
    Nested repeats, each with alternative endings.



.. image:: usersGuide_90_musicxmlTest_133_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('45e')


.. parsed-literal::
   :class: ipython-result

    45e-Repeats-Nested-Alternatives.xml
    
    Some more nested repeats with alternatives. The barline between measure 7 and 8 will probably be messed up! (Should be a repeat on both sides!)



.. image:: usersGuide_90_musicxmlTest_134_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('45f')


.. parsed-literal::
   :class: ipython-result

    45f-Repeats-InvalidEndings.xml
    
    Some more nested repeats with alternatives, where the MusicXML file does not make sense in the first place. How well are applications able to cope with improper repeats and alternatives?



.. image:: usersGuide_90_musicxmlTest_135_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('45g')


.. parsed-literal::
   :class: ipython-result

    45g-Repeats-NotEnded.xml
    
    A forward-repeating bar line without an ending repeat bar.



.. image:: usersGuide_90_musicxmlTest_136_1.png
   :width: 558px
   :height: 155px


46 ... Barlines, Measures
-------------------------

.. code:: ipython3

    s('46a')


.. parsed-literal::
   :class: ipython-result

    46a-Barlines.xml
    
    Different types of (non-repeat) barlines: default (no setting), regular, dotted, dashed, heavy, light-light, light-heavy, heavy-light, heavy-heavy, tick, short, none.



.. image:: usersGuide_90_musicxmlTest_138_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('46b') # failing


.. parsed-literal::
   :class: ipython-result

    46b-MidmeasureBarline.xml
    
    Barlines can appear at mid-measure positions, without using an implicit measure!



.. image:: usersGuide_90_musicxmlTest_139_1.png
   :width: 564px
   :height: 155px


.. code:: ipython3

    s('46c')


.. parsed-literal::
   :class: ipython-result

    46c-Midmeasure-Clef.xml
    
    A clef change in the middle of a measure, using either an implicit measure or simply placing the attributes in the middle of the measure.



.. image:: usersGuide_90_musicxmlTest_140_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('46d')


.. parsed-literal::
   :class: ipython-result

    46d-PickupMeasure-ImplicitMeasures.xml
    
    A 3/8 pickup measure, a measure that is split into one (incomplete, only 2/4) measure and an implicit measure, and an incomplete measure (containg 3/4).



.. image:: usersGuide_90_musicxmlTest_141_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('46e')


.. parsed-literal::
   :class: ipython-result

    46e-PickupMeasure-SecondVoiceStartsLater.xml
    
    Voice 2 should start at 2nd beat of first full measure.



.. image:: usersGuide_90_musicxmlTest_142_1.png
   :width: 702px
   :height: 168px


.. code:: ipython3

    s('46f')


.. parsed-literal::
   :class: ipython-result

    46f-IncompleteMeasures.xml
    
    Measures can contain less notes than the time signature says. Here, the first and third measures contain only two quarters instead of four.



.. image:: usersGuide_90_musicxmlTest_143_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('46g')


.. parsed-literal::
   :class: ipython-result

    46g-PickupMeasure-Chordnames-FiguredBass.xml
    
    Pickup measure with chord names and figured bass.



.. image:: usersGuide_90_musicxmlTest_144_1.png
   :width: 713px
   :height: 155px


51 ... Header information
-------------------------

.. code:: ipython3

    s('51b')


.. parsed-literal::
   :class: ipython-result

    51b-Header-Quotes.xml
    
    Several header fields and part names can contain quotes ("). This test checks whether they are converted/imported without problems (i.e. whether they are correctly escaped when converting).



.. image:: usersGuide_90_musicxmlTest_146_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('51c')


.. parsed-literal::
   :class: ipython-result

    51c-MultipleRights.xml
    
    There can be multiple <rights> tags in the identification element of the score. The conversion shall still work, ideally using both of them.



.. image:: usersGuide_90_musicxmlTest_147_1.png
   :width: 532px
   :height: 155px


.. code:: ipython3

    s('51d')


.. parsed-literal::
   :class: ipython-result

    51d-EmptyTitle.xml
    
    A piece with an empty (but existing) work-title, but a non-empty movement-title. In this case the movement-title should be chosen, even though the work-title exists.



.. image:: usersGuide_90_musicxmlTest_148_1.png
   :width: 672px
   :height: 155px


52 ... Page layout
------------------

.. code:: ipython3

    s('52a') # block: ipython21 -- only gives first png image.


.. parsed-literal::
   :class: ipython-result

    52a-PageLayout.xml
    
    Several page layout settings: paper size, margins, system margins and distances, different fonts, etc.



.. image:: usersGuide_90_musicxmlTest_150_1.png
   :width: 473px
   :height: 83px


.. code:: ipython3

    s('52b') # block: ipython21 -- only gives first png image.


.. parsed-literal::
   :class: ipython-result

    52b-Breaks.xml
    
    System and page breaks, given in a <print> element



.. image:: usersGuide_90_musicxmlTest_151_1.png
   :width: 751px
   :height: 286px


61 ... Lyrics
-------------

.. code:: ipython3

    s('61a')


.. parsed-literal::
   :class: ipython-result

    61a-Lyrics.xml
    
    Some notes with simple lyrics: Syllables, notes without a syllable, syllable spanners.



.. image:: usersGuide_90_musicxmlTest_153_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    s('61b')


.. parsed-literal::
   :class: ipython-result

    61b-MultipleLyrics.xml
    
    Multiple (simple) lyrics. The order of the exported stanzas is relevant (identified by the number attribute in this test case)



.. image:: usersGuide_90_musicxmlTest_154_1.png
   :width: 748px
   :height: 212px


.. code:: ipython3

    s('61c')


.. parsed-literal::
   :class: ipython-result

    61c-Lyrics-Pianostaff.xml
    
    Lyrics assigned to the voices of a piano staff containing two simple staves. Each staff is assigned exactly one lyrics line.



.. image:: usersGuide_90_musicxmlTest_155_1.png
   :width: 748px
   :height: 258px


.. code:: ipython3

    s('61d')


.. parsed-literal::
   :class: ipython-result

    61d-Lyrics-Melisma.xml
    
    How to treat lyrics and slurred notes. Normally, a slurred group of notes is assigned only one lyrics syllable.



.. image:: usersGuide_90_musicxmlTest_156_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    s('61e')


.. parsed-literal::
   :class: ipython-result

    61e-Lyrics-Chords.xml
    
    Assigning lyrics to chorded notes.



.. image:: usersGuide_90_musicxmlTest_157_1.png
   :width: 528px
   :height: 175px


.. code:: ipython3

    s('61f')


.. parsed-literal::
   :class: ipython-result

    61f-Lyrics-GracedNotes.xml
    
    Grace notes shall not mess up the lyrics, and they shall not be assigned a syllable.



.. image:: usersGuide_90_musicxmlTest_158_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    s('61g')


.. parsed-literal::
   :class: ipython-result

    61g-Lyrics-NameNumber.xml
    
    A lyrics syllable can have both a number and a name attribute. The question is: What should be used to put syllables of the same voice together. This example uses different number/name combinations to check how different applications handle this unspecified case (The advice on the MusicXML mailing list was "there is no correct way, each application can do what it thinks is best"). The complete text should be (by note number): 1: Verse1A, Chorus1A, AnotherChorus1A 2: 1B, 2B 3: Verse1C, Chorus2C 4: Chorus1D 5: VerseE 6: NoneF (indicating no number or name was given) 



.. image:: usersGuide_90_musicxmlTest_159_1.png
   :width: 748px
   :height: 193px


.. code:: ipython3

    s('61h')


.. parsed-literal::
   :class: ipython-result

    61h-Lyrics-BeamsMelismata.xml
    
    Beaming or slurs can indicate melismata for lyrics. Also make sure that notes without an explicit syllable are treated as if they were part of a melisma.



.. image:: usersGuide_90_musicxmlTest_160_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    s('61i')


.. parsed-literal::
   :class: ipython-result

    61i-Lyrics-Chords.xml
    
    Each note of a chord can have some lyrics attached. In this case, each note of the chord has lyrics of the form "Lyrics [123]" attached, where each lyrics has a different number attribute to distinguish them. These syllables should be imported into three different stanzas and the timing should be correct.



.. image:: usersGuide_90_musicxmlTest_161_1.png
   :width: 525px
   :height: 212px


.. code:: ipython3

    s('61j') # failing on de, fgh, elision


.. parsed-literal::
   :class: ipython-result

    61j-Lyrics-Elisions.xml
    
    Multiple lyrics syllables assigned to a single note are implemented either using a space in the lyrics or by using the <elision> lyrics element. This testcase checks both of them. First, a note with one syllable (a) is given, then a note with two syllables (b c) separated by a space and finally a note with two (de) and one with three syllables (fgh) implemented using <elision> is given.



.. image:: usersGuide_90_musicxmlTest_162_1.png
   :width: 531px
   :height: 175px


.. code:: ipython3

    s('61k') # failing on extenders on b, and CC.


.. parsed-literal::
   :class: ipython-result

    61k-Lyrics-SpannersExtenders.xml
    
    Lyrics spanners: continued syllables and extenders, possibly spanning multiple notes. The intermediate notes do not have any <lyric> element. Text should read: "A long-er text" 



.. image:: usersGuide_90_musicxmlTest_163_1.png
   :width: 748px
   :height: 175px


71 ... Guitar notation
----------------------

.. code:: ipython3

    s('71a')


.. parsed-literal::
   :class: ipython-result

    71a-Chordnames.xml
    
    A normal staff with several (complex) chord names displayed.



.. image:: usersGuide_90_musicxmlTest_165_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('71c') # not yet supported


.. parsed-literal::
   :class: ipython-result

    71c-ChordsFrets.xml
    
    A staff with chord names and some fretboards shown. The fretboards can have an arbitrary number of frets/strings, can start at an arbitrary fret and can even contain fingering information.



.. image:: usersGuide_90_musicxmlTest_166_1.png
   :width: 748px
   :height: 155px


.. code:: ipython3

    s('71d') # not yet supported


.. parsed-literal::
   :class: ipython-result

    71d-ChordsFrets-Multistaff.xml
    
    Chords and fretboards assigned to the voices in a multi-voice, multi-staff part. There should be fret diagrams above each of the two staves.



.. image:: usersGuide_90_musicxmlTest_167_1.png
   :width: 748px
   :height: 230px


.. code:: ipython3

    s('71e') # not yet supported


.. parsed-literal::
   :class: ipython-result

    71e-TabStaves.xml
    
    Some tablature staves, with explicit fingering information and different string tunings given in the MusicXML file.



.. image:: usersGuide_90_musicxmlTest_168_1.png
   :width: 748px
   :height: 833px


.. code:: ipython3

    s('71f')


.. parsed-literal::
   :class: ipython-result

    71f-AllChordTypes.xml
    
    All chord types defined in MusicXML. The staff will only contain one c' note (NO chord) for all of them, but the chord names should be properly printed.



.. image:: usersGuide_90_musicxmlTest_169_1.png
   :width: 751px
   :height: 1040px


.. code:: ipython3

    s('71g')


.. parsed-literal::
   :class: ipython-result

    71g-MultipleChordnames.xml
    
    There can be multiple subsequent harmony elements, indicating a harmony change during a note



.. image:: usersGuide_90_musicxmlTest_170_1.png
   :width: 573px
   :height: 155px


72 ... Transposing instruments
------------------------------

.. code:: ipython3

    s('72a')


.. parsed-literal::
   :class: ipython-result

    72a-TransposingInstruments.xml
    
    Transposing instruments: Trumpet in Bb, Horn in Eb, Piano; All of them show the C major scale (the trumpet with 2 sharp, the horn with 3 sharp).



.. image:: usersGuide_90_musicxmlTest_172_1.png
   :width: 748px
   :height: 300px


.. code:: ipython3

    s('72b')


.. parsed-literal::
   :class: ipython-result

    72b-TransposingInstruments-Full.xml
    
    Various transposition. Each part plays a c'', just displayed in different display pitches. The second-to-last staff uses a transposition where the displayed c' is an actual f''' concert pitch. The final staff is an untransposed instrument.



.. image:: usersGuide_90_musicxmlTest_173_1.png
   :width: 748px
   :height: 878px


.. code:: ipython3

    s('72c')


.. parsed-literal::
   :class: ipython-result

    72c-TransposingInstruments-Change.xml
    
    An instrument change from one transposition (Clarinet in Eb) to another transposing instrument (Clarinet in Bb). The displayed instrument name should also be updated. The whole piece is in Bb major (sounding), so first the key signature should be one flat, after the change it should have no accidentals. 



.. image:: usersGuide_90_musicxmlTest_174_1.png
   :width: 751px
   :height: 286px


73 ... Percussion
-----------------

.. code:: ipython3

    s('73a')


.. parsed-literal::
   :class: ipython-result

    73a-Percussion.xml
    
    Three types of percussion staves: A five-line staff with bass clef for Timpani, a five-line staff with percussion clef, and a one-line percussion staff with only unpitched notes.



.. image:: usersGuide_90_musicxmlTest_176_1.png
   :width: 748px
   :height: 307px


74 ... Figured bass
-------------------

.. code:: ipython3

    s('74a') # not yet supported -- completely in music21 though.
    # fix to be well-formed musicxml and then put misformed in 99...


.. parsed-literal::
   :class: ipython-result

    74a-FiguredBass.xml
    
    Some figured bass containing alterated figures, bracketed figures and slashed figures. The last note contains an empty <figured-bass> element, which is invalid MusicXML, to check how well applications cope with malformed files. Note that this file does not contain any extenders!



.. image:: usersGuide_90_musicxmlTest_178_1.png
   :width: 514px
   :height: 155px


75 ... Other instrumental notation
----------------------------------

.. code:: ipython3

    s('75a') # not supported by music21 or MuseScore


.. parsed-literal::
   :class: ipython-result

    75a-AccordionRegistrations.xml
    
    All possible accordion registrations. Edited to remove invalid MusicXML, which has been moved to 99d. 



.. image:: usersGuide_90_musicxmlTest_180_1.png
   :width: 751px
   :height: 306px


90 ... Compressed MusicXML files
--------------------------------

.. code:: ipython3

    s('90a')


.. parsed-literal::
   :class: ipython-result

    90a-Compressed-MusicXML.mxl
    
    A compressed MusicXML file, containing a simple MusicXML score and the corresponding .pdf output for reference.



.. image:: usersGuide_90_musicxmlTest_182_1.png
   :width: 564px
   :height: 155px


99 ... Compatibility with broken MusicXML
-----------------------------------------

.. code:: ipython3

    s('99a')


.. parsed-literal::
   :class: ipython-result

    99a-Sibelius5-IgnoreBeaming.xml
    
    Dolet 3 for Sibelius (5.1) did not print out any closing beam tags, only starting and continuing beam tags. For such files, one either needs to ignore all beaming information or close all beams 



.. image:: usersGuide_90_musicxmlTest_184_1.png
   :width: 600px
   :height: 155px


.. code:: ipython3

    s('99b')


.. parsed-literal::
   :class: ipython-result

    99b-Lyrics-BeamsMelismata-IgnoreBeams.xml
    
    If we properly ignore all beaming information from the Dolet 3 for Sibelius export file, make sure that the lyrics syllables are still assigned to the correct notes.



.. image:: usersGuide_90_musicxmlTest_185_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    s('99c') # crashes musescore!


.. parsed-literal::
   :class: ipython-result

    99c-Wavy-Lines-No-Numbers.xml
    
    A wavy line starts on the first note, ends on the second, starts again on the second and ends on the third. No numbers given. This is very bad, but technically not incorrect MusicXML. 



.. image:: usersGuide_90_musicxmlTest_186_1.png
   :width: 692px
   :height: 175px


.. code:: ipython3

    s('99d') # should simply not crash.


.. parsed-literal::
   :class: ipython-result

    99d-AccordionInvalid.xml
    
    Invalid accordion registrations. Moved out of 75a.. No accordion-(high|middle|low) given, empty middle, middle with invalid value, middle with 0 



.. image:: usersGuide_90_musicxmlTest_187_1.png
   :width: 748px
   :height: 175px


.. code:: ipython3

    untested




.. parsed-literal::
   :class: ipython-result

    []


