JSON output from --score-transpose? How do I convert it to MSCZ or something useable?

• Jan 6, 2023 - 19:31

I am using some of the command line options to try and batch convert some files, specifically transpose from bass clef to treble clef, so basically just move a line up several octaves. I have discovered the command line usage of:

MusicStation:~ dmcgilli$ /Applications/MuseScore\ 3.app/Contents/MacOS/mscore ~/Desktop/TestTranspose.mscz --score-transpose '{"mode": "by_interval", "direction": "up", "transposeInterval": 25, "transposeKeySignatures": true}'

And that works, but I get back a giant blob of JSON (see below) which, great, something happened, but what do I do with that to turn into its own Musescore file? I need that to be a net new transposed file ..somewhere.

Still using Musescore 3.6 on El Capitan.

Attachment Size
Screen Shot 2023-01-06 at 11.29.45 AM.png 410.38 KB

Comments

In reply to by BassoRidiculoso

I have used the following workflow (on a Mac)

mscore --score-transpose '{"mode": "by_key", "direction": "up", "targetKey": 4, "transposeKeySignatures": true}' score.mscz | jq -r '.mscz' | base64 --decode > transposed_score.mscz

you will need JQ (the JSON parser) and base64, both available via homebrew.

Unfortunately, it appears that --score-transpose is broken and do nothing, as the resulting file is exactly the same as the original file (i.e. no transposition is done)

That blob looks like the contents of a zip file, which is what mscz format is. You could try stripping it back to just the value of the "mscz:" contents and see whether MS can open the result.

In reply to by BassoRidiculoso

See:
https://musescore.org/en/node/341539

There's an attachment in that discussion called 'extract_v3.py.txt' that can convert the JSON blob to a musescore mscz or PDF (or both) files.

Just run the command:
MusicStation:~ dmcgilli$ /Applications/MuseScore\ 3.app/Contents/MacOS/mscore ~/Desktop/TestTranspose.mscz --score-transpose '{"mode": "by_interval", "direction": "up", "transposeInterval": 25, "transposeKeySignatures": true}' | extract_v3.py ~/Desktop/TestTransposeResult.mscz ~/Desktop/TestTransposeResult.pdf

In reply to by jogogo2

Sorry for necro-ing. I've been trying to get the --score-transpose option to work with MuseScore 4, but as far as I try your command or the one written by OP, all I get is an identical pdf/mscz file without the transposition. Anybody so far tried this with MuseScore 4?

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