osmd-audio-player
osmd-audio-player copied to clipboard
Chords are not being played
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:
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.