Audiveris / audiveris

Latest generation of Audiveris OMR engine
https://audiveris.github.io/audiveris
GNU Affero General Public License v3.0
1.47k stars 218 forks source link

Tempo is read and seems to be recognized but is never exported #738

Open PrimePhil opened 3 weeks ago

PrimePhil commented 3 weeks ago

I'm currently using Audiveris for a small project to generate mxl files from pdf partitions, and then converting these mxl files into MIDI files through the music21 library. I was using the batch command in order to do so, and I thought it might be the conversion from mxl to midi that didn't work, but it seems the tempo is just not exported with the mxl file. I have for example a partition that says ♪ = 70, and it shows on the mxl partition as written text, but if I open the file on musescore, that new text is there, with ♪ = 120 on top of it, so the default. It does the same directly in the UI version of the applicaiton. And same thing with tempos defined by italian names (Allegro, andante, adagie, etc.).

So I was wondering if there's something I should be doing to make sure the tempo is carried over, or if Audiveris just doesn't support that part well yet.

I've attached the partition I'm using for this example. Experience.pdf

PrimePhil commented 3 weeks ago

I also opened the mxl and midi files in REAPER to make sure it wasn't Musescore, and same problem there

PrimePhil commented 3 weeks ago

Here's what it gives me once analysed translatedMxl

hbitteur commented 3 weeks ago

[Message updated to cope with < and > characters] [Also updated to replace beats per minute by quarters per minute]

Tempo in printed sheet music is usually specified by something like: <quarter> = nqm Where <quarter> is a quarter symbol and "nqm" is the number of quarters per minute.

The problem is that current Audiveris is not able to recognize the isolated quarter symbol, so it does not recognize this phrase as a tempo instruction. It simply "reads" it as a simple phrase, like "J = decimal value" (the quarter symbol is often mistaken by Tesseract OCR for a capital letter J). That's it.

Audiveris can recognize quarters (actually filled heads and stems) by pattern matching when they are located on or near a staff line or ledger line. Not when they are floating in the air, far from the staff/ledger lines.

A real solution might be to train Tesseract to recognize the quarter symbol as a character. I don't know enough about Tesseract to do this. Could someone help us with this?

hbitteur commented 3 weeks ago

I just thought of a "trick".

We could modify the engine so that it detects a phrase that:

  1. matches the pattern "J = number";
  2. is located at the top left of the first staff on the page.

If so, it could deduce that the phrase is a tempo indication and treat it as such.

No 100% guarantee of course. And it would not address the less frequent cases where the quarter note is replaced by something different (a dotted quarter note, a half note, ...) What do you think? Is this trick worth it?

hbitteur commented 3 weeks ago

I just pushed commit 82ef3255ad7844f62306281e8125609aa120758a on the "development" branch. It implements the "trick" posted above. Please pull and try.

PrimePhil commented 3 weeks ago

The trick could work with anytime it sees "J =" yeah. It's probably another story with tempos defined with keywords, I'll try it out during the week and come back to you, thanks!