humdrum-tools / verovio-humdrum-viewer

Verovio Humdrum Viewer
http://verovio.humdrum.org
37 stars 9 forks source link

Make meterSig@units positive #865

Closed craigsapp closed 10 months ago

craigsapp commented 10 months ago

When converting from Humdrum to MEI, *met(3) in a time signature change will cause meterSig@units to be negative (formerly used to suppress bottom number in time signatures). Make this value always positive; otherwise, MIDI conversion gets stuck.

Example:

**kern
*clefF4
*M2/1
*met(C)
=1
0D
=2||
*M3/1
*met(3)
0.C
=3
*-
Click to view MEI conversion of above example ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2023-11-15T08:17:25" version="4.1.0-dev-b617f3e"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="m4skash"> <score xml:id="s12r96s6"> <scoreDef xml:id="svue1qc" midi.bpm="400.000000"> <staffGrp xml:id="s1ae3z0f"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="clef-L2F1" shape="G" line="2" /> <meterSig xml:id="metersig-L3F1" count="2" unit="1" visible="false" /> <mensur xml:id="mensur-L4F1" sign="C" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1" right="dbl" n="1"> <staff xml:id="staff-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L6F1" dur="breve" oct="3" pname="d" accid.ges="n" /> </layer> </staff> </measure> <scoreDef xml:id="szgtgo"> <meterSig xml:id="m1mnsv47" count="3" unit="-1" form="num" /> </scoreDef> <measure xml:id="measure-L7" n="2"> <staff xml:id="staff-L7F1N1" n="1"> <layer xml:id="layer-L7F1N1" n="1"> <note xml:id="note-L10F1" dots="1" dur="breve" oct="3" pname="c" accid.ges="n" /> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <p>Problem line:</p> <pre><code class="language-xml"> <meterSig xml:id="m1mnsv47" count="3" unit="-1" form="num" /></code></pre> <p>Where <code>@units</code> is <code>-1</code> but should be <code>1</code>.</p> <p>The problem does not occur at the start of a score (there are two functions for adding time signatures: one for the initial time signature and one for time signature changes. Example:</p> <pre><code class="language-tsv">**kern *clefF4 *M3/1 *met(3) =1 0.D =2|| *M2/1 *met(C) 0C =3 *-</code></pre> <details> <summary> Click to view MEI data for above example </summary> ```xml <?xml version="1.0" encoding="UTF-8"?> <?xml-model href="https://music-encoding.org/schema/5.0/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?> <?xml-model href="https://music-encoding.org/schema/5.0/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?> <mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0"> <meiHead> <fileDesc> <titleStmt> <title /> </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2023-11-15T08:19:23" version="4.1.0-dev-b617f3e"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="m10jvymb"> <score xml:id="sqyx83i"> <scoreDef xml:id="s13muifx" midi.bpm="400.000000"> <staffGrp xml:id="s2m7xt8"> <staffDef xml:id="staffdef-L1F1" n="1" lines="5"> <clef xml:id="clef-L2F1" shape="F" line="4" /> <meterSig xml:id="metersig-L3F1" count="3" unit="1" form="num" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1" right="dbl" n="1"> <staff xml:id="staff-L1F1" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L6F1" dots="1" dur="breve" oct="3" pname="d" accid.ges="n" /> </layer> </staff> </measure> <scoreDef xml:id="sm6cb1e"> <meterSig xml:id="m1qk7ilo" count="2" unit="1" visible="false" /> <mensur xml:id="mensur-L9F1" sign="C" /> </scoreDef> <measure xml:id="measure-L7" n="2"> <staff xml:id="staff-L7F1N1" n="1"> <layer xml:id="layer-L7F1N1" n="1"> <note xml:id="note-L10F1" dur="breve" oct="3" pname="c" accid.ges="n" /> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>