MeasuringPolyphony / mp_editor

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

Music input broken #71

Closed karend27 closed 3 years ago

karend27 commented 4 years ago

When I go to the music input screen I get to the point of drawing a box around a staff and can type "c" for the clef, but when I try to enter numbers and letters to enter the pitches nothing happens. I've attached the log file. @martha-thomae has said that it seems to only happen with larger note values - breves, longs, maximas - and that smaller note values are fine. Any ideas @craigsapp or @lpugin ? Thanks!!! editor.measuringpolyphony.org-1600956041242.log

craigsapp commented 3 years ago

This is the source of the error:

diva-view.component.ts:216 Error: <svg> attribute viewBox: Expected number, "0 0 undefined undefi…". refreshOverlay @ diva-view.component.ts:216

Notice that the viewbox for the <svg> image is "0 0 undefined undefined". Where and how this is happening is not obvious.

craigsapp commented 3 years ago

The cause of the error is related to adding Sc in the following **mens score:

Screen Shot 2020-10-20 at 3 08 38 PM

The sB displays correctly (semibreve in B3), but when Sc is added (breve on C4), some divide-by-zero errors are occurring.

craigsapp commented 3 years ago

The problem is in verovio, @lpugin, and it seems to be related to a missing glyph based on the location of the error.

Starting with this test Humdrum file:

**mens
*clefC3
sB
*-

I can convert it successfully to MEI with the command-line:

verovio -atmei file.krn

Producing the MEI data:

<?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-10-21T23:07:31" version="3.1.0-dev-98c9147-dirty">
               <name>Verovio</name>
               <p>Transcoded from Humdrum</p>
            </application>
         </appInfo>
      </encodingDesc>
      <workList>
         <work>
            <title />
         </work>
      </workList>
   </meiHead>
   <music>
      <body>
         <mdiv xml:id="mdiv-0000000903598646">
            <score xml:id="score-0000001925575385">
               <scoreDef xml:id="scoredef-0000001568086090" midi.bpm="400">
                  <staffGrp xml:id="staffgrp-0000001173877394">
                     <staffDef xml:id="staffdef-0000000098410096" n="1" notationtype="mensural.white" lines="5">
                        <clef xml:id="clef-L2F1" shape="C" line="3" />
                     </staffDef>
                  </staffGrp>
               </scoreDef>
               <section xml:id="section-L1F1">
                  <staff xml:id="staff-0000000425095969" n="1">
                     <layer xml:id="layer-L1F1N1" n="1">
                        <note xml:id="note-L3F1" dur="semibrevis" oct="3" pname="b" />
                     </layer>
                  </staff>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>

This loads and displays in VHV as well as in the Verovio editor (which I am using to make sure it is not a problem in VHV or in my compiled version of the javascript verovio toolkit):

Screen Shot 2020-10-21 at 11 14 57 PM

Now on line 40 of the MEI data, change the @dur="semibrevis" to @dur="brevis". This will cause the divide by 0 error:

Screen Shot 2020-10-21 at 11 15 28 PM

Here is the test data using brevis:

<?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-10-21T23:07:31" version="3.1.0-dev-98c9147-dirty">
               <name>Verovio</name>
               <p>Transcoded from Humdrum</p>
            </application>
         </appInfo>
      </encodingDesc>
      <workList>
         <work>
            <title />
         </work>
      </workList>
   </meiHead>
   <music>
      <body>
         <mdiv xml:id="mdiv-0000000903598646">
            <score xml:id="score-0000001925575385">
               <scoreDef xml:id="scoredef-0000001568086090" midi.bpm="400">
                  <staffGrp xml:id="staffgrp-0000001173877394">
                     <staffDef xml:id="staffdef-0000000098410096" n="1" notationtype="mensural.white" lines="5">
                        <clef xml:id="clef-L2F1" shape="C" line="3" />
                     </staffDef>
                  </staffGrp>
               </scoreDef>
               <section xml:id="section-L1F1">
                  <staff xml:id="staff-0000000425095969" n="1">
                     <layer xml:id="layer-L1F1N1" n="1">
                        <note xml:id="note-L3F1" dur="brevis" oct="3" pname="b" />
                     </layer>
                  </staff>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>

Here is the function stack at the time of the crash:

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
vrv::Glyph::GetBoundingBox(int&, int&, int&, int&) + 4 (glyph.cpp:101)
vrv::Doc::GetGlyphWidth(wchar_t, int, bool) const + 58 (doc.cpp:1356)
vrv::LayerElement::GetDrawingRadius(vrv::Doc*, bool) + 457
vrv::View::DrawMensuralNote(vrv::DeviceContext*, vrv::LayerElement*, vrv::Layer*, vrv::Staff*, vrv::Measure*) + 93
vrv::View::DrawDurationElement(vrv::DeviceContext*, vrv::LayerElement*, vrv::Layer*, vrv::Staff*, vrv::Measure*) + 406
vrv::View::DrawLayerElement(vrv::DeviceContext*, vrv::LayerElement*, vrv::Layer*, vrv::Staff*, vrv::Measure*) + 546
vrv::View::DrawLayerChildren(vrv::DeviceContext*, vrv::Object*, vrv::Layer*, vrv::Staff*, vrv::Measure*) + 114 (view_page.cpp:1447)
vrv::View::DrawLayer(vrv::DeviceContext*, vrv::Layer*, vrv::Staff*, vrv::Measure*) + 165 (view_page.cpp:1268)
vrv::View::DrawStaffChildren(vrv::DeviceContext*, vrv::Object*, vrv::Staff*, vrv::Measure*) + 119 (view_page.cpp:1424)
vrv::View::DrawStaff(vrv::DeviceContext*, vrv::Staff*, vrv::Measure*, vrv::System*) + 434
vrv::View::DrawMeasureChildren(vrv::DeviceContext*, vrv::Object*, vrv::Measure*, vrv::System*) + 119 (view_page.cpp:1397)
vrv::View::DrawMeasure(vrv::DeviceContext*, vrv::Measure*, vrv::System*) + 329 (view_page.cpp:928)
vrv::View::DrawSystemChildren(vrv::DeviceContext*, vrv::Object*, vrv::System*) + 265 (view_page.cpp:1364)
vrv::View::DrawSystem(vrv::DeviceContext*, vrv::System*) + 346 (view_page.cpp:171)
vrv::View::DrawCurrentPage(vrv::DeviceContext*, bool) + 254 (view_page.cpp:91)
vrv::Page::LayOutHorizontally() + 1476
vrv::Doc::ConvertToCastOffMensuralDoc() + 315
vrv::Toolkit::LoadData(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 4507 (toolkit.cpp:625)
vrv::Toolkit::LoadFile(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 447
main + 5583 (main.cpp:426)

This error leading to GetBoundingBox in glyph.cpp usually indicates a missing font glyph. Since this is happening on both the command-line, VHV, and the Verovio Editor, the problem is not a font installation issue, but is instead likely to be a missing glyph for the brevis in the develop branch.

But maybe not: the above example uses white mensural fonts. When I change to black mensural fonts, the same divide by 0 occurs. Here is the black mensuration notation test file:

Click to view black mensuration notation example data ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2020-10-21T23:26:20" version="3.1.0-dev-98c9147-dirty"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="mdiv-0000001964908769"> <score xml:id="score-0000000218157017"> <scoreDef xml:id="scoredef-0000001172946826" midi.bpm="400"> <staffGrp xml:id="staffgrp-0000001242409579"> <staffDef xml:id="staffdef-0000001039577756" n="1" notationtype="mensural.black" lines="5"> <clef xml:id="clef-L3F1" shape="C" line="3" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <staff xml:id="staff-0000001194294472" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L4F1" dur="brevis" oct="3" pname="b" /> </layer> </staff> </section> </score> </mdiv> </body> </music> </mei> ``` </details> <p>And strangely, when displaying the breve in CMN, there is no crash:</p> <img width="439" alt="Screen Shot 2020-10-21 at 11 29 32 PM" src="https://user-images.githubusercontent.com/3487289/96833438-4aeea080-13f5-11eb-8e20-7506785a37cf.png"> <details> <summary> Click to view the CMN breve example data </summary> ```xml <?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-10-21T23:30:11" version="3.1.0-dev-98c9147-dirty"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title /> </work> </workList> </meiHead> <music> <body> <mdiv xml:id="mdiv-0000002113583018"> <score xml:id="score-0000001462778499"> <scoreDef xml:id="scoredef-0000001061665242" midi.bpm="400"> <staffGrp xml:id="staffgrp-0000001212683105"> <staffDef xml:id="staffdef-0000000648197995" n="1" lines="5"> <clef xml:id="clef-L2F1" shape="G" line="2" /> </staffDef> </staffGrp> </scoreDef> <section xml:id="section-L1F1"> <measure xml:id="measure-L1" right="invis"> <staff xml:id="staff-0000000581892344" n="1"> <layer xml:id="layer-L1F1N1" n="1"> <note xml:id="note-L3F1" dur="breve" oct="4" pname="c" accid.ges="n" /> </layer> </staff> </measure> </section> </score> </mdiv> </body> </music> </mei> ``` </details> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/lpugin"><img src="https://avatars.githubusercontent.com/u/689412?v=4" />lpugin</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>@karend27 I think I found it and tried to fix it. @craigsapp do you know if the editor uses that latest develop or the latest release?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/craigsapp"><img src="https://avatars.githubusercontent.com/u/3487289?v=4" />craigsapp</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>It is using my humdrum-enabled verovio toolkit that I compile for VHV, which I can recompile if you want me to test the fix.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/lpugin"><img src="https://avatars.githubusercontent.com/u/689412?v=4" />lpugin</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>OK, yes, give a try.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/craigsapp"><img src="https://avatars.githubusercontent.com/u/3487289?v=4" />craigsapp</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>compiling now...</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/craigsapp"><img src="https://avatars.githubusercontent.com/u/3487289?v=4" />craigsapp</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>Yes, it is working on the command line:</p> <img width="347" alt="Screen Shot 2020-10-22 at 1 16 33 AM" src="https://user-images.githubusercontent.com/3487289/96844351-4382c380-1404-11eb-8b39-f9f85a9afa2b.png"> <img width="332" alt="Screen Shot 2020-10-22 at 1 17 27 AM" src="https://user-images.githubusercontent.com/3487289/96844489-68773680-1404-11eb-928b-c61f08dfdbe5.png"> <p>So I will compile the javascript version.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/craigsapp"><img src="https://avatars.githubusercontent.com/u/3487289?v=4" />craigsapp</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>The new version is now online, so it is likely the problem is now fixed:</p> <img width="951" alt="Screen Shot 2020-10-22 at 1 22 48 AM" src="https://user-images.githubusercontent.com/3487289/96845084-27335680-1405-11eb-8f3b-d2c92d62b30d.png"> <img width="951" alt="Screen Shot 2020-10-22 at 1 23 48 AM" src="https://user-images.githubusercontent.com/3487289/96845167-3fa37100-1405-11eb-9174-37f57f948a6a.png"> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/martha-thomae"><img src="https://avatars.githubusercontent.com/u/13948831?v=4" />martha-thomae</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>It seems fixed. Thank you, @lpugin and @craigsapp! :) </p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/karend27"><img src="https://avatars.githubusercontent.com/u/11195203?v=4" />karend27</a> commented <strong> 3 years ago</strong> </div> <div class="markdown-body"> <p>Excellent - sorry for being so slow to see this fix! Thanks @lpugin and @craigsapp! I really appreciate it!!</p> </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>