Digital humanities


Author: Eric Gratta (eag55@pitt.edu) Maintained by: David J. Birnbaum (djbpitt@gmail.com) [Creative Commons BY-NC-SA 3.0 Unported License] Last modified: 2021-12-27T22:03:50+0000


Descriptive markup exercise: MEI music notation

Introduction

The assignment is to examine the musical notation above and encode it using markup that conforms to the MEI standard. In order to verify whether your markup is correct, you need to download following materials (don’t just click on the links; you need to right-click and select Save as):

Save all five files in the same directory on your computer, and use that directory to create your own XML file, as described below.

For this assignment, you’ll use the schema to provide validation support as you create a valid MEI document, and you’ll then use the XSLT to convert the XML into a typeset representation, which you can compare visually with the input image (above) to check the accuracy of your work. (You’re welcome to experiment with changing some of the music and regenerating the output to see the effect, but because the XSLT was designed specifically for this assignment, and not as a general-purpose MEI processor, it is possible to break it by using parts of MEI for which we haven’t provided any code.)

The Music encoding initiative (MEI) schema

This assignment uses a subset of MEI. A full MEI document, as explained in class, has a very deep hierarchy, with most of the actual music being encoded in <layer> elements. In order to simplify the assignment and improve its legibility, you’ll be creating an XML file with a root element <layer> (even though <layer> normally occurs deep inside an MEI document, and not as the root). For reasons we’ll discuss later, you also need to add a bit of code to that <layer> element, which looks like an attribute called xmnls with the value http://www.music-encoding.org/ns/mei. (Although this looks like an attribute, it’s actually something else, a namespace declaration. You don’t need to worry about the difference for the moment.) The exoskeleton for your document, then, should look like:

<layer xmlns="http://www.music-encoding.org/ns/mei">
            
</layer>

Associate your document with the schema you’ve downloaded before you do any other work, so that <oXygen/> will validate your work and tell you when you’ve done something not permitted by the schema. Since <oXygen/> schema validation can tell you whether your XML is valid, but not whether it actually represents the right notes, you should also use the XSLT transformation tool to transform and view your work. You’ll do this in <oXygen/> using what’s called an XML transformation scenario, the output of which will be typeset music. Try first creating a single <note> element with C as its pitch, quarter (note) as its duration, and in the fourth octave (the octave beginning at middle C):

<note pname="c" dur="4" oct="4"/>

As we explained in class, the order of attributes doesn’t matter, so you can enter them in whatever order you find easiest to read and understand.

Viewing your music

After you’ve created this one-note file, save it (call it gratta.xml or something similar, using your own surname) and then open up the XSL stylesheet called layerRender.xsl (which you downloaded above) in <oXygen/>. There are several ways to use XSLT to transform an XML document into something else (in this case, an SVG graphic representation of typeset music), and the one we’ll use here is a transformation scenario. To configure that, after you have both your XML document and the XSLT stylesheet open in <oXygen/>, go to the menu bar at the top and choose Document → Transformation → Configure Transformation Scenario(s). Click New, and select XML transformation with XSLT. Give this scenario a name (say, music). Then, select the files that will serve as your XML and your XSL stylesheet by clicking the folder icons next to the text boxes labeled XML URL (for the XML file) and XSL URL (for the XSLT stylesheet). and locating them on your computer. The XML should be the file containing the one note you just made inside a layer, and the XSLT stylsheet file should be layerRender.xsl. Click the dropdown menu labeled Transformer: and select Saxon-HE 9.4.0.3. Now, click the Output tab, and make sure that the boxes for both XML and SVG are checked. Once that’s done, you can click OK, and either select Apply associated or, while viewing your XSLT stylesheet in <oXygen/>, press the red play button which is called Apply Transformation Scenario. Remember that this button will only work while you are viewing the XSLT stylesheet in <oXygen/>.

After all of that, what you should have will look like this:

If you have trouble getting to this step, e-mail me at eag55@pitt.edu. If you’ve gotten here, you’re ready to complete the assignment, which is to encode the entire piece of music at the top of this page in MEI.

Download links

Tips

Here are some images to assist those of you unfamiliar with music notation to identify octave numbers and pitch names in treble clef.

Treble Clef Notes

Octave Numbers