rettinghaus / MEILER

MEI Lilypond Engraving Refinement
MIT License
20 stars 7 forks source link

figured bass leads to invalid lilypond output #30

Closed pfefferniels closed 2 years ago

pfefferniels commented 2 years ago

this test file with figured bass …

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.1/mei-CMN.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.1">
  <meiHead>
    <fileDesc>
      <titleStmt>
        <title>Der Ober-Classe erstes Prob-Stück.</title>
      </titleStmt>
      <pubStmt>
        <date>2019</date>
      </pubStmt>
    </fileDesc>
  </meiHead>
  <music>
    <body>
      <mdiv>
        <score>
          <scoreDef key.pname="d" key.mode="minor" midi.bpm="80">
            <staffGrp>
              <staffDef clef.shape="F" clef.line="4" n="2" lines="5">
                <keySig sig="1f" />
                <meterSig count="4" unit="4" sym="common" />
              </staffDef>
            </staffGrp>
          </scoreDef>
          <section>
            <measure xml:id="m-35" label="1" n="1">
              <staff xml:id="m-40" n="2">
                <layer n="1">
                  <beam>
                    <note xml:id="m-42" dur="16" oct="3" pname="d" />
                    <note xml:id="m-44" dur="16" oct="4" pname="d" />
                    <note xml:id="m-45" dur="32" oct="4" pname="c">
                      <accid accid="s" />
                    </note>
                    <note xml:id="m-47" dur="32" oct="4" pname="d" />
                    <note xml:id="m-48" dur="16" oct="4" pname="e" />
                  </beam>
                  <beam>
                    <note xml:id="m-49" dur="16" oct="4" pname="f" />
                    <note xml:id="m-51" dur="16" oct="4" pname="d" />
                    <note xml:id="m-52" dur="16" oct="3" pname="a" />
                    <note xml:id="m-53" dur="16" oct="3" pname="g" />
                  </beam>
                  <beam>
                    <note xml:id="m-54" dur="32" oct="3" pname="f" />
                    <note xml:id="m-56" dur="32" oct="3" pname="g" />
                    <note xml:id="m-57" dur="16" oct="3" pname="a" />
                    <note xml:id="m-58" dur="32" oct="3" pname="f" />
                    <note xml:id="m-59" dur="32" oct="3" pname="g" />
                    <note xml:id="m-60" dur="16" oct="3" pname="a" />
                  </beam>
                  <beam>
                    <note xml:id="m-61" dur="16" oct="3" pname="d" />
                    <note xml:id="m-63" dur="16" oct="2" pname="a" />
                    <note xml:id="m-64" dur="16" oct="2" pname="f" />
                    <note xml:id="m-65" dur="16" oct="2" pname="d" />
                  </beam>
                </layer>
              </staff>
              <harm place="above" staff="2" startid="#m-45">
                <fb>
                  <f>6</f>
                </fb>
              </harm>
              <harm place="above" staff="2" startid="#m-49">
                <fb>
                  <f>6</f>
                </fb>
              </harm>
              <harm place="above" staff="2" startid="#m-52">
                <fb>
                  <f>♯</f>
                </fb>
              </harm>
              <harm place="above" staff="2" startid="#m-54">
                <fb>
                  <f>6</f>
                </fb>
              </harm>
            </measure>
          </section>
        </score>
      </mdiv>
    </body>
  </music>
</mei>

… leads to an invalid Lilypond, where all <fb>s that are supposed to be transformed only inside the \figuremode are also part of the note input mode, which looks like this:

<< { d16-[ d'16 6cis'!32\bassFigureStaffAlignmentUp <6>4  d'32 e'16] …

instead of

<< { d16-[ d'16 cis'!32  d'32 e'16]
rettinghaus commented 2 years ago

fixed with aca3b124e674ef431a1bc834f9d5261fc3567017: fb preview

Thanks for reporting! Please test.

pfefferniels commented 2 years ago

This looks great, thanks! However, some figures seem to be misplaced: the first 6 is supposed to be on the c#, the # on the a (an 8th note earlier) and the last sixth one quarter note earlier …

rettinghaus commented 2 years ago

This is because @startid is not supported for harm, see supported.md. If you use @tstamp it works: fb preview

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/4.0.1/mei-CMN.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="4.0.1">
  <meiHead>
    <fileDesc>
      <titleStmt>
        <title>Der Ober-Classe erstes Prob-Stück.</title>
      </titleStmt>
      <pubStmt>
        <date>2019</date>
      </pubStmt>
    </fileDesc>
  </meiHead>
  <music>
    <body>
      <mdiv>
        <score>
          <scoreDef key.pname="d" key.mode="minor" midi.bpm="80">
            <staffGrp>
              <staffDef clef.shape="F" clef.line="4" n="2" lines="5">
                <keySig sig="1f" />
                <meterSig count="4" unit="4" sym="common" />
              </staffDef>
            </staffGrp>
          </scoreDef>
          <section>
            <measure xml:id="m-35" label="1" n="1">
              <staff xml:id="m-40" n="2">
                <layer n="1">
                  <beam>
                    <note xml:id="m-42" dur="16" oct="3" pname="d" />
                    <note xml:id="m-44" dur="16" oct="4" pname="d" />
                    <note xml:id="m-45" dur="32" oct="4" pname="c">
                      <accid accid="s" />
                    </note>
                    <note xml:id="m-47" dur="32" oct="4" pname="d" />
                    <note xml:id="m-48" dur="16" oct="4" pname="e" />
                  </beam>
                  <beam>
                    <note xml:id="m-49" dur="16" oct="4" pname="f" />
                    <note xml:id="m-51" dur="16" oct="4" pname="d" />
                    <note xml:id="m-52" dur="16" oct="3" pname="a" />
                    <note xml:id="m-53" dur="16" oct="3" pname="g" />
                  </beam>
                  <beam>
                    <note xml:id="m-54" dur="32" oct="3" pname="f" />
                    <note xml:id="m-56" dur="32" oct="3" pname="g" />
                    <note xml:id="m-57" dur="16" oct="3" pname="a" />
                    <note xml:id="m-58" dur="32" oct="3" pname="f" />
                    <note xml:id="m-59" dur="32" oct="3" pname="g" />
                    <note xml:id="m-60" dur="16" oct="3" pname="a" />
                  </beam>
                  <beam>
                    <note xml:id="m-61" dur="16" oct="3" pname="d" />
                    <note xml:id="m-63" dur="16" oct="2" pname="a" />
                    <note xml:id="m-64" dur="16" oct="2" pname="f" />
                    <note xml:id="m-65" dur="16" oct="2" pname="d" />
                  </beam>
                </layer>
              </staff>
              <harm place="above" staff="2" startid="#m-45" tstamp="1.5">
                <fb>
                  <f>6</f>
                </fb>
              </harm>
              <harm place="above" staff="2" startid="#m-49" tstamp="2.0">
                <fb>
                  <f>6</f>
                </fb>
              </harm>
              <harm place="above" staff="2" startid="#m-52" tstamp="2.5">
                <fb>
                  <f>♯</f>
                </fb>
              </harm>
              <harm place="above" staff="2" startid="#m-54" tstamp="3.0">
                <fb>
                  <f>6</f>
                </fb>
              </harm>
            </measure>
          </section>
        </score>
      </mdiv>
    </body>
  </music>
</mei>