rism-digital / verovio

🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)
https://www.verovio.org
GNU Lesser General Public License v3.0
683 stars 185 forks source link

Problem to render SVG with Expansion #3314

Closed faelwar closed 1 year ago

faelwar commented 1 year ago

Describe the problem I'm trying to load a MEI file that contains a expansion and the lib throw an exception.

To Reproduce Steps to reproduce the behavior:

  1. I'm using the following html to load the MEI file
<html>

<head>
    <script src="http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js" defer></script>
    <script>
        document.addEventListener("DOMContentLoaded", (event) => {
            verovio.module.onRuntimeInitialized = async _ => {
                let zoom = 80;
                let pageWidth = document.body.clientWidth * 100 / zoom;
                let tk = new verovio.toolkit();
                tk.setOptions({
                    pageWidth: pageWidth,
                    expand: "expansion"
                });
                console.log("Verovio has loaded!");

                fetch("exercise1.mei")
                    .then((response) => response.text())
                    .then((meiXML) => {
                        let svg = tk.renderData(meiXML, {});
                        document.getElementById("notation").innerHTML = svg;
                    });
            }
        });
    </script>
</head>

<body>
    <div id="notation"></div>
</body>

</html>

The MEI file is the following:

<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/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.0-dev">
   <meiHead>
      <fileDesc>
         <titleStmt>
            <title>Exercise I</title>
            <respStmt>
               <persName role="composer">Buddy Rich</persName>
            </respStmt>
         </titleStmt>
         <pubStmt>
            <date isodate="2023-03-01" type="encoding-date">2023-03-01</date>
         </pubStmt>
      </fileDesc>
      <encodingDesc xml:id="encodingdesc-dgcl04">
         <appInfo xml:id="appinfo-1th1psc">
            <application xml:id="application-wgoi90" isodate="2023-03-01T20:09:52" version="3.14.0">
               <name xml:id="name-1shom9j">Verovio</name>
               <p xml:id="p-f90u2b">Transcoded from MusicXML</p>
            </application>
         </appInfo>
      </encodingDesc>
   </meiHead>
   <music>
      <body>
         <mdiv xml:id="m155hsac">
            <score xml:id="s136tp1p">
               <scoreDef xml:id="s1dimbo9" midi.bpm="120.000000">
                  <staffGrp xml:id="s1nyc5se">
                     <staffDef xml:id="P1" n="1" lines="1" ppq="4">
                        <clef xml:id="cmrf4pa" shape="perc" />
                        <keySig xml:id="k1q2ik6r" mode="major" sig="0" />
                        <meterSig xml:id="m1cq0vlc" count="4" unit="4" />
                     </staffDef>
                  </staffGrp>
               </scoreDef>
               <section xml:id="s1qxw1gq">
                  <expansion plist="#exer1 #exer1" xml:id="expansion" />
                  <section xml:id="exer1">
                     <measure xml:id="mpzgn23" left="rptstart" n="1">
                        <staff xml:id="s1hrtinn" n="1">
                           <layer xml:id="l4i6rno" n="1">
                              <note xml:id="np8l4tn" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="n1wjcnq5" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="nayfsgp" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="n1xrcptf" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                           </layer>
                        </staff>
                     </measure>
                     <measure xml:id="m1mwzdth" n="2">
                        <staff xml:id="syb1uhm" n="1">
                           <layer xml:id="lceu3i1" n="1">
                              <note xml:id="ntfi1gk" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="n1r99xxe" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="n1pid1tc" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="n15o9slt" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                           </layer>
                        </staff>
                     </measure>
                     <measure xml:id="my16y0s" n="3">
                        <staff xml:id="s197l0xp" n="1">
                           <layer xml:id="l13ag3b6" n="1">
                              <note xml:id="n4qhv5a" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="nug6hlh" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="neeoyq9" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="njs9xlq" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                           </layer>
                        </staff>
                     </measure>
                     <measure xml:id="m1dyaqm1" right="rptend" n="4">
                        <staff xml:id="su1sfkb" n="1">
                           <layer xml:id="l2vx0o3" n="1">
                              <note xml:id="n6xlpmj" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="nqxumcf" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="n1wwzece" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                              <note xml:id="navo59a" dur.ppq="4" dur="4" oct="4" pname="e"
                                 stem.dir="up" />
                           </layer>
                        </staff>
                     </measure>
                  </section>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>
  1. When I open the file I get the following error:
    Uncaught (in promise) RuntimeError: Aborted(). Build with -sASSERTIONS for more info.
    abort http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    _abort http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    _vrvToolkit_renderData http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    ccall http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    cwrap http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    get http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:21
    renderData http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:297
    onRuntimeInitialized http://localhost/teste/index.html:20
    promise callback*verovio.module.onRuntimeInitialized http://localhost/teste/index.html:19
    doRun http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    run http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    runCaller http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    removeRunDependency http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    receiveInstance http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    receiveInstantiationResult http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    promise callback*instantiateArrayBuffer http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    instantiateAsync http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    createWasm http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    <anonymous> http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:10
    <anonymous> http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:13
    <anonymous> http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:4
    <anonymous> http://www.verovio.org/javascript/latest/verovio-toolkit-wasm.js:5
    verovio-toolkit-wasm.js:10:7777

Expected behavior I believe it should the file as it does when the expand: "expansion" is commented

Input data See Above

Verovio information

Environment information (as appropriate)

faelwar commented 1 year ago

thanks for the fix @lpugin