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
680 stars 185 forks source link

MIDI tempo in mensural music #3520

Closed craigsapp closed 1 year ago

craigsapp commented 1 year ago

Possibly related to issue https://github.com/rism-digital/verovio/issues/3457 (but otherwise very similar), scoreDef@midi.bpm is not being stored properly when generating a MIDI file from mensural music.

Here is an example:

Screenshot 2023-09-27 at 09 05 23
Click to view MEI data for above example ```xml </titleStmt> <pubStmt /> </fileDesc> <encodingDesc> <appInfo> <application isodate="2023-09-27T09:08:40" version="4.1.0-dev-ae55136-dirty"> <name>Verovio</name> <p>Transcoded from Humdrum</p> </application> </appInfo> </encodingDesc> <workList> <work> <title xml:id="title-L50" analog="humdrum:Xfi" type="translated">kern2mens S T C
```

Music in the red box is internally placed into a <measure> (to allow line breaks). In this virtual measure, the tempo of the music is correct. For the example @midi.bpm="200" is being used.

However, the duration of the entire measure is calculated using @midi.bpm="60", so there is a pause at the end of the red box. Then the following music is played in @midi.bpm="60" rather than @midi.bpm="200".


There is another issue with this example: When I load the above MEI example into VHV, the playback of the notes is not aligned at all, and it seems that rests are being given longer durations than specified. When converting internally from **mens into MEI mensural, I am hearing the music aligned properly, but with the tempo problem described above.

I presume that this is related to the --mensural-to-measure option which I probably am applying internally when converting from **mens to MEI, but not with a direct loading of the mensural MEI data in VHV (I will fix that). So it would also be useful for MIDI playback to work when --mensural-to-measure is not used. I will always be using the --mensural-to-measure option so fixing MIDI playback when this is not given is a lower priority.

Here is the source **mens data that generated the above MEI data:

!!!verovio: evenNoteSpacing
**mens  **mens  **mens
*staff3 *staff2 *staff1
*Ivox   *Ivox   *Ivox
*I"Contra   *I"Tenor    *I"Superius
*I'C    *I'T    *I'S
*mclefGv2   *mclefGv2   *mclefG2
*clefF3 *clefC4 *clefC1
*k[]    *k[]    *k[]
*C: *C: *C:
*M2/1   *M2/1   *M2/1
*met(C|)    *met(C|)    *met(C|)
=1- =1- =1-
miC Sir Sir
miD .   .
miE .   .
miF .   .
MiG .   .
Mpp:A   .   .
.   Sir Sir
miG .   .
sic .   .
MiB .   .
=3- =3- =3-
sic miC Sir
.   miD .
.   miE .
.   miF .
Mir MiG .
siF Mpp:A   .
.   .   Sir
.   miG .
MiE sic .
siD .   .
.   MiB .
=5- =5- =5-
Mpp:C   Spp:c   mic
.   .   mid
.   .   mie
miD .   mif
MiE .   Mig
Mpp:F   .   Mpp:a
.   .   .
miE .   mig
MiA .   sicc
siG sid .
.   .   Mib
=7- =7- =7-
*-  *-  *-
lpugin commented 1 year ago

@craigsapp I think it should be fixed. The voices are now properly aligned, and having barlines yielding internal virtual measures does not seem to cause any problems. Please double check.

craigsapp commented 1 year ago

Thanks! Both the --mensural-to-measure and unmeasured mensural music are generating correct MIDI timings now.