Is it possible to export midi to .png files and have the .png files named by start-time

• Dec 28, 2024 - 20:13

I'm using Musecore to export a midi file as sheet music (stored as .png files) for display on a small screen.

I've set the sheet size to A8 landscape with 0.14" margins on all sides.

When I export to .png files, all the .png files are listed sequentially (ex: beethovens_5th.midi gets exported as beethovens_5th_1.png, beethovens_5th_2.png,...)

As an alternative, I want to export the .png files so that they are named by time (ex: beethovens_5th_1.png would instead be displayed as beethovens_5th_0ms, beethovens_5th_2.png would be displayed as beethovens_5th_7430ms.png because it starts 7.43 seconds into the song, beethovens_5th_3.png would be named beethovens_5th_16003ms.png because the 3rd sheet would start 16.003 seconds into the song.)

Does anybody have an idea on how to do this?

Thanks
P.S: If anyone can recommend a better forum to post this in, please let me know

M.C


Comments

When you rename, you may need to set the milliseconds value to the same number of digits for each file, so that they sort in chronological order. You don't really need the "ms" part of the filename especially if you use decimals for the seconds, e.g. beethovens_5th_0016.003.png.

You may be able to automate this using a plugin in MS3:
1) Save each page as a mscz file with sequential number
2) Loop thru each saved page and save as .png noting that the length of music is available as a score property so can be used in the filename generation.

In reply to by yonah_ag

Honestly, I do not know how to read sheet music, and am just messing with midi files as a programming project. I was researching and only recently learned that the combination of time signature & tempo define the number of seconds represented by a bar/measure.

Now that I know how bars/measures represent time I can use sequential numbers without issue and can iroll my own "flip to the next page" algorithm. Ex: assuming the bpm and time signature is 120 bpm and 4/4 then each measure is 2 seconds of time. At 7 seconds we would be using the 4th measure, between eight to ten seconds we use the 5th measure. Knowing how many measures per page and the time of each measure lets me know which exported .png to display

What I need now is a reliable method so that when I import a midi file to musecore, I can automatically format the page as
-sheet size= B8
- orientation = portrait
- dpi = 140 dots/inch
AND
Only display EXACTLY one bar/measure -per-page.
And
Export all of the sheets of sheet music as .png files.

In short I now realize that my requirements have changed and what I really need is automated page formatting and exporting of .png files in B8- portrait sheet size at 140 DPI with only one measure per .png.

In reply to by michaelaecher

Perhaps a MuseScore template would fulfill most of those requirements.

There are a few 'watch out' points in calculating the start time of each measure:
• Tempo can be changed during a score
• Repeats and voltas need to be taken into account
• Fermatas, accelerando and ritardando
etc.

Do you still have an unanswered question? Please log in first to post your question.