![]() |
![]() |
|
Representing Music Using XMLMichael Good Poster Session presented at the Copyright © 2000 Michael Good Why Use XML to Represent Musical Scores?
MusicXML: An Interchange Language
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 BasicSet 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
|
||