LibreScore / webmscore

MuseScore's core library (libmscore) in WebAssembly! Read mscz data, and generate audio/MIDI/MusicXML/SVG/PNG/PDF sheets right in browsers.
https://www.npmjs.com/package/webmscore/
Other
125 stars 12 forks source link

converting midi to xml fails #7

Closed ultraGentle closed 2 years ago

ultraGentle commented 2 years ago

I'm getting FileError: WebMscore: FILE_UNKNOWN_TYPE when attempting to ingest a .mid file and output a .musicxml.

Here's my code to reproduce:

let file = fs.readFileSync(filePath, null); // note : besides null, which yields a buffer, I've tried 'binary' and 'utf-8'

function generateAudioViaWebMScore(file) {
    WebMscore.ready.then(async () => {
        const score = await WebMscore.load('mid', file, [], true);
        fs.writeFileSync(`converted.musicxml`, await score.saveXml());
        score.destroy();
    });
}

Is this by design/my error/a bug?

Thanks for any suggestions!

ultraGentle commented 2 years ago

solved: webMscore wants midi not mid in the .load method