Feedback for plug-in Time Signature copy/paste

• Feb 13, 2024 - 10:57

This is for copying a sequence of time signatures from one part of your score to another. It has a loop feature for those who want to copy a short sequence many, many times. The a9_prelim version is the latest experimental version. It uses the computer’s system copy/paste buffer to store info, so it can copy/paste across different Scores. This version seems to work in 3.6 and 4.2.1.

My first plug-in. Copied as much as possible from others. ;)

Will post more info shortly.

https://musescore.org/en/project/time-signature-copy-paste

https://github.com/TeeDeeY/MusescoreQML


Comments

Since I don’t know how to insert measures in the middle of a Score, you have to do it yourself. (Edit: most current version inserts measures)

First, select the range of measures. Run plug-in. Change the repeat value from 1 to the number of loops.

Click where you want to OVERWRITE. Insert a lot of measures there. (Edit: doesn’t overwrite any more) Press the GO button.

The user interface is crude. I need to find a plug-in to imitate.

Hi, I tested it with several scores and worked fine, without problems, with the restrictions you indicated (can't paste to measure #1 but also cannot paste to measure #1 of a new section).

It would be great if it detected when the actual measure duration is different from the nominal, the scores which I used to test had several of those and they needed to be edited separately, but as it is it's already a huge improvement and time saver. All the rest worked well.

Thank you for your hard work. You solved a missing functionality that was plaguing Musescore, and many needed it. I don't know if a similar method can be used to copy-paste tempo marks, but if it could, it's the other big copy-pasting tool that people are requesting for ages.

In reply to by Nuno R. Rodrigues

Thank you for testing it out. For the “actual measure time”, I couldn’t make that work but have some information which could possible set it using the command interface. I’ll have to try and see.

The comment “also cannot paste to measure #1 of a new section” didn’t seem to be a problem for me. Please describe this issue in detail.

If someone needs to insert time sigs into the first measure of their score, they should use the Musescore interface to insert multiple measures there, then time sig paste starting at measure 2, then delete measure 1. This is a limitation due to a workaround that was used.

When adding time signatures in some conditions, the nextMeasure function pointed to an incorrect measure. To work around that, the plug-in does a previous segment, next measure, next measure process. This seems to go to the measure after the measure of the updated time signature. Since there is no previous measure in measure 1, the plug-in won’t work properly.

As far as other “types” of items to copy and paste, the current problem is that my attempts to properly “add” some types of items failed. For instance, adding a new new rehearsal mark in a selected measure using a plug-in doesn’t work yet but they can be updated.

A primitive plug-in to reset all rehearsal marks to measure number is being worked on but only on those already added into the score. The copy-paste method isn’t known at this time.

I am not sure if tempo marks have the same issue. This can be looked at soon.

In reply to by Nuno R. Rodrigues

Thanks for the update. For “copy-paste tempo marks,” are you talking only about metronome marks or is there more to it? I don’t delve into complex tempo marks.

As far as future copy/paste goes , I just got a plug-in to insert new metronome tempos and Rehearsal Marks so it should be possible to later copy and paste them.

Exporting to MXL afterwards and then drag/drop into Musescore seems a good practice to clean up overlooked settings by the plug-ins. That does strip away excess (more than one per measure) metronome tempo marks. MXL export seems to keep the first tempo mark added while Musescore, before export , plays the last one, when multiple tempo marks are added. Strange.

Rehearsal Marks when exported/imported get the default justification when brought back in, likely based on the system default.

I will try to make a copy/paste plug-in for tempo and rehearsal marks, among items that regular copy/paste doesn’t handle and see how it goes. I’ll probably make a reposition Rehearsal Marks plug-in separately, which will later be integrated into a bigger one.

… all based on guesses on how things work.

Please check GitHub for the revised a6 version. The user interface isn’t updated yet but now it also copies “actual” time signature.

Revising actual TS at the time of insert didn’t work so well but after completing a line of time signatures, the plug-in jumps back and then updates the Actual Time Signature. This seems to work but please test it. Thank you.

I have started to use cmd(“insert-measure”) to insert one measure at a time but in some cases it doesn’t insert them. I made a workaround as described inside the file.

A revised version should be coming soon that does insert measures. Extra measures will need to be deleted afterwards.

Thanks for the clever plugin! Can it be used only within a single score, or also to copy time signatures from one score to another? The latter would be very useful as I'm trying to concatenate several scores into one.

In reply to by Erik A

Thanks for the feedback. Currently, it can’t work across scores as they are separate program instances.

This is the second situation where copying something from one score to another is needed. It won’t happen soon but I’ll try to make it work.

I posted a rough version that can save the time signature sequence to a file (save button). Then, you go to another instance, run the plug-in, use load button and then go-paste.

This is for design evaluation. It may work but I won’t be able to work on it for a bit, so I’m posting for evaluation. It’s on GitHub, ending in a8_prelim.

It also adds measures and adds a time signature at the insert point, to protect any prior work.

As always, appreciate your feedback so it can be more useful in the future.

It could always write the file so you don’t have to remember to save but it could be irritating as well.

More measure fields ( such as don’t count in measure number calculations) will be added in the next version.

In reply to by Erik A

I revised it with an “a8-C.” Please see if it is better. Are you using version 3.6? Also, are you using a Windows computer? The filename and directory info changes so I may need another go at it depending on your OS. I tested this on Ubuntu with MS 3.6 and 4.2.1.

Thanks for testing it out.

A revised version will use the copy/paste buffer and not use the file system, which seems different between v3 and v4, and likely different between different OSs.

In reply to by TDYama

Good suggestions. Yes, I thought I knew how to read the console log in the Mac. One can use either the Mac app "Console" or the Terminal window, of which the latter works pretty much like any Unix shell. I find lots of messages from MS in the console, but nothing that seems to come from the plugin. For example, I have tried some variants of "log show -process mscore | grep Home", which returns nothing. Suggestions are welcome. I am not a programmer and may have made a simple mistake.

In reply to by TDYama

Interesting! I did as you suggested and learnt many new things. Previously I had only launched MS in the normal way (for a Mac user), by clicking its icon. Launching it from the command prompt, even without -d, made a difference! In this way, the plugin version a8 works. timesigCP_V1.tmp is created upon Save, in the directory from which MS was launched, and can be loaded and applied in another score.

I assume that when MS is launched in the normal way, then it runs in a directory (still unknown) where it does not have read/write access. The problem might perhaps be solved by saving the timesig file to another directory, by giving MS sufficient privileges in the directory where the plugin wants to save the timesig file, or by figuring out how to launch a Mac app in a directory of the user's choice. However, I see no need for such efforts, since a9 works nicely using the copy/paste buffer regardless of how MS is launched.

Yes, if MS is launched with -d, then the debug messages including Home and Temp are shown on stdout.

In reply to by Erik A

Thanks for the feedback. Please try the a9_prelim version. It uses the “system” copy and paste buffer. It works in Musescore 3.6 and 4.2.1 on Ubuntu.

It works across scores. You just need to remember to select a sequence, run the plug in, then save then TS sequence.

Then, in another Score, run the plug-in in the second score. Select load. Make sure you select a measure to paste into. Select Paste button.

About 4 extra measures are appended, in addition to the currently inserted measures. Plus a safety time signature for the measure at the insert point.

Thanks for testing.

I currently don’t recommend using the plugin when measure actual is different than the nominal. When saving, a corrupt measure warning comes up. If you go to each measure in error, click in the measure and press the DEL key, the discrepancy seems to clear. Then, you can save the file.

I’m trying to fix it but until it’s fixed, I think only measures where actual equals nominal should be copied.

Edit: A musescore bug. It has been reported via GitHub. No workaround found, except to clear measures manually after copy-paste.

I have used the plugin extensively and it works well. Thank you! I am using it to append movements of orchestral music after each other, thus creating one long score from several shorter.

If you at some point would find the time and inspiration to improve it further, here are some suggestions. Please regard them as friendly suggestions, not requests or criticism. :)

  • Would it be possible to speed up the "Go! Paste" action? In one case, it took more than 30 minutes to paste a score of 515 measures into another score.
  • The plugin would be even more useful (for me) if it could also copy/paste other items, such as key changes, tempo marks, barlines, and system text. Presently I need to insert each such item manually, one by one, after copy/pasting first the time signatures (using the plugin) and then the music itself (by regular MS copy/paste). Any little step in this direction would be welcome, even if a complete implementation is out of reach.
  • The interface might be made slightly more intuitive by renaming "Save TS" -> "Copy TS" and the combination "Load TS"+"Go! Paste" -> "Paste TS" (I always click those two in sequence).

In reply to by Erik A

Thanks for using it. The coding is quite ugly but it guess it gets the job done. I’ll describe some points why I probably won’t do much more on it. I’ll take your input for a far-future update. Also, musescore 3.7 reads 4.x files and may make more sense for some of your work but I don’t actually know. I thought some old MS versions could perform some appending but that went away at some point.

There will be extensive changes to the musescore “plugin” system at some point. I don’t know when, but all current plug-ins won’t work in some “future” musescore so I don’t want to spend too much time on complicated work. My motivation is low due to the new information and lack of other information.

The issue of actual measure being different than nominal measure requires a user to press DEL to reset the measure. There is a bug in the musescore plugin api for the function to change actual measure. I made a GitHub bug report earlier on the problem but it probably will never be fixed in musescore. It is a P4 level issue, meaning probably never in the old plug-in system though maybe it will work in the new “extensions” system. This further lowers my motivation to expand on the current plugin.

There is a separate plugin for tempo marks but I think it can’t work between separate scores in 4.x.

For tempo and system text, there is an alignment issue. It could be accomplished using a sacrificial voice for alignment purposes. I consider tempo and system marks some somewhat complicated so it’s unlikely I’ll work on it.

Again, look at version 3.7 “evolution” maintained by Jojo.

I believe key changes can’t be detected using the plugin interface so that isn’t possible. I could be wrong but that’s my current knowledge.

Bar lines are possible. I did some basic work on them and it should be possible.

Speed can’t be greatly improved. It does perform extra work because it needs to load all the information into the copy/paste buffer, read it back, and add time signatures. Adding time signatures is slow in musescore because each one added causes a recalculation of all the measures following it. If you copied 50 measures at a time in ten steps, it could be faster due to fewer trailing measures, which are reprocessed every time a time signature is added. That is speculation. It may not be worth it the hassle because it’s easy to make a mistake when breaking it up. Plug-in-wise, adding measures at the start works but adding them as needed gave me some problems. There seem to be quirks in performing various tasks and I have to keep to the current process.

When the new extension system is done, and if the main program doesn’t copy time signatures, etc. and there is a method to perform the functions, I’ll likely work on something to do the work. But that is future work.

MS progress will happen and it’s a bit more of a change than I was expecting.

In reply to by TDYama

The short answer is, I thought previously that a current plugin could be carried over in some manner to many future musescore versions but that seems unlikely based on newer information.

Therefore, I’ll probably wait. When the new system is working, I’ll learn and use it.

In reply to by TDYama

Thank you for the detailed explanation! Under the circumstances, I fully understand that you are not developing the plugin further.

When I copy/paste measures of non-nominal duration, they revert to their nominal duration. I fix them when I anyway check the concatenated score for missing key changes, tempo marks, etc. I get no warning message and do not need to reset them using DEL.

I will try to find more info about the mysterious MS 3.7. Thank you for the suggestion! You may be right that this would work for me—I generally like v3 better than v4.

In reply to by Jojo-Schmitz

Using the latest plugin, MS 3.7 does copy the “measure actual” over correctly. When pasting the notes over, they are automatically aligned to “actual measure size.”

One issue is that it only saves in ms3 format, so some ms 4 types may not transfer over. You will have to load and save in 3.7, then load in 4.3 to check if everything is there.

Also, after the measure number is changed, the display isn’t instantly updated for the extra space, if there is one. But, pasting into the measures is correct. This is better than 4.x versions.

In reply to by Erik A

Feedback from Musescore developer on future of plugins:

https://github.com/musescore/MuseScore/issues/23419#issuecomment-221994…

I think it will be like this:

In version 4.5 we will declare the old system obsolete (but we will support its operation)
We will support the operation of the old system until version 5.0 at the latest, unless there are very serious reasons to stop supporting it earlier. i.e. the old system will be operational for about another year.
Porting from the old system to the new one is not very complicated, i.e. you won't have to rewrite everything from scratch, but some changes will need to be made.
We will prepare documentation about all this.

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