Skip to content

Chords are not being played #103

@Matthew1172

Description

@Matthew1172

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions