Opensheetmusicdisplay: How to specify measure range displayed?

Created on 10 Sep 2019  路  6Comments  路  Source: opensheetmusicdisplay/opensheetmusicdisplay

"For the second main feature, you can now display arbitrary bars of a piece. For example, if you only want to see and practice bars 9-15 of a piece, you can now display them on OSDM without any hassle. It is as simple as it sounds. Just put in the bars that you want to display on our site and off it goes!"

I have no idea how this is actually doable. I don't see a place to change this in the demo or the getting started build. I would like to be able to specify measure ranges in my code if that's possible.
Thanks

question

Most helpful comment

Like this:

osmd.setOptions({
  drawFromMeasureNumber: 9,
  drawUpToMeasureNumber: 15
});
osmd.render();

See the demo code, which is in index.js.

For further guidance for OSMD, look at the Wiki (check Getting started) or feel free to ask us here!

All 6 comments

Like this:

osmd.setOptions({
  drawFromMeasureNumber: 9,
  drawUpToMeasureNumber: 15
});
osmd.render();

See the demo code, which is in index.js.

For further guidance for OSMD, look at the Wiki (check Getting started) or feel free to ask us here!

Thanks for replying! That worked. Is it possible to not have it create a double bar line at the end of a given range? I would like to display an entire score in chunks with, for example, button clicks progressing to the next set of measures.

Sorry, I'm asking so many questions. But this technology is really exciting!! Where can I find documentation for the other methods I can use within setOptions, for example? I'm currently looking under Class Documentation. There's just so many things listed!

Thanks

Is it possible to not have it create a double bar line at the end of a given range?
It is definitely desirable! It looks like you found unintended behavior, aka a bug.
When OSMD renders a range of measures, the last barline should be the one in the originally, not automatically a double barline. I've opened an issue for it, #569.

For information on the OSMDOptions, I would check the docstrings of the OSMDOptions interface:
https://github.com/opensheetmusicdisplay/opensheetmusicdisplay/blob/develop/src/OpenSheetMusicDisplay/OSMDOptions.ts
For the exact details, i would always look at the code, e.g. OpenSheetMusicDisplay.setOptions() and EngravingRules.

Also, Getting Started in the Wiki has a section on Options, though it's probably too hard to find and should have its own page.

Don't worry, i've answered many more questions from other people and I'm glad to help ;)
Also, it's nice to hear that you're enjoying OSMD!

By the way, people keep asking about click events for notes, it would be a nice middle-priority feature to add to OSMD itself, but it might take some time.
We already gave a short hint on how it may be implemented in #504.

Like this:

osmd.setOptions({
  drawFromMeasureNumber: 9,
  drawUpToMeasureNumber: 15
});
osmd.render();

See the demo code, which is in index.js.

For further guidance for OSMD, look at the Wiki (check Getting started) or feel free to ask us here!

good job!

Was this page helpful?
0 / 5 - 0 ratings