Changing Text-Style from the Command-Line

• May 18, 2018 - 16:22

Hello,

I have a use-case, where I need to convert a MusicXML to a PNG-file, for which I use the export-function of MuseScore. I need to call the function from the command-line, and my issue regards editing the style of text-elements in the output-file. More specifically i want to get rid of the title which defaults to the xml-filename, since it is very large for my purposes.

I am aware of the -S function, but it does not affect the Title-Text in anyway. Even though i created a .mss file where the title appears white and with a font-size of '2', when exported with -S, the title does not adopt the style.

Somewhat unrelated, but if someone happens know: Where is the .mss file referenced from when called from the command line. The default-folder of Musescore, the local folder, or perhaps a full-path is needed?

Apologies, if this question has been asked somewhere else before, but I did not manage to find an answer regarding this issue. Thanks in advance!


Comments

In reply to by Jojo-Schmitz

It seems to not work at all.
Perhaps it is related to the issue, but I I tried spacing each part extremely close to one another, but it did not adopt that change either.

I call the command line from the music 21 library in python, where i edited the subConverter.py to work as follows:

musescoreRun = '"' + str(musescorePath) + '" ' + fp + " -o " + fpOut + " -S test.mss -T 0 "
import subprocess
subprocess.Popen(musescoreRun, shell=True).wait()

maybe you can tell me what I'm doing wrong.

In reply to by Jojo-Schmitz

So, i was able to come up with a solution for my use-case, if anyone reading this might have this specific issue as well, even though the solution is not related to musescore.

In short: I was able to remove the title in my export, by editing the temporary xml-file created by music21, to remove the title, which is then handled to the musescore.exe.

The path to the xml-file can be retrieved in the SubConverter.py at

fp = self.writeDataStream(fp, dataBytes)

in the .write() method.

I hope posting this is appropriate, since it is rather off-topic.

In reply to by SqueezeBoxer

@Tobias: a more convenient workaround is:
select an example of the affected text (title, chord, lyrics...), choose "select all similar elements" then go to the inspector and click "reset to style"
(My wording may not be completely correct. I post as I can remember it without access to a running MuseScore)

In reply to by Tobias Geib

I'm afraid you understood it right: my workaround needs opening the GUI.
My use case was adapting the layout of a whole fakebook to a layout saved as .mss style template. A batch file applied the style template to all the scores. Afterwards I opened all 200+ MSCZ files in MuseScore and did that "reset to style" to the texts that were not updated correctly (together with some proof reading of the scores).

In reply to by Tobias Geib

to answer your question from the beginning:
"Somewhat unrelated, but if someone happens know: Where is the .mss file referenced from when called from the command line. The default-folder of Musescore, the local folder, or perhaps a full-path is needed?"

I specified the path to the .mss file with the -S option. Putting the .mss in the same folder as the MSCZ worked as well as specifying a full path or a relative path like .\MyStyle.mss or ..\MyStyle.mss

For further clarification I attached my batch file. It applies a style to all MSCZ files in a directory.
To use it it is required to edit the path to Musescore and the mss file and rename it to .bat.
At the time when I wrote and used it, I had to use a nightly build to include the relevant fixes. MuseScore 2.2.1 should also work, but I didn't try it yet.

Attachment Size
_ApplyStyle.bat_.txt 948 bytes

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