Plugin request: export every n bars as a separate mscz file

• Oct 30, 2024 - 13:51

Hello,
I'm interested to know if it's possible to create a plugin that exports every 2, 3, 4 etc bars of a musescore file as a separate mscz file. It would save me a great deal of time to have a plugin like this and I would be willing to pay for the work involved provided I can afford the quote given.

Additional features that would be a bonus but not essential:
- Automatically name each output file '(Title of original file) + (n bar chunk x)' e.g output file that contained the first 3 bars from original score would be called 'Moon River 3 bar chunk 1'
- Retain the bpm indicated at the beginning of the score in all of the output files


Comments

It would be possible in a MS3 plugin, including the additional features that you mention although care would need to be taken with tempo because this can be changed at any point in a score. I don't use MS4 so can't comment.

In reply to by mattwosere1

I'm currently already working on a couple of plugins so don't have any time for another one just yet. Like the main MS program, plugins are typically provided without any charge. It's one of the nice things about the MS community.

Maybe someone else will pick this up before I get round to it. If you have any coding skills I can point you in the right direction.

Score Chunker 1.0

Select:

• Chunk Size
• Excess Size (adds to chunk size if this would complete the score)
• Chunk Suffix (default is M)

I recommend copying your master score to a separate chunking folder for all the chunks - and just in case of any bugs.
Works with multiple staves but haven't tested with parts.
More staves + more measures = slower process because there's more to do but it's pretty quick.

Here's an example output:

ScoreChunker.png

ScoreChunker 1.0.qml

In reply to by yonah_ag

This is amazing, thank you so much! Especially as I was about to report back on the total failures of getting chatgpt to add a step to its code that kept the original tempo.
Seems to all work for me as I've opened up the qml via plugin creator and it gives the window you posted as an image. Just wondering where I should expect to find the output files?

In reply to by mattwosere1

The output files are saved to the same folder as the input score being processed. I have made a separate folder where I copy a score to since I don't want all the chunk files in with my main scores. (This also ensure that the plugin cannot touch your original score in any way, which is always a good initial precaution with plugins!)

I run it from the main plugin menu:

ScoreChunker.png

The plugin could have options to open any/all of the chunks after processing which might be useful to show that processing has finished. It could open the first chunk and then provide a navigation button to the next chunk etc.

You can obviously chunk the same score with different parameters and use a different suffix:

ScoreChunkerA.png

The chunking parameters could be saved to the chunks so that forward/backward navigation would be possible without having to regenerate the chunks every time.

If the tempo changes during the score then these changes will be reflected in the chunks when the chunking parameters co-incide with the tempo changes; otherwise there will need to be some extra tempo changes inserted, even if they are made invisible.

In reply to by mattwosere1

It looks like the ChatGPT approach builds a new score from scratch, which might accound for the loss of tempo setting. My plugin 'tops-and-tails' the score to make each chunk; saves the chunk then undoes the 'top-and-tail' to restore the master score ready for the next chunk. This way everything gets saved with the chunks: header frame, score image, footer frame, stave texts etc.

In reply to by yonah_ag

Thanks for this revision. Here are the steps I've taken to try and resolve the missing files issue:
-moved the qml from downloads to C:\Users\matt0\Documents\MuseScore3\Plugins .
- uninstalled and reinstalled musescore 3 so I now have the version shown in the png.
- created a new test score in that version of ms
- updated window for version 1.1 shows the 'navigate' button however 'chunking...' does finish after pressing 'chunk score'.
-restarted the pc (because that's all I can think of lol)

I've also managed to get python code from chatgpt to change the tempo of each of file that does work this time. The issue was that the bars in the segmented files kept the bar number they had in the original score. So the code was putting in a tempo marking at bar 1 for each file but only the first chunk had a bar 1 so that was the only file it worked for. As a (very messy) work around I asked for code that put the tempo marking for every bar haha!

So I have a very messy substitute for now but if you're happy to keep working on this I would still be very grateful. Thanks again.

Attachment Size
musescore version.PNG 13.12 KB

In reply to by mattwosere1

Your version of MuseScore is way out of date so I'm guessing that its plugin API does not support the code that I'm using. I have no idea how you ended up on such a state-of-the-ark version when the final official incarnation of MS3 was 3.6.2.

However, there in an on-going development of MS3 known as MS3.7 Evolution which is so much better than 3.6.2 and maintained by well known MuseScore guru Jojo Schmitz. I reckon that installing either will solve the issue.

MS3.7 can open MS4 files and has bugfixes and enhancements.
Here is the official wiki for it:
https://github.com/Jojo-Schmitz/MuseScore/wiki/

If you prefer MS3.6.2 then it can be found in the official archive here:
https://ftp.osuosl.org/pub/musescore-nightlies/windows/3x/stable/

In reply to by mattwosere1

I don't think that MS3.7 will make any difference. I only have guitar tab scores so if you can create a short piano score which exhibits the problem and upload the .mscz file to this thread then I can take a look.

I can test it in 3.7 but I suspect my lack of experience with piano scores is most likely the root cause, i.e. bugs in the plugin.

3.6.2 and 3.7 can be installed on the same PC but I think that only 1 of them should be open at any time. I use 3.7 exclusively now and only keep 3.6.2 installed as a backup.

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