en:mei

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
en:mei [2026/04/02 07:57] – [Minimal example bringing things together] egorpolyen:mei [2026/04/02 08:09] (aktuell) egorpoly
Zeile 542: Zeile 542:
   * unique ''xml:id'' values   * unique ''xml:id'' values
   * a dynamic linked to a specific note   * a dynamic linked to a specific note
 +
 +===== The overall structure of a complete MEI file =====
 +
 +So far, many examples in this introduction have shown only small fragments, such as a single measure or a short score passage.
 +
 +That is useful for learning individual elements, but it is important to understand that a **complete MEI file** normally needs a larger structure around those fragments.
 +
 +A beginner should think of MEI on two levels:
 +
 +  * **document level** = the whole file
 +  * **music level** = the encoded notation inside the file
 +
 +===== The usual top-level structure =====
 +
 +A normal MEI document usually has this overall form:
 +
 +<code>
 +mei
 +├── meiHead
 +└── music
 +    └── body
 +        └── mdiv
 +            └── score
 +                └── section
 +                    └── measure
 +                        └── staff
 +                            └── layer
 +                                └── note / rest / chord / etc.
 +</code>
 +
 +This can be read as:
 +
 +  * ''<mei>'' = the whole MEI document
 +  * ''<meiHead>'' = metadata about the document
 +  * ''<music>'' = the musical content
 +  * ''<body>'' = the main musical body
 +  * ''<mdiv>'' = a musical division, for example a movement or other large unit
 +  * ''<score>'' = the score representation
 +  * ''<section>'' = a segment of music
 +  * ''<measure>'' = one measure
 +  * ''<staff>'' = one staff
 +  * ''<layer>'' = one layer or voice stream
 +  * ''<note>'' = one musical event
 +
 +===== Why the earlier example was incomplete =====
 +
 +This earlier example:
 +
 +<code xml>
 +<score>
 +  <scoreDef keysig="1s" meter.count="4" meter.unit="4"/>
 +  <section>
 +    <measure n="1">
 +      <staff n="1">
 +        <layer n="1">
 +          <note pname="g" oct="4" dur="4" xml:id="m1n1"/>
 +          <note pname="a" oct="4" dur="4" accid="s" xml:id="m1n2"/>
 +          <note pname="b" oct="4" dur="4" xml:id="m1n3"/>
 +          <note pname="c" oct="5" dur="4" xml:id="m1n4"/>
 +        </layer>
 +      </staff>
 +      <dynam startid="#m1n2">f</dynam>
 +    </measure>
 +  </section>
 +</score>
 +</code>
 +
 +is useful as a **score fragment**, but it is not yet a complete MEI document.
 +
 +In practice, tools such as Verovio often expect a fuller MEI wrapper around the score data.
 +
 +===== A fuller MEI example =====
 +
 +The following example shows the same musical idea inside a more complete MEI structure:
 +
 +<code xml>
 +<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.1">
 +  <meiHead>
 +    <fileDesc>
 +      <titleStmt>
 +        <title>Minimal MEI example</title>
 +      </titleStmt>
 +      <pubStmt/>
 +    </fileDesc>
 +  </meiHead>
 +
 +  <music>
 +    <body>
 +      <mdiv>
 +        <score>
 +          <scoreDef keysig="1s" meter.count="4" meter.unit="4">
 +            <staffGrp>
 +              <staffDef n="1" lines="5" clef.shape="G" clef.line="2"/>
 +            </staffGrp>
 +          </scoreDef>
 +
 +          <section>
 +            <measure n="1">
 +              <staff n="1">
 +                <layer n="1">
 +                  <note pname="g" oct="4" dur="4" xml:id="m1n1"/>
 +                  <note pname="a" oct="4" dur="4" accid="s" xml:id="m1n2"/>
 +                  <note pname="b" oct="4" dur="4" xml:id="m1n3"/>
 +                  <note pname="c" oct="5" dur="4" xml:id="m1n4"/>
 +                </layer>
 +              </staff>
 +              <dynam startid="#m1n2">f</dynam>
 +            </measure>
 +          </section>
 +        </score>
 +      </mdiv>
 +    </body>
 +  </music>
 +</mei>
 +</code>
 +
 +**Important:** In a normal five-line staff, ''<staffDef>'' should usually include ''lines="5"''.
 +Without this, some renderers may not display the staff correctly.
 +
 +You can try to render this score yourself via [[https://editor.verovio.org/|Verovio Editor]]
 +
 +===== How to read this complete example =====
 +
 +This example now includes the parts that were missing before:
 +
 +  * ''<mei>'' as the document root
 +  * ''xmlns'' to declare the MEI XML namespace
 +  * ''meiversion'' to indicate the MEI version
 +  * ''<meiHead>'' for metadata
 +  * ''<music>'' for the musical content
 +  * ''<body>'' and ''<mdiv>'' as structural containers around the score
 +  * ''<scoreDef>'' and ''<staffDef>'' to define the notational context
 +
 +Only inside this larger wrapper do we get to the actual note material.
 +
 +===== The role of ''meiHead'' =====
 +
 +The ''<meiHead>'' element contains metadata.
 +
 +For beginners, it is enough to understand that this is where information about the encoded object and the encoding can be stored, for example:
 +  * title
 +  * source information
 +  * editorial responsibility
 +  * encoding notes
 +  * revision history
 +
 +In small teaching examples, the header may be very short.
 +In research projects, it can become much more detailed.
 +
 +===== The role of ''body'' and ''mdiv'' =====
 +
 +Inside ''<music>'', the musical content is usually placed inside ''<body>''.
 +
 +Inside the body, ''<mdiv>'' represents a musical division.
 +Depending on the source, this may represent:
 +  * a whole piece
 +  * a movement
 +  * an act
 +  * a scene
 +  * another large formal division
 +
 +For simple teaching examples, one ''<mdiv>'' is usually enough.
 +
 +===== A practical beginner rule =====
 +
 +When writing MEI for testing or rendering, it is safest to think in this order:
 +
 +  - start with ''<mei>''
 +  - add ''<meiHead>''
 +  - add ''<music>''
 +  - inside music, add ''<body>''
 +  - inside body, add ''<mdiv>''
 +  - inside mdiv, add ''<score>''
 +  - inside score, add ''<scoreDef>'' and ''<section>''
 +  - inside section, add measures, staves, layers, and notes
 +
 +This avoids the impression that a musical fragment by itself is already a complete MEI file.
 +
 +===== Simplified memory aid =====
 +
 +A useful memory formula is:
 +
 +  * **MEI document** = metadata + music
 +  * **music** = body + divisions + score content
 +  * **score content** = sections + measures + staves + layers + events
 +
  
 ===== Reference ===== ===== Reference =====
  • en/mei.1775116658.txt.gz
  • Zuletzt geändert: 2026/04/02 07:57
  • von egorpoly