cemfi / meico

A converter framework with support for MEI, MSM, MPM, MIDI, WAV, MP3, chroma, and XSLT
GNU General Public License v3.0
67 stars 12 forks source link

Support for @sameas #19

Closed ndubo closed 5 years ago

ndubo commented 5 years ago

For the encoding of orchestral scores, we make extensive use of @sameas for rests and notes shared by two instruments (encoded in two layers) on the same staff. Otherwise, full encoding in all layers would result in unwanted double rendering of elements. k165001ObCorm11ff In the example shown, the quarter rest in m. 11 of the oboes is fully encoded in layer 1 (= oboe 1) but with @sameas in layer 2 (= oboe 2), i.e. @dur is found in layer 1 only; the rest in layer 2 has to take the duration from the rest it is pointing at. MEICO currently ignores the rest in layer 2 with the effect that oboe 2 starts on the first beat of the measure instead of the second (echoed by oboe 1 on beat 2). This can be observed throughout mm. 11-14 in the oboes as well as in m. 18 in the horns (eighth rest). Here is the data:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/3.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<mei meiversion="3.0.0" xmlns="http://www.music-encoding.org/ns/mei">
    <meiHead meiversion="3.0.0">
        <fileDesc>
            <titleStmt>
                <title>example K. 165/01 mm. 11-18</title>
            </titleStmt>
            <pubStmt/>
        </fileDesc>     
    </meiHead>
    <music meiversion="3.0.0">
        <body>
            <mdiv n="1" xml:id="mdiv_165001">
                <score xml:id="score_165001">
                    <scoreDef key.mode="major" key.pname="f" key.sig="1f" meter.count="4" meter.sym="common" meter.unit="4" xml:id="scoreDef_01">
                        <staffGrp barthru="false" xml:id="staffGrp_01">
                            <staffGrp symbol="bracket" xml:id="staffGrp_02">
                                <staffDef clef.line="2" clef.shape="G" label="Oboe I, II" lines="5" n="1" xml:id="staffDef_P1">
                                    <layerDef label.abbr="Ob. I" n="1" xml:id="layerDef_2079"/>
                                    <layerDef label.abbr="Ob. II" n="2" xml:id="layerDef_2082"/>
                                </staffDef>
                            </staffGrp>
                            <staffGrp symbol="bracket" xml:id="staffGrp_03">
                                <staffDef clef.line="2" clef.shape="G" key.sig="0" label="Corno I, II in Fa/F" lines="5" n="2" trans.semi="-7" xml:id="staffDef_P2">
                                    <layerDef n="1" xml:id="layerDef_2091"/>
                                    <layerDef n="2" xml:id="layerDef_2094"/>
                                </staffDef>
                            </staffGrp>
                        </staffGrp>
                    </scoreDef>
                    <section xml:id="section_allegro">
                        <measure n="11" xml:id="m11_k165_001">
                            <staff n="1" xml:id="staff_4512">
                                <layer n="1" xml:id="layer_4515">
                                    <rest dur="4" tstamp="1" xml:id="rest_4518"/>
                                    <beam xml:id="beam_4521">
                                        <note dur="16" oct="5" pname="c" tstamp="2" xml:id="note_4524"/>
                                        <note dur="16" oct="5" pname="d" tstamp="2.25" xml:id="note_4527"/>
                                        <note dur="16" oct="5" pname="c" tstamp="2.5" xml:id="note_4530"/>
                                        <note accid.ges="f" dur="16" oct="4" pname="b" tstamp="2.75" xml:id="note_4533"/>
                                    </beam>
                                    <beam xml:id="beam_4536">
                                        <note artic="spicc" dur="8" oct="4" pname="a" tstamp="3" xml:id="note_4539"/>
                                        <note accid.ges="f" artic="spicc" dur="8" oct="4" pname="b" tstamp="3.5" xml:id="note_4542"/>
                                    </beam>
                                    <note artic="spicc" dur="8" oct="5" pname="c" tstamp="4" xml:id="note_4545"/>
                                    <rest dur="8" tstamp="4.5" xml:id="rest_4548"/>
                                </layer>
                                <layer n="2" xml:id="layer_4551">
                                    <rest sameas="#rest_4518" tstamp="1" xml:id="rest_4554"/>
                                    <beam xml:id="beam_4557">
                                        <note dur="16" oct="4" pname="a" tstamp="2" xml:id="note_4560"/>
                                        <note accid.ges="f" dur="16" oct="4" pname="b" tstamp="2.25" xml:id="note_4563"/>
                                        <note dur="16" oct="4" pname="a" tstamp="2.5" xml:id="note_4566"/>
                                        <note dur="16" oct="4" pname="g" tstamp="2.75" xml:id="note_4569"/>
                                    </beam>
                                    <beam xml:id="beam_4572">
                                        <note dur="8" oct="4" pname="f" tstamp="3" xml:id="note_4575">
                                                <artic artic="spicc" xml:id="artic_4575"/>
                                        </note>
                                        <note dur="8" oct="4" pname="g" tstamp="3.5" xml:id="note_4578">
                                                <artic artic="spicc" xml:id="artic_4578"/>
                                        </note>
                                    </beam>
                                    <note dur="8" oct="4" pname="a" tstamp="4" xml:id="note_4581">
                                            <artic artic="spicc" xml:id="artic_4581"/>
                                    </note>
                                    <rest sameas="#rest_4548" tstamp="4.5" xml:id="rest_4584"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_4587">
                                <layer n="1" xml:id="layer_4590">
                                    <note dur="4" oct="5" pname="c" tstamp="1" xml:id="note_4593"/>
                                    <rest dur="4" tstamp="2" xml:id="rest_4596"/>
                                    <rest dur="2" tstamp="3" xml:id="rest_4599"/>
                                </layer>
                                <layer n="2" xml:id="layer_4602">
                                    <note dur="4" oct="4" pname="c" tstamp="1" xml:id="note_4605"/>
                                    <rest sameas="#rest_4596" tstamp="2" xml:id="rest_4608"/>
                                    <rest sameas="#rest_4599" tstamp="3" xml:id="rest_4611"/>
                                </layer>
                            </staff>
                            <slur endid="#note_4533" layer="1" staff="1" startid="#note_4524" xml:id="slur_4695"/>
                            <slur endid="#note_4569" layer="2" staff="1" startid="#note_4560" xml:id="slur_4698"/>
                        </measure>
                        <measure n="12" xml:id="m12_k165_001">
                            <staff n="1" xml:id="staff_4704">
                                <layer n="1" xml:id="layer_4707">
                                    <rest dur="4" tstamp="1" xml:id="rest_4710"/>
                                    <beam xml:id="beam_4713">
                                        <note dur="16" oct="5" pname="f" tstamp="2" xml:id="note_4716"/>
                                        <note dur="16" oct="5" pname="g" tstamp="2.25" xml:id="note_4719"/>
                                        <note dur="16" oct="5" pname="f" tstamp="2.5" xml:id="note_4722"/>
                                        <note dur="16" oct="5" pname="e" tstamp="2.75" xml:id="note_4725"/>
                                    </beam>
                                    <beam xml:id="beam_4728">
                                        <note artic="spicc" dur="8" oct="5" pname="d" tstamp="3" xml:id="note_4731"/>
                                        <note artic="spicc" dur="8" oct="5" pname="e" tstamp="3.5" xml:id="note_4734"/>
                                    </beam>
                                    <note artic="spicc" dur="8" oct="5" pname="f" tstamp="4" xml:id="note_4737"/>
                                    <rest dur="8" tstamp="4.5" xml:id="rest_4740"/>
                                </layer>
                                <layer n="2" xml:id="layer_4743">
                                    <rest sameas="#rest_4710" tstamp="1" xml:id="rest_4746"/>
                                    <beam xml:id="beam_4749">
                                        <note dur="16" oct="5" pname="d" tstamp="2" xml:id="note_4752"/>
                                        <note dur="16" oct="5" pname="e" tstamp="2.25" xml:id="note_4755"/>
                                        <note dur="16" oct="5" pname="d" tstamp="2.5" xml:id="note_4758"/>
                                        <note dur="16" oct="5" pname="c" tstamp="2.75" xml:id="note_4761"/>
                                    </beam>
                                    <beam xml:id="beam_4764">
                                        <note accid.ges="f" artic="spicc" dur="8" oct="4" pname="b" tstamp="3" xml:id="note_4767"/>
                                        <note artic="spicc" dur="8" oct="5" pname="c" tstamp="3.5" xml:id="note_4770"/>
                                    </beam>
                                    <note dur="8" oct="5" pname="d" tstamp="4" xml:id="note_4773">
                                        <supplied resp="#NMA-editors" xml:id="supplied_4773">
                                            <artic artic="spicc" xml:id="artic_4773"/>
                                        </supplied>
                                    </note>
                                    <rest sameas="#rest_4740" tstamp="4.5" xml:id="rest_4776"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_4779">
                                <layer n="1" xml:id="layer_4782">
                                    <note dur="4" oct="5" pname="c" tstamp="1" xml:id="note_4785"/>
                                    <rest dur="4" tstamp="2" xml:id="rest_4788"/>
                                    <rest dur="2" tstamp="3" xml:id="rest_4791"/>
                                </layer>
                                <layer n="2" xml:id="layer_4794">
                                    <note dur="4" oct="4" pname="c" tstamp="1" xml:id="note_4797"/>
                                    <rest sameas="#rest_4788" tstamp="2" xml:id="rest_4800"/>
                                    <rest sameas="#rest_4791" tstamp="3" xml:id="rest_4803"/>
                                </layer>
                            </staff>
                            <slur endid="#note_4725" layer="1" staff="1" startid="#note_4716" xml:id="slur_4887"/>
                            <slur endid="#note_4761" layer="2" staff="1" startid="#note_4752" xml:id="slur_4890"/>
                        </measure>
                        <measure n="13" xml:id="m13_k165_001">
                            <staff n="1" xml:id="staff_4899">
                                <layer n="1" xml:id="layer_4902">
                                    <rest dur="4" tstamp="1" xml:id="rest_4905"/>
                                    <beam xml:id="beam_4908">
                                        <note dur="16" oct="6" pname="c" tstamp="2" xml:id="note_4911"/>
                                        <note dur="16" oct="6" pname="d" tstamp="2.25" xml:id="note_4914"/>
                                        <note dur="16" oct="6" pname="c" tstamp="2.5" xml:id="note_4917"/>
                                        <note accid.ges="f" dur="16" oct="5" pname="b" tstamp="2.75" xml:id="note_4920"/>
                                    </beam>
                                    <beam xml:id="beam_4923">
                                        <note artic="spicc" dur="8" oct="5" pname="a" tstamp="3" xml:id="note_4926"/>
                                        <note accid.ges="f" artic="spicc" dur="8" oct="5" pname="b" tstamp="3.5" xml:id="note_4929"/>
                                    </beam>
                                    <note artic="spicc" dur="8" oct="6" pname="c" tstamp="4" xml:id="note_4932"/>
                                    <rest dur="8" tstamp="4.5" xml:id="rest_4935"/>
                                </layer>
                                <layer n="2" xml:id="layer_4938">
                                    <rest sameas="#rest_4905" tstamp="1" xml:id="rest_4941"/>
                                    <beam xml:id="beam_4944">
                                        <note dur="16" oct="5" pname="a" tstamp="2" xml:id="note_4947"/>
                                        <note accid.ges="f" dur="16" oct="5" pname="b" tstamp="2.25" xml:id="note_4950"/>
                                        <note dur="16" oct="5" pname="a" tstamp="2.5" xml:id="note_4953"/>
                                        <note dur="16" oct="5" pname="g" tstamp="2.75" xml:id="note_4956"/>
                                    </beam>
                                    <beam xml:id="beam_4959">
                                        <note artic="spicc" dur="8" oct="5" pname="f" tstamp="3" xml:id="note_4962"/>
                                        <note artic="spicc" dur="8" oct="5" pname="g" tstamp="3.5" xml:id="note_4965"/>
                                    </beam>
                                    <note artic="spicc" dur="8" oct="5" pname="a" tstamp="4" xml:id="note_4968"/>
                                    <rest sameas="#rest_4935" tstamp="4.5" xml:id="rest_4971"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_4974">
                                <layer n="1" xml:id="layer_4977">
                                    <note dur="4" oct="5" pname="e" tstamp="1" xml:id="note_4980"/>
                                    <rest dur="4" tstamp="2" xml:id="rest_4983"/>
                                    <rest dur="2" tstamp="3" xml:id="rest_4986"/>
                                </layer>
                                <layer n="2" xml:id="layer_4989">
                                    <note dur="4" oct="5" pname="c" tstamp="1" xml:id="note_4992"/>
                                    <rest sameas="#rest_4983" tstamp="2" xml:id="rest_4995"/>
                                    <rest sameas="#rest_4986" tstamp="3" xml:id="rest_4998"/>
                                </layer>
                            </staff>
                            <slur endid="#note_4920" layer="1" staff="1" startid="#note_4911" xml:id="slur_5088"/>
                            <slur endid="#note_4956" layer="2" staff="1" startid="#note_4947" xml:id="slur_5091"/>
                        </measure>
                        <measure n="14" xml:id="m14_k165_001">
                            <staff n="1" xml:id="staff_5100">
                                <layer n="1" xml:id="layer_5103">
                                    <rest dur="4" tstamp="1" xml:id="rest_5106"/>
                                    <beam xml:id="beam_5109">
                                        <note accid.ges="f" dur="16" oct="5" pname="b" tstamp="2" xml:id="note_5112"/>
                                        <note dur="16" oct="6" pname="c" tstamp="2.25" xml:id="note_5115"/>
                                        <note accid.ges="f" dur="16" oct="5" pname="b" tstamp="2.5" xml:id="note_5118"/>
                                        <note dur="16" oct="5" pname="a" tstamp="2.75" xml:id="note_5121"/>
                                    </beam>
                                    <beam xml:id="beam_5124">
                                        <note artic="spicc" dur="8" oct="5" pname="g" tstamp="3" xml:id="note_5127"/>
                                        <note artic="spicc" dur="8" oct="5" pname="a" tstamp="3.5" xml:id="note_5130"/>
                                    </beam>
                                    <note accid.ges="f" artic="spicc" dur="8" oct="5" pname="b" tstamp="4" xml:id="note_5133"/>
                                    <rest dur="8" tstamp="4.5" xml:id="rest_5136"/>
                                </layer>
                                <layer n="2" xml:id="layer_5139">
                                    <rest sameas="#rest_5106" tstamp="1" xml:id="rest_5142"/>
                                    <beam xml:id="beam_5145">
                                        <note dur="16" oct="5" pname="g" tstamp="2" xml:id="note_5148"/>
                                        <note dur="16" oct="5" pname="a" tstamp="2.25" xml:id="note_5151"/>
                                        <note dur="16" oct="5" pname="g" tstamp="2.5" xml:id="note_5154"/>
                                        <note dur="16" oct="5" pname="f" tstamp="2.75" xml:id="note_5157"/>
                                    </beam>
                                    <beam xml:id="beam_5160">
                                        <note artic="spicc" dur="8" oct="5" pname="e" tstamp="3" xml:id="note_5163"/>
                                        <note artic="spicc" dur="8" oct="5" pname="f" tstamp="3.5" xml:id="note_5166"/>
                                    </beam>
                                    <note artic="spicc" dur="8" oct="5" pname="g" tstamp="4" xml:id="note_5169"/>
                                    <rest sameas="#rest_5136" tstamp="4.5" xml:id="rest_5172"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_5175">
                                <layer n="1" xml:id="layer_5178">
                                    <note dur="4" oct="5" pname="d" tstamp="1" xml:id="note_5181"/>
                                    <rest dur="4" tstamp="2" xml:id="rest_5184"/>
                                    <rest dur="2" tstamp="3" xml:id="rest_5187"/>
                                </layer>
                                <layer n="2" xml:id="layer_5190">
                                    <note dur="4" oct="4" pname="g" tstamp="1" xml:id="note_5193"/>
                                    <rest sameas="#rest_5184" tstamp="2" xml:id="rest_5196"/>
                                    <rest sameas="#rest_5187" tstamp="3" xml:id="rest_5199"/>
                                </layer>
                            </staff>
                            <slur endid="#note_5121" layer="1" staff="1" startid="#note_5112" xml:id="slur_5289"/>
                            <slur endid="#note_5157" layer="2" staff="1" startid="#note_5148" xml:id="slur_5292"/>
                        </measure>
                        <measure n="15" xml:id="m15_k165_001">
                            <staff n="1" xml:id="staff_5298">
                                <layer n="1" xml:id="layer_5301">
                                    <note dur="4" oct="5" pname="a" tstamp="1" xml:id="note_5304"/>
                                    <note dur="4" oct="5" pname="f" tstamp="2" xml:id="note_5307"/>
                                    <note dur="4" oct="5" pname="e" tstamp="3" xml:id="note_5310"/>
                                    <note dur="4" oct="5" pname="d" tstamp="4" xml:id="note_5313"/>
                                </layer>
                                <layer n="2" xml:id="layer_5316">
                                    <note dur="2" oct="5" pname="f" tstamp="1" xml:id="note_5319"/>
                                    <note dur="4" oct="5" pname="e" tstamp="3" xml:id="note_5322"/>
                                    <note dur="4" oct="5" pname="d" tstamp="4" xml:id="note_5325"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_5328">
                                <layer n="1" xml:id="layer_5331">
                                    <note dur="1" oct="5" pname="c" tstamp="1" xml:id="note_5334"/>
                                </layer>
                                <layer n="2" xml:id="layer_5337">
                                    <note dur="1" oct="4" pname="c" tstamp="1" xml:id="note_5340"/>
                                </layer>
                            </staff>
                            <tie endid="#note_5559" layer="1" staff="2" startid="#note_5334" xml:id="tie_5511"/>
                            <tie endid="#note_5565" layer="2" staff="2" startid="#note_5340" xml:id="tie_5512"/>
                        </measure>
                        <measure n="17" xml:id="m17_k165_001">
                            <staff n="1" xml:id="staff_5748">
                                <layer n="1" xml:id="layer_5751">
                                    <note dur="4" oct="5" pname="c" tstamp="1" xml:id="note_5754"/>
                                    <note dur="4" oct="5" pname="a" tstamp="2" xml:id="note_5757"/>
                                    <note dur="2" oct="5" pname="g" tstamp="3" xml:id="note_5760"/>
                                </layer>
                                <layer n="2" xml:id="layer_5763">
                                    <note dur="4" oct="5" pname="c" tstamp="1" xml:id="note_5766"/>
                                    <note dur="2" oct="5" pname="f" tstamp="2" xml:id="note_5769"/>
                                    <note dur="4" oct="5" pname="e" tstamp="4" xml:id="note_5772"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_5775">
                                <layer n="1" xml:id="layer_5778">
                                    <note dur="4" oct="5" pname="c" tstamp="1" xml:id="note_5781"/>
                                    <note dur="4" oct="5" pname="e" tstamp="2" xml:id="note_5784"/>
                                    <note dur="2" oct="5" pname="d" tstamp="3" xml:id="note_5787"/>
                                </layer>
                                <layer n="2" xml:id="layer_5790">
                                    <note dur="4" oct="4" pname="c" tstamp="1" xml:id="note_5793"/>
                                    <note dur="2" oct="5" pname="c" tstamp="2" xml:id="note_5796"/>
                                    <note dur="4" oct="4" pname="g" tstamp="4" xml:id="note_5799"/>
                                </layer>
                            </staff>
                            <trill layer="1" staff="1" startid="#note_5760" xml:id="trill_5919"/>
                        </measure>
                        <measure n="18" xml:id="m18_k165_001">
                            <staff n="1" xml:id="staff_5928">
                                <layer n="1" xml:id="layer_5931">
                                    <note dur="4" oct="5" pname="f" tstamp="1" xml:id="note_5934"/>
                                    <rest dur="4" tstamp="2" xml:id="rest_5937"/>
                                    <rest dur="2" tstamp="3" xml:id="rest_5940"/>
                                </layer>
                                <layer n="2" xml:id="layer_5931a">
                                    <note dur="4" oct="5" pname="f" tstamp="1" xml:id="note_5934a"/>
                                    <rest sameas="#rest_5937" tstamp="2" xml:id="rest_5937a"/>
                                    <rest sameas="#rest_5940" tstamp="3" xml:id="rest_5940a"/>
                                </layer>
                            </staff>
                            <staff n="2" xml:id="staff_5943">
                                <layer n="1" xml:id="layer_5946">
                                    <beam xml:id="beam_5949">
                                        <note dur="8" oct="5" pname="c" tstamp="1" xml:id="note_5952"/>
                                        <note dur="8" oct="5" pname="c" tstamp="1.5" xml:id="note_5955"/>
                                    </beam>
                                    <note dur="4" oct="5" pname="c" tstamp="2" xml:id="note_5958"/>
                                    <rest dur="8" tstamp="3" xml:id="rest_5961"/>
                                    <note dur="8" oct="5" pname="c" tstamp="3.5" xml:id="note_5964"/>
                                    <note dur="4" oct="5" pname="c" tstamp="4" xml:id="note_5967"/>
                                </layer>
                                <layer n="2" xml:id="layer_5970">
                                    <beam xml:id="beam_5973">
                                        <note dur="8" oct="4" pname="e" tstamp="1" xml:id="note_5976"/>
                                        <note dur="8" oct="4" pname="c" tstamp="1.5" xml:id="note_5979"/>
                                    </beam>
                                    <note dur="4" oct="4" pname="c" tstamp="2" xml:id="note_5982"/>
                                    <rest sameas="#rest_5961" tstamp="3" xml:id="rest_5985"/>
                                    <note dur="8" oct="4" pname="c" tstamp="3.5" xml:id="note_5988"/>
                                    <note dur="4" oct="4" pname="c" tstamp="4" xml:id="note_5991"/>
                                </layer>
                            </staff>
                        </measure>
                    </section>
                </score>
            </mdiv>
        </body>
    </music>
</mei>

The full piece is available at https://dme.mozarteum.at/movi/navigator/165/001/01 Support for @sameas, especially for rests, is highly desirable. Otherwise orchestral scores cannot be played with accuracy in MEICO.

axelberndt commented 5 years ago

This is a good point. If I understand @sameas correctly it does the same as @copyof but is not rendered - like a "gestural copyof". Are the children of a referred element included? I mean, in case of a @copyof meico makes deep copies of the element, is this the same with @sameas?

ndubo commented 5 years ago

Yes, that's the way one could describe it. Children are included such as an <accid> within a <note>. The attributes of the element and child elements should be copied, e.g. the moment when the part is extracted (oboe 2 in the above example) or converted to another format such as MIDI. We were advised to use @sameas instead of @copyof; it makes sense und works well when rendering the score. So far, we use it mostly with <rest> (<mRest>), <note>, and <layer> in case of a unison (when layer 2 is the same as layer 1), occasionally with <clef>, not with <beam>.

axelberndt commented 5 years ago

Done. See meico release v0.6.10. Thanks for your comment. It works with your sample code and hopefully also with all your other files. Please let me know if it still behaves wrong.