Plugin for adding a line break following a rest
I have a routine written by ChatGPT. Not being a C++ programmer, I thought it might be worth the try. But it goes into a loop. I did sort of figure out how to do these things in Musescore 3 and 4. I am using 4.5.1 now.
Could someone please let me know how to add a line break following a rest -- and how to loop through the music to do it in one fell swoop. That way I get each verse with a line break after it. I tried coding this in the XML but load ignores the breaks. The routine to add the breaks after loading the XML is below and a sample of the music I want to add it to. Basically I am sculpting this unique presentation for e-books on the music embedded in the Hebrew Bible a chapter at a time. I'm about half way through the required 60,000 SVG images by line and it would save a lot of clicks to get the first step done automatically.
Thanks in advance
Bob
Attachment | Size |
---|---|
lineBreaksAfterRests.qml | 708 bytes |
LEVITICUS-002.XML | 176.28 KB |
Comments
I tried rewriting the plugin with positive logic, this time it didn't do anything, so I wonder if maybe inserting a line break is not a supported function. -- or it's clear that I don't know how to do what I would like to do.
import QtQuick 2.0
import MuseScore 3.0
MuseScore {
}
The log after correcting typos is something I don't understand...
ActionsDispatcher::doDispatch | try call action: action://extensions/v1/linebreaksafterrests.qml?action=main
2025-04-26T17:58:57.904 | ERROR | main_thread | ::operator | error: qrc:/qml/MuseScore/Inspector/notation/notes/NoteSettings.qml:102:9: QML StackLayout: Binding loop detected for property "height"
2025-04-26T17:58:57.904 | WARN | main_thread | Qt | qrc:/qml/MuseScore/Inspector/notation/notes/NoteSettings.qml:102:9: QML StackLayout: Binding loop detected for property "height"
In reply to I tried rewriting the plugin… by Bob MacDonald1
With the simple modification I attach here, you can add a line break (system-break) every time a rest appears in a measure. The problem is: is this what you want?
In reply to With the simple modification… by ILPEPITO
Seems bizarre, I know, but if you look at his attached score, it actually makes sense. It would have been easier to do it elsewise, but it makes sense given what he has.
In reply to With the simple modification… by ILPEPITO
Yes, it is what I want. I already tried coding the line breaks into the XML but I couldn't get it to work correctly. The line breaks were in the XML after the single rest in each line, but when the XML loads, they appeared somewhat randomly.
I've attached a before and after image of what I hope might happen. I still have a lot of cleanup to do, but it would reduce manual work by 10,000 carriage returns.
Thank you for your response. Your routine looked promising, but when I copy it to my location for plugins, it didn't do anything.
The log reads: action://extensions/v1/linebreaksafterrests.qml?action=main but there was no visible change in the score. It finds the plugin OK.
Thank you for the help
In reply to Yes, it is what I want. I… by Bob MacDonald1
I'm confused, Bob. Your images appear to show that the plug-in did exactly what you wanted??? The "beforeimage.png" is simply continuous measures; the "afterimage.png" has System Breaks after each rest.
In reply to I'm confused, Bob. Your… by TheHutch
I did the carriage returns and images by hand. The plugin didn't make ay changes.
In reply to Yes, it is what I want. I… by Bob MacDonald1
For some strange reason, the 'simple modification' does not actually work on your xml file (while it works elsewhere). So I had to completely rewrite it according to my criteria and this also works on your xml file: in order for the 'system-breaks' to be applied you have to select the whole score, or the part you want to process.
Processing time may take a few seconds, depending on the length of the file.
In reply to For some strange reason, the… by ILPEPITO
Please note: this plugin is tailor-made for your xml file, and assumes that there is only one rest in the measure and only one staff, otherwise you would need to add additional lines of code.
In reply to Please note: this plugin is… by ILPEPITO
Thank you very much for this. I have got it to work. ָI have just done 2 more chapters and you have reduced the effort on my eyes and hands by 1/3 to 1/2 for each chapter. With 350 chapters to go, that is a big saving -- probably 10 minutes per chapter - 60 hours work. Not to mention the related stress. It makes it easier to consider redoing some if I find other changes that affect the 450 chapters already done. Many thanks again
I'm documenting the project and there's a long history of its development on my blog meafar.blogspot.ca if anyone is interested. I'll ask the publisher if we can do a special coupon. The first volume on the book of Job is ready for reading and singing. If they give me one, I'll post it here.
Bob
In reply to Thank you very much for this… by Bob MacDonald1
It's nothing, good luck with your work. I'll add one last detail: the plugin is reversible, that is, if you apply it to a score (with the characteristics of your xml) that already has the 'system-breaks' it deletes them.
In reply to It's nothing, good luck with… by ILPEPITO
That's potentially useful if someone wants to print the score on one page. Thanks.
In reply to That's potentially useful if… by Bob MacDonald1
Your routine is wonderful and saves me some error-prone drudgery. I have put a sample pdf of the work up here: https://drive.google.com/file/d/1-HwNrPXF3kJmHYRF3SVQApPrWR4yJX_f/view?…