[MEI-L] Uniqueness and Consistency of @n for <staff> and <layer>

Christopher Antila christopher at antila.ca
Fri Jun 20 16:13:45 CEST 2014


Greetings to the MEI community!

I'm working on a Python module to import MEI files to the "music21"
library. I've noticed the MEI Guidelines tend toward flexibility, which
is good, but I'd like to request clarification on a couple of edge
cases.

My questions stem from the nesting of staff and measure objects. In
music21, a Part (analogous to <staff>) holds Measure objects
(<measure>), which in turn hold Voice objects (<layer>). Every Part
therefore runs continuously from beginning to end. In MEI this is
slightly different: a <measure> holds a <staff>, which holds <layers>.
Therefore, when importing an MEI <measure>, music21 must determine which
Part a <staff> tag corresponds to, using the @n and @def attributes. But
when do those change, and how unique are they?

Can I rely on @n attributes shared by a <staff> and <staffDef> to be
unique within a <score>? Or should I account for the possibility that
the same "source document" staff may have its <staff> tag's @n attribute
changed by a <staffDef> part-way through the <score>?

Example... is this valid?
<measure>
   <staff n="1">
      <staffDef n="1">the only tuba part</staffDef>
   </staff>
</measure>
<measure>
   <staff n="2">
      <staffDef n="2">the same tuba part with a new @n</staffDef>
   </staff>
</measure>

What if we add a new instrument in the second <measure>, so the same @n
attribute refers to a different <staff>/<staffDef> combination at
different times?
<measure>
   <staff n="1">
      <staffDef n="1">the only tuba part</staffDef>
   </staff>
</measure>
<measure>
   <staff n="1">
      <staffDef n="1">a new clarinet part with previously-used
@n</staffDef>
   </staff>
   <staff n="2">
      <staffDef n="2">the same tuba part with a new @n</staffDef>
   </staff>
</measure>

Also, can I trust that every <layer> has an @n that's unique across the
whole <score>? Or is it that a <layer>'s @n attribute will be unique
only within its <staff> context?

Example... is this possible?
<measure>
   <staff n="1">
      <staffDef n="1">clarinet parts</staffDef>
      <layer n="1"></layer>
      <layer n="2"></layer>
   </staff>
   <staff n="2">
      <staffDef n="2">tuba parts</staffDef>
      <layer n="1"></layer>
      <layer n="2"></layer>
   </staff>
</measure>

Finally, should I account for a situation where the same staff has
<staff> tags bound to a <staffDef> occasionally with @n and occasionally
with @def?

Consider this situation:
<staffDef n="1" xml:id="2c64" />
<staff n="1" />
<staff def="#2c64" />
<staff n="1" def="#2c64" />

The Guidelines say a <staff> tag "should always refer to a <staffDef>
element, using either an @n or @def attribute," so I assume the third
<staff> tag, which has both @n and @def, is not valid (pg.68ff, if
you're following along). The Guidelines do show an analogous situation,
where a <staffDef> defines both @n and @id, and the following two
<staff> tags use @def then @n. In the example these tags are separated
by "or" in a comment, but this seems like it's only a per-tag "or," not
a per-document "or."

Thanks in advance for your guidance. I'd be happy to clarify any of
these situations.


Christopher
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://lists.uni-paderborn.de/pipermail/mei-l/attachments/20140620/34f2b41b/attachment.sig>


More information about the mei-l mailing list