MNX-Common by example

Welcome to our overview of the new music notation format currently codenamed MNX-Common (see intro here). Our goal is to show you how MNX-Common documents look and work, by example rather than formal specification.

On this page, we present many musical situations — starting from a simple “Hello world” example and getting progressively more complex — to show you exactly how each musical situation is encoded. For each example, you’ll see an image of the desired notation, followed by the encoding in MusicXML and MNX-Common.

For some examples, you can toggle between “Relevant section” and “Full document.” The examples default to “Relevant section,” for clarity, but you can always click “Full document” to view the entire encoding with full context.

This website is primarily intended for people making music-notation software. MNX-Common is still a work in progress, and we hope you’ll get involved with its development. Does anything look weird in the MNX-Common examples? Hard to parse? Confusing? Potentially ambiguous? We want to hear about it. Make sure you’ve joined the W3C Music Notation Community Group, and post your ideas to our GitHub issue tracker.

“Hello world” (a single middle C whole note)

MusicXML

<score-partwise version="3.1">
    <part-list>
        <score-part id="P1">
            <part-name>Music</part-name>
        </score-part>
    </part-list>
    <part id="P1">
        <measure number="1">
            <attributes>
                <divisions>1</divisions>
                <key>
                    <fifths>0</fifths>
                </key>
                <time>
                    <beats>4</beats>
                    <beat-type>4</beat-type>
                </time>
                <clef>
                    <sign>G</sign>
                    <line>2</line>
                </clef>
            </attributes>
            <note>
                <pitch>
                    <step>C</step>
                    <octave>4</octave>
                </pitch>
                <duration>4</duration>
                <type>whole</type>
            </note>
        </measure>
    </part>
</score-partwise>

MNX-Common

<mnx>
    <score>
        <mnx-common profile="standard">
            <global>
                <measure>
                    <directions>
                        <time signature="4/4"/>
                    </directions>
                </measure>
            </global>
            <part>
                <part-name>Music</part-name>
                <measure>
                    <sequence>
                        <directions>
                            <clef sign="G" line="2"/>
                        </directions>
                        <event value="/1">
                            <note pitch="C4"/>
                        </event>
                    </sequence>
                </measure>
            </part>
        </mnx-common>
    </score>
</mnx>

Two-bar C major scale

The stem directions are not encoded here. This means the consuming program decides which stem direction to use.

MusicXML

<score-partwise version="3.1">
    <part-list>
        <score-part id="P1">
            <part-name>Music</part-name>
        </score-part>
    </part-list>
    <part id="P1">
        <measure number="1">
            <attributes>
                <divisions>1</divisions>
                <key>
                    <fifths>0</fifths>
                </key>
                <time>
                    <beats>4</beats>
                    <beat-type>4</beat-type>
                </time>
                <staves>1</staves>
                <clef>
                    <sign>G</sign>
                    <line>2</line>
                </clef>
            </attributes>
            <note>
                <pitch>
                    <step>C</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
            <note>
                <pitch>
                    <step>D</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
            <note>
                <pitch>
                    <step>E</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
            <note>
                <pitch>
                    <step>F</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
        </measure>
        <measure number="2">
            <note>
                <pitch>
                    <step>G</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
            <note>
                <pitch>
                    <step>A</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
            <note>
                <pitch>
                    <step>B</step>
                    <octave>4</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
            <note>
                <pitch>
                    <step>C</step>
                    <octave>5</octave>
                </pitch>
                <duration>1</duration>
                <type>quarter</type>
            </note>
        </measure>
    </part>
</score-partwise>

MNX-Common

<mnx>
    <score>
        <mnx-common profile="standard">
            <global>
                <measure>
                    <directions>
                        <time signature="4/4"/>
                    </directions>
                </measure>
                <measure/>
            </global>
            <part>
                <part-name>Music</part-name>
                <measure>
                    <sequence>
                        <directions>
                            <clef sign="G" line="2"/>
                        </directions>
                        <event value="/4">
                            <note pitch="C4"/>
                        </event>
                        <event value="/4">
                            <note pitch="D4"/>
                        </event>
                        <event value="/4">
                            <note pitch="E4"/>
                        </event>
                        <event value="/4">
                            <note pitch="F4"/>
                        </event>
                    </sequence>
                </measure>
                <measure>
                    <sequence>
                        <event value="/4">
                            <note pitch="G4"/>
                        </event>
                        <event value="/4">
                            <note pitch="A4"/>
                        </event>
                        <event value="/4">
                            <note pitch="B4"/>
                        </event>
                        <event value="/4">
                            <note pitch="C5"/>
                        </event>
                    </sequence>
                </measure>
            </part>
        </mnx-common>
    </score>
</mnx>

Three-note chord and half rest

In MusicXML, notes within chords contain <chord/> (except for the first note in the chord). MNX-Common uses <event> to group notes within chords.

Show:

MusicXML

<score-partwise version="3.1"> <part-list> <score-part id="P1"> <part-name>Music</part-name> </score-part> </part-list> <part id="P1"> <measure number="1"> <attributes> <divisions>1</divisions> <key> <fifths>0</fifths> </key> <time> <beats>4</beats> <beat-type>4</beat-type> </time> <clef> <sign>G</sign> <line>2</line> </clef> </attributes>
<note> <pitch> <step>C</step> <octave>4</octave> </pitch> <duration>2</duration> <type>half</type> </note> <note> <chord/> <pitch> <step>E</step> <octave>4</octave> </pitch> <duration>2</duration> <type>half</type> </note> <note> <chord/> <pitch> <step>G</step> <octave>4</octave> </pitch> <duration>2</duration> <type>half</type> </note> <note> <rest/> <duration>2</duration> <type>half</type> </note>
</measure> </part> </score-partwise>

MNX-Common

<mnx> <score> <mnx-common profile="standard"> <global> <measure> <directions> <time signature="4/4"/> </directions> </measure> </global> <part> <part-name>Music</part-name> <measure> <sequence> <directions> <clef sign="G" line="2"/> </directions>
<event value="/2"> <note pitch="C4"/> <note pitch="E4"/> <note pitch="G4"/> </event> <event value="/2"> <rest/> </event>
</sequence> </measure> </part> </mnx-common> </score> </mnx>

Multiple voices

In MusicXML, parsers need to keep track of an internal position; this example uses <backup> to move the internal position back to 0 to begin the second voice. In MNX-Common, voices are explicitly grouped within <sequence> elements.

Show:

MusicXML

<score-partwise version="3.1"> <part-list> <score-part id="P1"> <part-name>Music</part-name> </score-part> </part-list> <part id="P1">
<measure number="1"> <attributes> <divisions>256</divisions> <key> <fifths>0</fifths> </key> <time> <beats>4</beats> <beat-type>4</beat-type> </time> <clef> <sign>G</sign> <line>2</line> </clef> </attributes> <note> <pitch> <step>C</step> <octave>4</octave> </pitch> <duration>512</duration> <voice>1</voice> <type>half</type> </note> <note> <pitch> <step>G</step> <octave>3</octave> </pitch> <duration>512</duration> <voice>1</voice> <type>half</type> </note> <backup> <duration>1024</duration> </backup> <note> <pitch> <step>E</step> <octave>5</octave> </pitch> <duration>256</duration> <voice>2</voice> <type>quarter</type> </note> <note> <pitch> <step>F</step> <octave>5</octave> </pitch> <duration>256</duration> <voice>2</voice> <type>quarter</type> </note> <note> <pitch> <step>G</step> <octave>5</octave> </pitch> <duration>256</duration> <voice>2</voice> <type>quarter</type> </note> <note> <pitch> <step>B</step> <octave>4</octave> </pitch> <duration>256</duration> <voice>2</voice> <type>quarter</type> </note> </measure> <measure number="2"> <note> <pitch> <step>C</step> <octave>4</octave> </pitch> <duration>1024</duration> <voice>1</voice> <type>whole</type> </note> <backup> <duration>1024</duration> </backup> <note> <pitch> <step>D</step> <octave>5</octave> </pitch> <duration>256</duration> <voice>2</voice> <type>quarter</type> </note> <note> <pitch> <step>C</step> <octave>5</octave> </pitch> <duration>256</duration> <voice>2</voice> <type>quarter</type> </note> <note> <pitch> <step>C</step> <octave>6</octave> </pitch> <duration>512</duration> <voice>2</voice> <type>half</type> </note> </measure>
</part> </score-partwise>

MNX-Common

<mnx> <score> <mnx-common profile="standard"> <global> <measure> <directions> <time signature="4/4"/> </directions> </measure> <measure/> </global> <part> <part-name>Music</part-name>
<measure> <sequence> <directions> <clef sign="G" line="2"/> </directions> <event value="/2"> <note pitch="C4"/> </event> <event value="/2"> <note pitch="G3"/> </event> </sequence> <sequence> <event value="/4"> <note pitch="E5"/> </event> <event value="/4"> <note pitch="F5"/> </event> <event value="/4"> <note pitch="G5"/> </event> <event value="/4"> <note pitch="B4"/> </event> </sequence> </measure> <measure> <sequence> <event value="/1"> <note pitch="C4"/> </event> </sequence> <sequence> <event value="/4"> <note pitch="D5"/> </event> <event value="/4"> <note pitch="C5"/> </event> <event value="/2"> <note pitch="C6"/> </event> </sequence> </measure>
</part> </mnx-common> </score> </mnx>