![]() |
![]() |
|
Using XML for Musical RepresentationMichael Good Guest Lecture for Music Representation class
(Music 254) Copyright © 2000 Recordare. All rights reserved. Outline
My Background
Why Another Music Representation Language?
HTML and MIDI as Catalysts for Growth
The Limits of HTML and MIDI
The New Standard: XML
Why Are People So Excited About XML?
More Good Things About XML
Designing an XML Representation for Music
MusicXML Representation Goals
MusicXML Application Goals
Why MusicXML Instead of NIFF or SMDL?
XML Versions of MIDI and NIFF
MIDI XML Example<?xml version="1.0" standalone="yes" ?>
<MIDI>
<Format>1</Format>
<Tracks>2</Tracks>
<TicksPerBeat>24</TicksPerBeat>
<TimestampType>Delta</TimestampType>
<Track number="0">
<SetTempo>
<Delta>0</Delta>
<Value>750000</Value> <!-- MM = 80 -->
</SetTempo>
<KeySignature>
<Delta>0</Delta>
<Fifths>-1</Fifths> <!-- One flat -->
<Mode>0</Mode>
</KeySignature>
<EndOfTrack>
<Delta>192</Delta>
</EndOfTrack>
</Track>
<Track number="1">
<TrackName>
<Delta>0</Delta>
<Value>Mezzo-soprano</Value>
</TrackName>
<ProgramChange>
<Delta>0</Delta>
<Channel>1</Channel>
<Number>54</Number> <!-- GM Voices -->
</ProgramChange>
<NoteOn> <!-- Initial A -->
<Delta>0</Delta>
<Channel>1</Channel>
<Note>69</Note>
<Velocity>90</Velocity>
</NoteOn>
<NoteOff>
<Delta>60</Delta> <!-- Half tied to eighth -->
<Channel>1</Channel>
<Note>69</Note>
<Velocity>90</Velocity>
</NoteOff>
<NoteOn>
<Delta>0</Delta>
<Channel>1</Channel>
<Note>65</Note>
<Velocity>90</Velocity>
</NoteOn>
<!-- Rest of notes omitted... -->
<EndOfTrack>
<Delta>24</Delta> <!-- quarter rest -->
</EndOfTrack>
</Track>
</MIDI>
NIFF XML Example<?xml version="1.0" standalone="yes" ?>
<NIFF>
<SetupSection>
<!-- Skip these next 3 for here... -->
<ChunkLengthTable />
<NiffInformation />
<FontDescriptions list="yes" />
<StringTable>
<String Offset="0">Mezzo-soprano</String>
<String Offset="14">M.</String>
</StringTable>
<Parts list="yes">
<PartDescription>
<PartID>0</PartID>
<PartName>0</PartName>
<PartAbbreviation>14</PartAbbreviation>
<Staves>1</Staves>
<MidiChannel>0</MidiChannel>
<MidiCable>-1</MidiCable>
<Transpose>0</Transpose>
</PartDescription>
</Parts>
</SetupSection>
<DataSection>
<Page list="yes">
<PageHeader /> <!-- Skip headers here -->
<System list="yes">
<SystemHeader />
<Staff list="yes">
<StaffHeader />
<TimeSlice type="2">
<StartTime Numerator="0"
Denominator="1" />
</TimeSlice>
<Clef Shape="1" StaffStep="2"
OctaveNumber="0" />
<KeySignature StandardCode="8" />
<Stem>
<LogicalPlacement Horizontal="0"
Vertical="1" Proximity="0" />
</Stem>
<Slur>
<NumberOfNodes>2</NumberOfNodes>
<ID>0</ID>
</Slur>
<Notehead Shape="3" StaffStep="3">
<Duration Numerator="1" Denominator="2" />
<PartID>0</PartID>
</Notehead>
<Tie>
<NumberOfNodes>2</NumberOfNodes>
<ID>0</ID>
</Tie>
<!-- Rest of notes omitted... -->
</Staff>
</System>
</Page>
</DataSection>
</NIFF>
MusicXML Example (May 2000 version)<?xml version="1.0" standalone="no" ?>
<!DOCTYPE score-partwise SYSTEM "musicxml-p.dtd">
<score-partwise>
<movement id="M1">
<part-list>
<score-part id="M1-P1">
<part-name>Mezzo-soprano</part-name>
<part-abbreviation>M.</part-abbreviation>
</score-part>
</part-list>
<part id="M1-P1">
<measure number="1">
<attributes>
<key>
<fifths>-1</fifths>
</key>
<divisions>2</divisions>
<staves>1</staves>
<clef>
<sign>G</sign>
<line>2</line>
</clef>
</attributes>
<note>
<pitch>
<step>A</step>
<octave>4</octave>
</pitch>
<duration>4</duration>
<tie />
<type>half</type>
<stem>up</stem>
<notations>
<slur type="start" number="1"/>
<tied/>
</notations>
</note>
<!-- Notes omitted until last B-flat -->
<note>
<pitch>
<step>B</step>
<alter>-1</alter>
<octave>4</octave>
</pitch>
<duration>1</duration>
<type>eighth</type>
<stem>up</stem>
<beam number="1">end</beam>
</note>
</measure>
<measure number="2">
<!-- Notes omitted until last rest -->
<note>
<rest />
<duration>2</duration>
</note>
</measure>
</part>
</movement>
</score-partwise>
MusicXML Converter Status as of May 17, 2000
How Much Bigger Are The MusicXML Files?
XML Document Type Definitions (DTDs)
MusicXML DTD Sample: note<!-- Internal entities to simplify note definitions -->
<!ENTITY % full-note "(chord?, (pitch | rest))">
<!ENTITY % voice-track "(footnote?, level?, track?)">
<!-- Definition of the note element -->
<!ELEMENT note ((((cue | grace), %full-note;) |
(%full-note;, duration, tie?)),
%voice-track;, type?, dot*,
accidental?, time-modification?,
stem?, staff?, beam*, notations*,
text*)>
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"> Working With XML
Analysis Examples
Durations in Bach BWV 6, 2nd Movement
Correlations in Mozart Quartet #7, 1st Movement
Distribution Analysis CodeSet oNodes = oRoot.selectNodes("//note | //divisions")
Do
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
Correlation Analysis Code ' Code structure is same as for distribution analysis.
' The Else clause for handling notes changes:
Else
Set oDuration = oNote.SelectSingleNode("duration")
Set oPitch = oNote.SelectSingleNode("pitch")
If (Not oDuration Is Nothing) And _
(Not oPitch Is Nothing) Then ' No rests either
nDuration = CLng(oDuration.Text) * nMultiplier
nPitch = MidiNote(oPitch) ' Separate function
oWorksheet.Cells(i, 1) = nDuration
oWorksheet.Cells(i, 2) = nPitch
End If
End If
Future Directions for MusicXML
Summary
Acknowledgments
Home - Music - Software - MusicXML - Events - Search - Store - About Us Copyright © 2000 Recordare. All rights reserved. |
||