Skip to content

Piano: Display left hand only or right hand only (set staff.Visible = false) #1599

@sschmidTU

Description

@sschmidTU

You can now show only the right hand or left hand of a piano score:

Image
osmd.sheet.Instruments[0].Staves[1].Visible = false;
// osmd.sheet.Instruments[0].Staves[1].audible = false; // for audio player to disable audio as well
osmd.render();

Same for left hand only:

Image
osmd.sheet.Instruments[0].Staves[0].Visible = false;
// osmd.sheet.Instruments[0].Staves[0].audible = false; // for audio player to disable audio as well
osmd.render();

(Take care not to set both to invisible)

Previously, we could only hide whole instruments (instrument.Visible = false), but the piano is usually given in one instrument with two staffs (except in very old xmls),
and there was no Visible attribute on Staff.

(Implementing this was a little more work than adding the attribute, there were some parts of the code that assumed a staff is visible when the parent instrument is Visible)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions