Midi File Exports, Repeats, measure number on the score
I think this may be as much about midi representation as Musescore, but I hope someone can get me on the right track.
I am using Musescore and an OMR program to convert old sheet music (that I own) to a more readable score. At the same time, I have a player piano and am exporting Midi and have a little Midi player program that runs there on a touch screen powered by a Raspberry Pi. The Pi is too slow for Musescore itself (I tried, it will run, but it cannot play at full speed even moderately complex pieces), so I wrote a midi player.
The Midi player counts measures and shows the current bar number, which aligns with the displayed Musescore-exported PDF. The user can enter any measure to start playing. Perfect. Handy for my wife, she can hear the timing on a piece she is learning (the midi player will play at any tempo so she can slow it down).
The issue is on repeats. Let's say you played 4 bars, repeated, skipped the 4th and played the fifth. From a Musescore perspective that 5th measure is number 5, but inside the midi file it is number 8. As best I can tell there is no indication in the midi file that you are repeating, it just "plays" the repeat out the midi. In fact in looking at the midi standards I see no provision for indicating any kind of measure count or repeat or even indicating a repeat was done.
What I am doing now is going through and manually numbering measures, so I will show as text (in the example above) the first measure as "1/5" to indicate it is measure 1 the first time, and 5 the second. That works, but is really tedious. Since I try showing it only once on each system, it also gets screwed up with any reformatting and migrates to the middle of the page and has to be redone.
So here's my question: Am I missing anything? Is there any way in a midi file to tell what bar you are actually playing (the way Musescore numbers it)?
Or conversely, is there any way (plugin?) to tell Musescore to number measures honoring the repeats in some fashion?
I've searched and read and cannot even find discussion of this, so I think I am either using the wrong terms, or am out on a niche area... so thanks in advance for anyone who might have advice.