Command-line conversion - keep musecore running for faster conversion?

• Nov 27, 2018 - 13:42

I'm looking into MuseScore for bulk typesetting small MusicXML files that are generated on the fly. I want to do this online, so performance is important. Using the standard command-line options it takes upwards of 1 second on my machine. I'm sure that most of that is setup and teardown. Batch mode doesn't solve my problem because it's a never-ending batch.

Is there any way to keep the process running and pipe data in and out of it? Like with STDIN/OUT or a socket? The command-line options don't hint at anything.

Thanks in advance!


Comments

there is a) the batch convert plugin and b) the -j jsonfile option, both allow to converte multiple files in one session, but neither allows musescore to be run in a pipe or socket, such thing is not possible with MuseScore as it never reads files from stdin nor writes them to stdout

I would also love to hear about this. The dream is that Musescore would run from the command line without loading QT / connecting the window server (which is probably most of the startup time) and in a continuous mode like this. But I guess it'd need a fair bit of work to get there.

In reply to by Geordie J

Oh, right, the PR got merged, so you can now batch-convert in large style in 3.1.

Not using Qt, not connecting to the X Window server, is not feasible though: a lot of the things it does depend on it, down to font configuration. In -j mode, at least it doesn’t create the GUI, so there’s that (it’s a tad faster).

In reply to by mirabilos

I did see the -j option but the inline help doesn’t give any examples of how to use it. Is there documentation for it online that I’ve missed?

Edit: I found this https://musescore.org/en/handbook/3/command-line-options#EXAMPLES

But I suspect the issue we are having is actually different: In my tests if I ran Musescore with a plug-in, the svg output produced (on the same invocation) was produced before running the plugin. Maybe this bug has been fixed now but we actually had to save a new mscx file with changes from the plugin and run another invocation.

I’m just editing the mscx XML programmatically instead now (which I’d rather not do, but seems to be the only way of reliably changing the page layout) so maybe running the plugin and exporting in one invocation will be enough.

In reply to by Geordie J


$ cat foo.jsn
[
{
"in": "/usr/share/mscore-snapshot-3.1/demos/Reunion.mscz",
"out": "Reunion-coloured.pdf",
"plugin": "colornotes.qml"
}
]
$ musescore-snapshot -j foo.jsn

This generates a PDF with coloured notes for me. Mind, the plugin must be in the correct directory for this to work. (I also forgot the .qml at first, making it silently ignore the plugin line.)

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