JSON output from --score-transpose? How do I convert it to MSCZ or something useable?
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
Anyone have any examples of reading in this JSON format and creating a Musescore file with it?
In reply to Anyone have any examples of… by BassoRidiculoso
Looks like an image to me
In reply to Looks like an image to me by elsewhere
its a screen shot of the output of running the command line transpose command. The result is a transposed file in this JSON format and the question is how does one then open or manipulate that transposed version. What is the value of having the result in a JSON blob?
In reply to Anyone have any examples of… 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 That blob looks like the… by yonah_ag
It doesn't seem to start with the PK Zip magic bytes though
In reply to It doesn't seem to start… by Jojo-Schmitz
So any idea how one does anything with the result of the command line transposing function, or any command line function that returns its results as this JSON blob? How does one manipulate the results of any of those file transformations?
In reply to So any idea how one does… 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 See: https://musescore.org… 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?