Skip to content

Commit

Permalink
Implementation for issue MeasuringPolyphony/mp_editor#62
Browse files Browse the repository at this point in the history
  • Loading branch information
craigsapp committed Sep 2, 2020
1 parent 71008ba commit ae6b495
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 51 deletions.
5 changes: 4 additions & 1 deletion include/vrv/iohumdrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ class HumdrumInput : public vrv::Input {
void checkForBreak(hum::HumdrumFile &infile, int line);
int getLowestDiatonicPitch(hum::HTp token, const string &requirement);
int getHighestDiatonicPitch(hum::HTp token, const string &requirement);
bool hasMensuralStaff(hum::HLp line);

// header related functions: ///////////////////////////////////////////
void createHeader();
Expand Down Expand Up @@ -676,7 +677,7 @@ class HumdrumInput : public vrv::Input {
template <class ELEMENT> KeySig *getKeySig(ELEMENT element);
template <class ELEMENT> MeterSig *getMeterSig(ELEMENT element);
template <class ELEMENT> Clef *getClef(ELEMENT element);
template <class ELEMENT> Mensur *getMensur(ELEMENT element);
template <class ELEMENT> Mensur *getMensur(ELEMENT element, hum::HTp token = NULL);
template <class ELEMENT>
void insertPhrase(ELEMENT phrase, hum::HTp phrasestart, hum::HTp phraseend, Measure *startmeasure,
std::vector<pair<int, int> > &endchordsorted, std::vector<std::pair<int, int> > &startchordsorted,
Expand All @@ -686,6 +687,8 @@ class HumdrumInput : public vrv::Input {
template <class ELEMENT> void convertVerses(ELEMENT element, hum::HTp token);
template <class ELEMENT>
void setTimeSig(ELEMENT element, hum::HTp timesigtok, hum::HTp metersigtok, int staffindex);
template <class ELEMENT> void addChildBackMeasureOrSection(ELEMENT element);
template <class ELEMENT> void addChildMeasureOrSection(ELEMENT element);

template <class CHILD>
void appendElement(const std::vector<std::string> &name, const std::vector<void *> &pointers, CHILD child);
Expand Down
Loading

5 comments on commit ae6b495

@craigsapp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit does:

(1) Move <staff> to <section> and remove <measure> for **mens-to-MEI conversions
(2) Allows for mensuraion sign to change in the middle of the music
(3) Add a temporarily allowance of <staff> on <section>, which can be changed to a more proper way of doing it later. In any case, the output MEI data from verovio says MEI-all, so in that case staff should be allowed as a child of section.

Test example:

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

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>

@lpugin
Copy link
Contributor

@lpugin lpugin commented on ae6b495 Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@craigsapp think you can solve this issue differently. Namely keep the Measure but mark it as 'unmeasured' with new Measure(false) see https://github.com/rism-ch/verovio/blob/256a6e2f41f0a0c3e1991c17d9baced7a3507322/src/iomei.cpp#L3102-L3106. (The Measure object will not be written in the MEI output)
The you can probably remove the change in Object::AddChild. Can you try it?

@craigsapp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can try it (probably tomorrow). Should there be one measure for such an example:

Screen Shot 2020-11-09 at 9 23 24 AM

Or would there be one measure starting at each mensuation/key change?

@lpugin
Copy link
Contributor

@lpugin lpugin commented on ae6b495 Nov 9, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or would there be one measure starting at each mensuation/key change?

Both should work. To get the same as you have now I think it should be one measure.

@craigsapp
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I think one measure is best since the goal will be to encode the system breaks (which will match the measures).

Please sign in to comment.