Can't export musicxml file to midi via mscore command line on OSX Catalina

• Apr 12, 2020 - 23:35

I'm presuming the issue is I'm missing something from the musicxml file, but I can't seem to figure out what. There doesn't seem to be any issue rendering this to mp3 or pdf with the same file. Here's the output I get. Attached is the musicxml file.

/Applications/MuseScore\ 3.app/Contents/MacOS/mscore -o test.midi test.musicxml
convert ...
importMusicXml() file 'test.musicxml' is not a valid MusicXML file
Error at line 52 col 9: calculated duration invalid, using specified duration
Error at line 60 col 9: calculated duration invalid, using specified duration
Error at line 68 col 9: calculated duration invalid, using specified duration
Error at line 76 col 9: calculated duration invalid, using specified duration
Error at line 91 col 9: calculated duration invalid, using specified duration
Error at line 99 col 9: calculated duration invalid, using specified duration
Error at line 107 col 9: calculated duration invalid, using specified duration
Error at line 115 col 9: calculated duration invalid, using specified duration
Error at line 130 col 9: calculated duration invalid, using specified duration
Error at line 138 col 9: calculated duration invalid, using specified duration
Error at line 146 col 9: calculated duration invalid, using specified duration
Error at line 154 col 9: calculated duration invalid, using specified duration
Error at line 169 col 9: calculated duration invalid, using specified duration
Error at line 177 col 9: calculated duration invalid, using specified duration
Error at line 185 col 9: calculated duration invalid, using specified duration
Error at line 193 col 9: calculated duration invalid, using specified duration
Error at line 52 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 60 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 68 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 76 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 91 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 99 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 107 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 115 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 130 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 138 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 146 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 154 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 169 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 177 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 185 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
Error at line 193 col 9: calculated duration invalid, using specified duration
TDuration::setType(): unknown, assume "quarter"
to
... failed!

Attachment Size
test.musicxml 4.74 KB

Comments

The MusicXML file is indeed invalid:
- root-step must be spelled capital C
- for all notes:
- note type is missing (duration 1 and divisions 1 implies duration is quarter)
- element order is incorrect (correct is: pitch, duration, voice, type, staff

In reply to by kianwilcox

Perhaps I spoke too soon. It appears to fix it for small progressions, but larger ones still seem to be running into the same issue. If i manually load the file in MuseScore and tell it to try to import it anyway, it succeeds in getting exactly what I was aiming for. Is there a way to do something similar via command line?

In reply to by kianwilcox

Adding the -f (or --force) option might work. If not, it should be made to work, by setting canIgnore in the MusicXML importer.

Hmm, seems it does that in converterMode(i.e. when using the -o option) already:

      if (!valid) {
            qDebug("importMusicXml() file '%s' is not a valid MusicXML file", qPrintable(name));
            MScore::lastError = QObject::tr("File '%1' is not a valid MusicXML file").arg(name);
            if (MScore::noGui)
                  return Score::FileError::FILE_NO_ERROR;   // might as well try anyhow in converter mode

But see further down, you've just been using the converter mode wrongly...

In reply to by Jojo-Schmitz

Oddly enough this seems to be still giving the same problem, claiming it is not a valid musicxml file? I tried the recommendation above, and while it worked for a small progression, I appear to have the same problem when going for the full file.

Try

/Applications/MuseScore\ 3.app/Contents/MacOS/mscore -o test.mid test.musicxml

I.e. drop the trailing "i" from ".midi"
The error is about an unknown file type, that doConvert() method doesn't know about ".midi", just ".mid"

Very well explains why it works for ".mp3" and ".pdf" ;-)

See also https://github.com/musescore/MuseScore/pull/5936 which fixes this by allowing ".midi" and giving an error message about otherwise unknown file types

Fixed in the next development build and in 3.5

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