MeasuringPolyphony / mp_editor

https://editor.measuringpolyphony.org
4 stars 2 forks source link

Support changes in mensuration #62

Closed martha-thomae closed 3 years ago

martha-thomae commented 4 years ago

New feature request: support changes in mensuration. Allow to change mensuration by entering a new mensuration sign mid-system.

Example: The mensuration defined by the mensuration sign in the first page is changed in the second page by the new mensuration sign (which is defined mid-voice).

JRegimbal commented 4 years ago

After looking into this I'm having some trouble getting mensuration symbols that don't immediately follow the first clef in a system to render. It seems this might have to do with mensur elements ending up in the staffDef? Here is an example I'm having trouble with:

**mens  **text
*black  *
*clefC3 *
*met(C) *
sA  .
sB  .
sc  .
*met(C|)    *
sc  .
sB  .
sA  .
=-  =-
*-  *-

@craigsapp do you know of any way I could get the second symbol?

craigsapp commented 4 years ago

It looks like I do not convert mensuration signs after the first one. Can you give an MEI sample of what the output should look like? It should be easy to add the mensural change to the conversion.

I also check to see if it is related to<barline> placement (similar to CMN measure placement, where I don't think a time signature can come in the middle of a measure), but that does not convert the mensuration sign either:

Screen Shot 2020-09-01 at 4 30 51 PM

Here is the current conversion to MEI (so you can add the <mensur> with the correct attributes to generate the desired mensuration signs in case I don't do that mensuration sign yet:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2020-09-01T16:33:57" version="3.0.0-dev-d1b17d9-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000001465646584">
    <score xml:id="score-0000000958658196">
     <scoreDef xml:id="scoredef-0000000217690459" midi.bpm="400">
      <staffGrp xml:id="staffgrp-0000000142626603">
       <staffDef xml:id="staffdef-0000001161950962" n="1" notationtype="mensural.black" lines="5">
        <clef xml:id="clef-L3F1" shape="C" line="3" />
        <mensur xml:id="mensur-L4F1" sign="C" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1" right="invis">
       <staff xml:id="staff-0000000045375396" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L5F1" dur="semibrevis" oct="3" pname="a" />
         <note xml:id="note-L6F1" dur="semibrevis" oct="3" pname="b" />
         <note xml:id="note-L7F1" dur="semibrevis" oct="4" pname="c" />
         <note xml:id="note-L9F1" dur="semibrevis" oct="4" pname="c" />
         <note xml:id="note-L10F1" dur="semibrevis" oct="3" pname="b" />
         <note xml:id="note-L11F1" dur="semibrevis" oct="3" pname="a" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

Also is using staffDef the desired place to put the first mensuration sign @martha-thomae and/or @lpugin?

Also, I can make other changes to make more like the final MEI. For example I am placing the music in a long measure. Is that correct, or is there a more proper way to encode mensural music in MEI? In other words, edit the above current export to MEI to the desired output for the example, and I can adjust the conversion to match it. (You can put the edited version in this thread for reference).

martha-thomae commented 4 years ago

In MEI, <mensur> is a valid child of both <staffDef> and <layer>. So you would use it within <staffDef> to define the initial mensuration of a voice, and in <layer> to change the mensuration initially defined. So, in Mensural MEI, the encoding of the second mensuration symbol within the stream of notes in layer should look like this (while the first one, the initial mensuration of the voice, should be contained in the <staffDef> element):

<layer>
    <note dur="semibrevis" pname="a"/>
    <note dur="semibrevis" pname="b"/>
    <note dur="semibrevis" pname="c"/>
    <mensur tempus="2" prolatio="2" slash="1"/>
    <note dur="semibrevis" pname="c"/>
    <note dur="semibrevis" pname="b"/>
    <note dur="semibrevis" pname="a"/>
    <barLine/>
</layer>
martha-thomae commented 4 years ago

Ooops, answered before seeing Craig's response. Does this help, @craigsapp ?

craigsapp commented 4 years ago

Yes, that is great! What about the use of <measure>?

martha-thomae commented 4 years ago

Yes, that is great! What about the use of <measure>?

It wouldn't be correct. If you change the MEI schema from MEI All to MEI Mensural, it will complain. You should go directly from <section> to <staff> (with no <measure> in between).

Everything else (besides the measure and the missing mensuration change) should be fine with the example. I would also change the schema being referenced (to use MEI Mensural), but MEI All is still ok.

craigsapp commented 4 years ago

Also, what are the <mensur> attributes for Cut-C 3/2? is that @num=3 and @numbase="2"?

craigsapp commented 4 years ago

And/or you can point me to documentation about <mensur> if there is any (I have seen activity by @martha-thomae that might be related to this sort of thing).

martha-thomae commented 4 years ago

Ehhh, that is tricky. We are starting the discussion in the IG today about the encoding of proportions (in the _ig-mensuralproportions channel). Currently the way to do it is the one you are using here (@num="3" and @numbase="2").

craigsapp commented 4 years ago

There is also "3" mensuration, which I will get around to responding to on music-encoding/music-encoding sometime 😉

martha-thomae commented 4 years ago

And/or you can point me to documentation about <mensur> if there is any (I have seen activity by @martha-thomae that might be related to this sort of thing.

Yes, of course. I made a pull request for the Guidelines' development version. But this topic is still under discussion and we want a better way to encode mensuration signs when they include proportions.

martha-thomae commented 4 years ago

There is also "3" mensuration, which I will get around to responding to on music-encoding/music-encoding sometime 😉

I would say that when a '3' appears just by itself is more a proportion change... but Anna (Plaksin) is the expert on this topic.

craigsapp commented 4 years ago

Yes, a sesquialtera as you were mentioning, or in modern terms triplets :-). I was looking up 3 mensuration, and there is an alternate purpose, but all of the music I have use the sesquialtera meaning.

craigsapp commented 4 years ago

It wouldn't be correct. If you change the MEI schema from MEI All to MEI Mensural, it will complain. You should go directly from

to (with no in between).

How do I select "mensuration notation mode" in verovio @lpugin? I am currently trying to insert a staff into a section instead of a measure, but verovio complains:

[Error] Adding 'Staff' to a 'Section'

This is also related to the generation of these lines in the MEI conversion, which I currently do not set myself:

<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>

@martha-thomae would like them set to MEI mensural.

craigsapp commented 4 years ago

Implemented in commit https://github.com/rism-ch/verovio/commit/ae6b4950f7e64a891c98bfa7e8fdc714dcd147e0 although there is currently a hack to allow <staff> directly in <section>. I just put the compiled javascript version online, so you should be able to get mensuration changes now.

Here is a test case:

Final rendering:

Screen Shot 2020-09-01 at 8 49 29 PM

The 3/2 is a bit garrish, perhaps a san-serif font for mensural numbers could be used...

Humdrum data:

**mens  **text
*black  *
*clefC3 *
*met(C) *
sA  .
*met(C|)    *
sc  .
*met(C.)    *
sB  .
*met(C.|)   *
sd  .
*met(C|3/2) *
sc  .
*met(O) *
sA  .
*met(O|)    *
sB  .
*met(O.)    *
sB  .
*met(O.|)   *
sA  .
=-  =-
*-  *-

MEI conversion:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/4.0.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.0">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2020-09-01T20:48:08" version="3.0.0-dev-d1b17d9-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mdiv-0000000907835526">
    <score xml:id="score-0000000120373547">
     <scoreDef xml:id="scoredef-0000001007673224" midi.bpm="400">
      <staffGrp xml:id="staffgrp-0000001792943782">
       <staffDef xml:id="staffdef-0000000264843713" n="1" notationtype="mensural.black" lines="5">
        <clef xml:id="clef-L3F1" shape="C" line="3" />
        <mensur xml:id="mensur-L4F1" prolatio="2" tempus="2" dot="false" sign="C" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <staff xml:id="staff-0000000515609370" n="1">
       <layer xml:id="layer-L1F1N1" n="1">
        <note xml:id="note-L5F1" dur="semibrevis" oct="3" pname="a" />
        <mensur xml:id="mensur-L6F1" prolatio="2" tempus="2" dot="false" sign="C" slash="1" />
        <note xml:id="note-L7F1" dur="semibrevis" oct="4" pname="c" />
        <mensur xml:id="mensur-L8F1" prolatio="3" tempus="2" dot="true" sign="C" />
        <note xml:id="note-L9F1" dur="semibrevis" oct="3" pname="b" />
        <mensur xml:id="mensur-L10F1" prolatio="3" tempus="2" dot="true" sign="C" slash="1" />
        <note xml:id="note-L11F1" dur="semibrevis" oct="4" pname="d" />
        <mensur xml:id="mensur-L12F1" num="3" numbase="2" prolatio="2" tempus="2" dot="false" sign="C" slash="1" />
        <note xml:id="note-L13F1" dur="semibrevis" oct="4" pname="c" />
        <mensur xml:id="mensur-L14F1" prolatio="2" tempus="3" dot="false" sign="O" />
        <note xml:id="note-L15F1" dur="semibrevis" oct="3" pname="a" />
        <mensur xml:id="mensur-L16F1" prolatio="2" tempus="3" dot="false" sign="O" slash="1" />
        <note xml:id="note-L17F1" dur="semibrevis" oct="3" pname="b" />
        <mensur xml:id="mensur-L18F1" prolatio="3" tempus="3" dot="true" sign="O" />
        <note xml:id="note-L19F1" dur="semibrevis" oct="3" pname="b" />
        <mensur xml:id="mensur-L20F1" prolatio="3" tempus="3" dot="true" sign="O" slash="1" />
        <note xml:id="note-L21F1" dur="semibrevis" oct="3" pname="a" />
       </layer>
      </staff>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

Note that verovio is adding the @sign and @dot="false" attributes to the `. Do you want them? If not they @JRegimbal can remove them afterwards, or @lpugin could suppress generating these attributes automatically in verovio (at least when exporting MEI).


Previously I had been converting to the visual parameters such as @sign rather than @tempus and @prolatio, since those were added to veorvio after I implemented the **mens converter. I could also add @sign if that is desired (but verovio is currently adding that automatically).

Here is the code in https://github.com/rism-ch/verovio/blob/ae6b4950f7/src/iohumdrum.cpp#L4902-L4953 for generating mensuration signs:

    if (metersig == "*met(C)" || metersig == "C") {
        vrvmensur->SetTempus(TEMPUS_2);
        vrvmensur->SetProlatio(PROLATIO_2);
        return;
    }
    if (metersig == "*met(C|)" || metersig == "C|") {
        vrvmensur->SetTempus(TEMPUS_2);
        vrvmensur->SetProlatio(PROLATIO_2);
        vrvmensur->SetSlash(1);
        return;
    }
    if (metersig == "*met(O)" || metersig == "O") {
        vrvmensur->SetTempus(TEMPUS_3);
        vrvmensur->SetProlatio(PROLATIO_2);
        return;
    }
    if (metersig == "*met(O|)" || metersig == "O|") {
        vrvmensur->SetTempus(TEMPUS_3);
        vrvmensur->SetProlatio(PROLATIO_2);
        vrvmensur->SetSlash(1);
        return;
    }
    if (metersig == "*met(O.)" || metersig == "O.") {
        vrvmensur->SetTempus(TEMPUS_3);
        vrvmensur->SetProlatio(PROLATIO_3);
        return;
    }
    if (metersig == "*met(O.|)" || metersig == "O.|") {
        vrvmensur->SetTempus(TEMPUS_3);
        vrvmensur->SetProlatio(PROLATIO_3);
        vrvmensur->SetSlash(1);
        return;
    }
    if (metersig == "*met(C.)" || metersig == "C.") {
        vrvmensur->SetTempus(TEMPUS_2);
        vrvmensur->SetProlatio(PROLATIO_3);
        return;
    }
    if (metersig == "*met(C.|)" || metersig == "C.|") {
        vrvmensur->SetTempus(TEMPUS_2);
        vrvmensur->SetProlatio(PROLATIO_3);
        vrvmensur->SetSlash(1);
        return;
    }
    if (metersig == "*met(C|3/2)" || metersig == "C|3/2") {
        vrvmensur->SetTempus(TEMPUS_2);
        vrvmensur->SetProlatio(PROLATIO_2);
        vrvmensur->SetNum(3);
        vrvmensur->SetNumbase(2);
        vrvmensur->SetSlash(1);
        return;
    }

Other signs not in the above list will be attempted with visual parameters.

craigsapp commented 4 years ago

Also (mostly for @JRegimbal): non-trivial fixes to the **mens-to-MEI converter should be done by me in the iohumdrum.cpp file in the verovio repository, although issues related to changes can be posted in this repository. Non-trivial fixes would be things like removing <measure> and inserting <mensur> changes. Also adding things like coronas (fermatas) and other features that are not addressed yet.

Trivial changes of course can be done by you in preparation for sending to the scoring-up tool. This would include changing @xml:ids and possibly removing mensur@sign and mensur@dot="false".

martha-thomae commented 3 years ago

Sorry, it seems I missed a few messages.

Thanks, @craigsapp! :) I am glad that we can have mensuration changes in **mens now!

The mensuration signs in **mens seem to be converted to the right values in terms of tempus and prolatio for MEI. Thank you.

martha-thomae commented 3 years ago

Hi @JRegimbal and @craigsapp! This seems to be working perfectly now in the MP-Editor, thank you!

martha-thomae commented 3 years ago

@JRegimbal only one minor issue.

Again, when I enter everything in the mp-editor, I am able to enter the mensuration change with no issues at all.

However, when I load a parts-file which includes a mensuration change, the value of the @modusminor attribute gets lost.

I am attaching here the parts-file I imported and what the editor shows me when I click over the mensuration sign. You can see that there is no radio button selected for the 'modus', even though there is a @modusminor attribute in the imported file.

shortexample_mensurchange.mei 2.zip shortexample_mensurchange

martha-thomae commented 3 years ago

So, when I said that the @modusminor gets lost, I mean that modus is not assigned any of the three possible values (neither 3 nor 2 nor N/A, as can be seen in the screenshot of the previous comment). This has an unexpected consequence, which is that moving to the score editor fails: Screen Shot 2021-05-26 at 9 10 13 AM

The line 309 in score_verovio_view.component.ts is: Screen Shot 2021-05-26 at 9 10 23 AM

So, the issue is happening before getting into the scoring-up script. The meiDocis null (something is affecting it before getting to this runScoringUp function).


Observations:

Ways around this:


This issue is also affecting the files that come from MuRET since they do have values for the four mensuration levels: @modusmaior, @modusminor, @tempus, and @prolatio. This ends up with the same case shown in the screenshot of the previous comment where modus isn't assigned a value (neither 3 nor 2 nor N/A), and then moving to the score editor fails.