Difference between revisions of "MusicXML and MEI homework"

From CCARH Wiki
Jump to navigation Jump to search
 
(28 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
=== Compose a measure ===  
 
=== Compose a measure ===  
  
Compose one measure of music in Finale, MuseScore, Noteflight, Sibelius, etc. and export
+
Compose one measure of music in MuseScore, Finale, Noteflight, or Sibelius, etc. and export
 
the score to a MusicXML file.
 
the score to a MusicXML file.
  
Line 13: Line 13:
 
* a chord
 
* a chord
 
* a beam
 
* a beam
 +
* triplet rhythms
 
* a key signature
 
* a key signature
 +
* a title
 +
* a composer
 
* some lyrics
 
* some lyrics
 
* multiple verses of lyrics
 
* multiple verses of lyrics
Line 20: Line 23:
 
* a dynamic marking (p, mp, mf, f, etc.)
 
* a dynamic marking (p, mp, mf, f, etc.)
 
* a crescendo/decrescendo hairpin/wedge
 
* a crescendo/decrescendo hairpin/wedge
* an articulations (fermata, staccato, tenuto, accent, etc)
+
* an articulations (fermata, staccato, tenuto, accent, etc.)
 
* two or more layers/voices
 
* two or more layers/voices
 
* two or more staves (such as grand staff for piano, or two separate instruments)
 
* two or more staves (such as grand staff for piano, or two separate instruments)
 
* two or more measures
 
* two or more measures
* instrument name/abbreviation
+
* instrument name before music
 
* transposing instrument
 
* transposing instrument
 
* a tempo marking (Allegro, Lento, Adagio, etc)
 
* a tempo marking (Allegro, Lento, Adagio, etc)
  
 +
 +
To save MusicXML data in MuseScore, go to the Menu "File→Export..." and then select the save type as "Uncompressed MusicXML file".  You might want to reload the MusicXML file back into the music editor that you used to check that it exported the features that you want (not all features of the music editor may be exported into MusicXML data, and this will depend on the editor).
  
 
=== Copy/Paste into online editor ===
 
=== Copy/Paste into online editor ===
  
Open the MusicXML file in a text editor and copy the contents.  This can be done on the command line
+
Drag and drop the MusicXML file (uncompressed) onto the webpage:
in MacOS with the command:
 
  
     cat file.xml | pbcopy
+
     http://verovio.humdrum.org?k=e
  
Then go to the webpage:
+
which should result in a view something like this after dropping:
  
    http://verovio.humdrum.org&k=em
+
[[File: musicxmlview.png|700px|thumb|center|MusicXML contents and notation rendering after pasting onto VHV webpage."]]
  
and paste the MusicXML data into the text editor on the left side of the page, which should result in a view like this:
+
Notice the little triangles next to the line numbers on the left: these can be used to show/hide the contents of XML elements, which may be useful to keep track of the location of an element.
  
[[File: musicxmlview.png|700px|thumb|center|MusicXML contents and notation rendering after pasting onto VHV webpage."]]
+
=== Locations of features in MusicXML ===
  
=== Locations of features in MusicXML ===
+
List and/or draw a tree diagram of the XML path from the root node to each of the 10 features that you created in your composition. 
  
Record the XML tree path to each of the features that you created in your composition.  For example, a note would have a path from the root node like this:
+
For example, a note should have a path from the root node of the XML data like this:
  
     score-partwise/part/measure/note
+
     /score-partwise/part/measure/note
  
Not all features will be explicitly encoded within a single element (chords for example), so describe in general
+
Not all features will be explicitly encoded within a single containing element (chords for example), so describe in general how it is encoded if it is not obviously encoded.  If a feature is encoded as an attribute
how it is encoded if it is not obviously encoded.  If a feature is encoded as an attribute
 
 
use the following style, which shows where a measure number is stored in MusicXML:
 
use the following style, which shows where a measure number is stored in MusicXML:
  
     score-partwise/part/measure@number
+
     /score-partwise/part/measure@number
  
 +
This means that measure numbers are stored in the "number" attribute of measure elements, which are contained within the part element which in turn is contained in the root element "score-partwise".
  
 
=== Locations of features in MEI ===
 
=== Locations of features in MEI ===
  
After recording the path to the features in MusicXML, Type alt-M on the same webpage.   
+
After recording the path to the features in MusicXML, Type alt-m on the same webpage.   
 
This should convert the MusicXML data into MEI data.  For each of the features
 
This should convert the MusicXML data into MEI data.  For each of the features
 
that you recorded the XML path in the MusicXML data, do the same for the MEI data.
 
that you recorded the XML path in the MusicXML data, do the same for the MEI data.
Line 65: Line 69:
 
Here is an example view of the MEI data after pressing alt-m:
 
Here is an example view of the MEI data after pressing alt-m:
  
[[File: meiview.png|700px|thumb|center|MEI contents and notation rendering after typing alt-m on VHV webpage."]]
+
[[File: meiview.png|700px|thumb|center|MEI contents and notation rendering after typing alt-m on VHV webpage.]]
 +
 
 +
Now, for example, measure numbers are stored in the XML path:
 +
 
 +
    /mei/music/mdiv/score/section/measure@n
  
 
=== What to hand in ===
 
=== What to hand in ===
  
Send Craig and Eleanor your MusicXML file, the converted MEI file
+
Send Craig and Eleanor your MusicXML file and a screenshot in MuseScore or VHV, the converted MEI file and the path locations of your ten or more musical features in the MusicXML and MEI data (or an element map of the entire measure/file).
and the path locations of your features in MusicXML and MEI data.
+
 
 +
 
 +
This homework is related to locating elements/attributes in XML data using systems such as [https://en.wikipedia.org/wiki/XPath XPath], which is useful to be familiar with if you work with MusicXML or MEI data.  Also, there are XML parsers for various programming languages, such as [https://pugixml.org PugiXML for C++] which use Xpath to select elements in an XML tree structure.

Latest revision as of 03:40, 23 February 2022


Compose a measure

Compose one measure of music in MuseScore, Finale, Noteflight, or Sibelius, etc. and export the score to a MusicXML file.

Your composition should have at least ten of the following musical features:

  • a slur
  • a tie
  • a rest
  • a chord
  • a beam
  • triplet rhythms
  • a key signature
  • a title
  • a composer
  • some lyrics
  • multiple verses of lyrics
  • an accidental (sharp, flat, natural, double-sharp, double-flat).
  • an implicit accidental (a note which should be played with an accidental, but it is not displayed in front of the note since it is in the key signature or a previous note at the same diatonic pitch in the measure).
  • a dynamic marking (p, mp, mf, f, etc.)
  • a crescendo/decrescendo hairpin/wedge
  • an articulations (fermata, staccato, tenuto, accent, etc.)
  • two or more layers/voices
  • two or more staves (such as grand staff for piano, or two separate instruments)
  • two or more measures
  • instrument name before music
  • transposing instrument
  • a tempo marking (Allegro, Lento, Adagio, etc)


To save MusicXML data in MuseScore, go to the Menu "File→Export..." and then select the save type as "Uncompressed MusicXML file". You might want to reload the MusicXML file back into the music editor that you used to check that it exported the features that you want (not all features of the music editor may be exported into MusicXML data, and this will depend on the editor).

Copy/Paste into online editor

Drag and drop the MusicXML file (uncompressed) onto the webpage:

   http://verovio.humdrum.org?k=e
which should result in a view something like this after dropping:
MusicXML contents and notation rendering after pasting onto VHV webpage."

Notice the little triangles next to the line numbers on the left: these can be used to show/hide the contents of XML elements, which may be useful to keep track of the location of an element.

Locations of features in MusicXML

List and/or draw a tree diagram of the XML path from the root node to each of the 10 features that you created in your composition.

For example, a note should have a path from the root node of the XML data like this:

    /score-partwise/part/measure/note

Not all features will be explicitly encoded within a single containing element (chords for example), so describe in general how it is encoded if it is not obviously encoded. If a feature is encoded as an attribute use the following style, which shows where a measure number is stored in MusicXML:

    /score-partwise/part/measure@number

This means that measure numbers are stored in the "number" attribute of measure elements, which are contained within the part element which in turn is contained in the root element "score-partwise".

Locations of features in MEI

After recording the path to the features in MusicXML, Type alt-m on the same webpage. This should convert the MusicXML data into MEI data. For each of the features that you recorded the XML path in the MusicXML data, do the same for the MEI data.

Here is an example view of the MEI data after pressing alt-m:

MEI contents and notation rendering after typing alt-m on VHV webpage.

Now, for example, measure numbers are stored in the XML path:

   /mei/music/mdiv/score/section/measure@n

What to hand in

Send Craig and Eleanor your MusicXML file and a screenshot in MuseScore or VHV, the converted MEI file and the path locations of your ten or more musical features in the MusicXML and MEI data (or an element map of the entire measure/file).


This homework is related to locating elements/attributes in XML data using systems such as XPath, which is useful to be familiar with if you work with MusicXML or MEI data. Also, there are XML parsers for various programming languages, such as PugiXML for C++ which use Xpath to select elements in an XML tree structure.