Plugin request: export every n bars as a separate mscz file
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 It would be possible in a… by yonah_ag
Great! yes a MS3 plugin would also be fine.
In reply to Great! yes a MS3 plugin… 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.
In reply to I'm currently already… by yonah_ag
Yes it is a nice community, I've only just entered the musescoreverse but wish I'd joined sooner. I don't have any coding skills unfortunately.
In reply to Great! yes a MS3 plugin… by mattwosere1
Incidentally, why do you split up scores in this way?
In reply to Incidentally, why do you… by yonah_ag
I'll DM you
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 1.0.qml
In reply to Score Chunker 1.0 Select •… 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 This is amazing, thank you… 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:
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:
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 The output files are in the… by yonah_ag
I'm not seeing the output files after running it from the main plugin menu at the moment. Will try some more troubleshooting and get back to you.
In reply to I'm not seeing the output… by mattwosere1
How odd. Do you get them when running from the plugin creator?
In reply to I'm not seeing the output… by mattwosere1
What OS are you on, and which version of MuseScore?
In reply to I'm not seeing the output… by mattwosere1
You could upload a score and I'll test it, (non-copyrighted or only an excerpt.)
In reply to This is amazing, thank you… 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 This is amazing, thank you… by mattwosere1
There is definitely room for improvement.
• Manual stave/page breaks are retained which can give odd layouts.
• Bar numbers start from 1 in each chunk.
Maybe you will find other suggestions for improvement.
It's usually quite easy to add options to plugins.
Score Chunker 1.1 adds Chunk Navigation
ScoreChunker 1.1.qml
In reply to Score Chunker 1.1 add Chunk… 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.
In reply to Thanks for this revision… 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 You version of MuseScore is… by yonah_ag
Yes brilliant it works with MS3.6.2! The only issue is there are two treble clefs in the segmented piano scores that were written originally with treble and bass clef. I'll install MS3.7 as that might have the debugs which resolves it.
In reply to Yes brilliant it works with… 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.
In reply to I don't think that MS3.7… by yonah_ag
Sure, here's the one I tested the plugin with.