Recordare Main Navigation Menu Recordare

Representing Music Using XML

Michael Good
Recordare

Poster Session presented at the
International Symposium on Music Information Retrieval
October 23-25, 2000
Plymouth, Massachusetts, USA
Abstract also online

Copyright © 2000 Michael Good

Why Use XML to Represent Musical Scores?

  • People need a more powerful interchange format than MIDI

  • XML provides a simple, common, text format for complex structured data

  • Like HTML and MIDI, simple to learn with real-world power

  • Uses Unicode for multilingual data

  • Huge momentum behind using XML for data interchange within the computer industry

  • Many software development tools available

MusicXML: An Interchange Language

  • Supports notation, analysis, retrieval, and performance applications

  • Based on MuseData and Humdrum

  • Designed for common western musical notation, both classical and popular

  • Current Windows software:

    • Reads/writes 100% of MuseData

    • Writes to Standard MIDI, Sibelius, Finale

    • Reads from Finale ETF and NIFF

MusicXML Example (first note of logo)

<?xml version="1.0" standalone="no" ?>
<!DOCTYPE score-partwise PUBLIC
    "-//Recordare//DTD MusicXML Partwise//EN"
    "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
    <part-list>
        <score-part id="P1">
            <part-name>Mezzo-soprano</part-name>
        </score-part>
    </part-list>
    <part id="P1">
        <measure number="1">
            <attributes>
                <key>
                    <fifths>-1</fifths>
                </key>
                <divisions>2</divisions>
                <clef>
                    <sign>G</sign>
                    <line>2</line>
                 </clef>
            </attributes>
            <note>
                <pitch>
                    <step>A</step>
                    <octave>4</octave>
                </pitch>
                <duration>4</duration>
                <tie type="start"/>
                <type>half</type>
                <stem>up</stem>
                <notations>
                    <slur type="start" number="1"/>
                    <tied type="start"/>
                 </notations>
             </note>

MusicXML DTD Sample: pitch and slur

<!ELEMENT pitch (step, alter?, octave)>
<!ELEMENT step (#PCDATA)>
<!ELEMENT alter (#PCDATA)>
<!ELEMENT octave (#PCDATA)>

<!-- Slur is an empty element with attributes -->
<!ENTITY % beam-level "(1 | 2 | 3 | 4 | 5 | 6)">
<!ENTITY % start-stop "(start | stop)">
<!ELEMENT slur EMPTY>
<!ATTLIST slur type %start-stop; #REQUIRED>
<!ATTLIST slur number %beam-level; "1">

Duration Distribution in Bach BWV 6, 2nd Movement

Sample of Distribution Analysis Code in Visual Basic

Set oNodes = oRoot.selectNodes("//note | //divisions")
Do    ' nDivisions already computed as a product of all divisions
    Set oNote = oNodes.NextNode
    If oNote Is Nothing Then Exit Do
    If oNote.tagName = "divisions" Then
        nMultiplier = nDivisions \ CLng(oNote.Text)
    Else
        Set oTmp = oNote.selectSingleNode("duration")
        If Not oTmp Is Nothing Then  ' Exclude grace and cue notes
            nDuration = CLng(oTmp.Text) * nMultiplier
            nCounts(nDuration) = nCounts(nDuration) + 1
        End If
    End If
Loop