Batch Transpose

EDIT2: It dawned on me that with the introduction of cmd transpose, most of the code in BatchTranspose2 becomes superfluous. See BatchTranspose3 for a leaner and faster version.But BatchTranspose2 allows you to costumize tpc settings, i.e. the choice between sharps & flats.
The var interval line is now at line 159 for BatchTranspose2 and at line 154 for BatchTranspose3.
Cmd transpose often does ugly things, which can be corrected by up/down arrow manipulation, but this does not adapt ‘wrong’ chord symbols. An example:
EDIT: The original plugin (BatchTranspose.qml) does not transpose the key signature. This cannot be done in a plugin without cmd(“transpose”), and then the command line approach is no good and/or erratic. As discussed in a batch-like procedure is possible in MS using the next-score command.

The new plugin (BatchTranspose2.qml) uses this approach. Proceed as follows:
Load the attached file (empty.mscz). This must be the leftmost file in MS. Now load a bunch of files to be transposed (I have routinely loaded 35 lead sheets at a time without any problems. I think the only limitation is available memory). Select the first (the one next to empty) and run the plugin from the Plugin Creator window so you can see error messages. Be patient. If errors occur it is always in the last modified file (that has a *).
*** end of EDIT ***
Plugins using cmd (“select-all”) & Co run from the command line always get the error: “not valid in this state.”
See for background.

This plugin runs also from the command line e.g.

"C:\Program Files\MuseScore 3\bin\MuseScore3.exe" -p BatchTranspose.qml -o test2.pdf test2.mscz

The variable interval at line 120 is the number of half steps to transpose (positive or negative), e.g. interval = 5 transposes a fourth up. Adjust is as needed.

Tpcs for deciding between # & b are based on chromatic scales based on the nearest tpc2note. This is somewhat arbitrary, but seems to work reasonably well.

Please note: if you run the plugin from the Plugin Creator Ctrl-z does not restore the original file, but if you close & re-open the file its is still the original, ergo save as needed.

Please report problems at the node above.

Issue Tracker

API compatibility
Plugin categories
Batch processing
Attachment Size
test2.mscz 6.92 KB
BatchTranspose.qml 16.71 KB
empty.mscz 4.3 KB
BatchTranspose2.qml 19.54 KB
BatchTranspose3.qml 7.6 KB