Skip to content

Possible to load .sfz soundfont instead of .sf3? #3

@ultraGentle

Description

@ultraGentle

WebMScore is great!

I can successfully load my own, local .sf2 or .sf3 files, however:

Trying to load an .sfz soundfont throws error 15424120. (And error.message is simply 'undefined'.)

The reason I need the .sfz is that I need to be able to edit the .sfz file textually and programatically without an intervening Soundfont generator.

Is there a way to use .sfz's? Do I need to specify Zerberus (the Musescore .sfz player)? Do I need a different file structure? Please see below.

My environment is node js, with the following test case and file structure:

File Structure

Project Folder
    app.js
    testScore.mscz
    mySFZ.sfz
    samples
           one.wav
           two.wav
           etc.wav

Test Case (Works with .sf3 , errors with .sfz)

const WebMscore = require('webmscore');
const fs = require('fs');

// free example scores available at https://musescore.com/openscore/scores
const name = 'testScore.mscz';
const exportedPrefix = 'exported';
const filedata = fs.readFileSync(`./${name}`);

WebMscore.ready.then(async () => {
    const score = await WebMscore.load('mscz', filedata, [], false);
    await score.setSoundFont(fs.readFileSync('./mySFZ.sfz'));
    try { fs.writeFileSync(`./${exportedPrefix}.mp3`, await score.saveAudio('mp3')); } 
    catch (err) { console.log(err) } 
    score.destroy();

});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions