Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chords are not being played #103

Open
Matthew1172 opened this issue Apr 27, 2022 · 0 comments
Open

Chords are not being played #103

Matthew1172 opened this issue Apr 27, 2022 · 0 comments

Comments

@Matthew1172
Copy link

If I have a music XML file that has some named chords in it such as "G7" and "Am" then it shows up in the rendering like this:
Screenshot 2022-04-27 004435
And in a program like MuseScore, those chords will be played. However I'm not sure if this is a feature related to OSMD or the OSMD audio player, but they're not being played on my website. Is there something I'm missing or has this feature not been implemented? Here is a skeleton of my code:

let osmd = new opensheetmusicdisplay.OpenSheetMusicDisplay("osmdCanvas", {
    // set options here
    backend: "canvas",
    drawingParameters: "compacttight", // more compact spacing, less padding
    drawMeasureNumbers: false,
    drawFromMeasureNumber: 0,
    drawUpToMeasureNumber: Number.MAX_SAFE_INTEGER // draw all measures, up to the end of the sample
});
let audioPlayer = new OsmdAudioPlayer();

...

mxl = atob(response['scoreXml']);
//play_and_render(mxl);
try {
    osmd.load(mxl)
        .then(function () {
            osmd.render();
            osmd.cursor.show();
            audioPlayer.loadScore(osmd);
            $('#controls').show();
        });
    const instrument = osmd.Sheet.Instruments.flatMap(i => i.Voices);
    $("#instruments option:selected").prop("selected", false)
    $('#instruments option[value="'+instrument[0].midiInstrumentId+'"]');
}catch (e) {
    //osmd could not load the mxl. Most likely it is 'BadArguments' provided duration is not valid.
    alert("OSMD could not load the mxl. Please try again.");
}

Thank you again for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant