Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Grace note missing in time map #3909

Open
sonovice opened this issue Jan 7, 2025 · 6 comments
Open

Grace note missing in time map #3909

sonovice opened this issue Jan 7, 2025 · 6 comments

Comments

@sonovice
Copy link
Contributor

sonovice commented Jan 7, 2025

Describe the problem
I have a grace note in my MEI file that does not show up when using renderToTimemap(). However, it plays correctly when converting the file to MIDI.

To Reproduce
Steps to reproduce the behavior:

  1. Load the minimal example.
  2. Use .renderToTimemap() to get note on and offsets
  3. Output:
[
  {'on': ['nr87aw9'], 'qstamp': 0, 'tempo': 120, 'tstamp': 0},
  // <-- Entry for grace note is missing here -->
  {'off': ['nr87aw9'], 'on': ['n177hkun'], 'qstamp': 2, 'tstamp': 1000},
  {'off': ['n177hkun'], 'on': ['n9av3av'], 'qstamp': 2.5, 'tstamp': 1250},
  {'off': ['n9av3av'], 'on': ['n1gv1d4a'], 'qstamp': 3, 'tstamp': 1500},
  {'off': ['n1gv1d4a'], 'on': ['n139a590'], 'qstamp': 3.5, 'tstamp': 1750},
  {'off': ['n139a590'], 'qstamp': 4, 'tstamp': 2000}
]

Expected behavior
I would expect that the grace note (#n2006ph) gets the correct timing as is audible in the MIDI rendering.

Input data

MEI file
<?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"?><mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0">
   <meiHead xml:id="m1vpwwe7">
      <fileDesc xml:id="fo9nzun">
         <titleStmt xml:id="tra49u3">
            <title/>
         </titleStmt>
         <pubStmt xml:id="p1v6ck1m"/>
      </fileDesc>
   </meiHead>
   <music xml:id="mpxmhlp2">
      <body xml:id="bkh8mps1">
         <mdiv xml:id="m1iwcl6c">
            <score xml:id="s5lfztk">
               <scoreDef xml:id="s1g1wxrj">
                     <staffGrp xml:id="P1">
                        <instrDef xml:id="i1uawibq"/>
                        <staffDef xml:id="s9cce7u" lines="5" n="1">
                           <clef xml:id="ctlst9s" line="2" shape="G"/>
                           <keySig xml:id="k1mfz84x" mode="major" sig="1s"/>
                           <meterSig xml:id="mz0eeoa" count="4" sym="common" unit="4"/>
                        </staffDef>
                  </staffGrp>
               </scoreDef>
               <section xml:id="s1exouwe">
                  <pb xml:id="p18p8klt"/>
                  <measure xml:id="m15y4rxj" n="1">
                     <staff xml:id="s1wg5b4u" n="1">
                        <layer xml:id="lvinvvh" n="1">
                           <note xml:id="nr87aw9" dur="2" oct="4" pname="g"/>
                           <note xml:id="n2006ph" dur="8" oct="4" pname="b" grace="unacc"/>
                           <beam xml:id="bt03aq7">
                              <note xml:id="n177hkun" dur="8" oct="4" pname="a"/>
                              <note xml:id="n9av3av" dur="8" oct="4" pname="g"/>
                              <note xml:id="n1gv1d4a" dur="8" oct="4" pname="a"/>
                              <note xml:id="n139a590" dur="8" oct="4" pname="b"/>
                           </beam>
                        </layer>
                     </staff>
                  </measure>
               </section>
            </score>
         </mdiv>
      </body>
   </music>
</mei>

Verovio information

  • Version of Verovio: 4.5.1
  • Python bindings

Environment information (as appropriate)

  • OS: MacOS
@rettinghaus
Copy link
Contributor

I think this is by design.

@sonovice
Copy link
Contributor Author

sonovice commented Jan 7, 2025

Ah, that is surprising, thanks for the info! I will see if something like includeGraceNotes = true can be integrated easily.

EDIT: Grace notes were removed actively with PR #2843

@sonovice
Copy link
Contributor Author

sonovice commented Jan 7, 2025

What would be the preferred way to add an option @lpugin?

Right now there is the midiNoCue option. Grace notes, however, are handled somewhat inconsistent by including them in MIDI but excluding in the time map.

The other option would be a JSON option like { "includeGraceNotes": true } to the renderToTimemap function.

@lpugin
Copy link
Contributor

lpugin commented Jan 8, 2025

It would make sense for it to be inline with the MIDI output. It seems to me that the time map should correspond to them. So if midiNoCue is not set, then the time map should include them.

@sonovice
Copy link
Contributor Author

sonovice commented Jan 8, 2025

I was wondering if midiNoCue should have any influence on grace notes, given that they aren't necessarily cue notes?

It would also be great if the timing information for grace notes could be made accessible. Unfortunately, I’m having a bit of trouble understanding the relevant section in the MIDI Functor Code, and GetMIDIValuesForElement doesn’t seem to return any meaningful values for this case.

@lpugin
Copy link
Contributor

lpugin commented Jan 9, 2025

Yes, you are right. midiNoCue is something different.

The implementation of the grace notes in the MIDI functor needs to be revised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants