Skip to content

Control visibility of lyrics separate from notes #3989

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

Open
samuelbradshaw opened this issue Mar 12, 2025 · 1 comment
Open

Control visibility of lyrics separate from notes #3989

samuelbradshaw opened this issue Mar 12, 2025 · 1 comment

Comments

@samuelbradshaw
Copy link
Contributor

samuelbradshaw commented Mar 12, 2025

Describe the problem
MusicXML <note> has a print-object attribute that controls visibility of the note. This is working correctly with Verovio. However, MusicXML <note> also has a print-lyric attribute that's intended to make the lyrics on the note visible, even when the note is hidden. This is not working correctly.

MusicXML:
https://www.w3.org/2021/06/musicxml40/musicxml-reference/elements/note/

<note print-object="no" print-lyric="yes">
  …
  <lyric number="1">
    <syllabic>single</syllabic>
    <text>The</text>
  </lyric>
  …
</note>

SVG:
Image

 <g id="nyt03ao" class="note" visibility="hidden">
    …
    <g id="v1bjucqr" class="verse">
       <g id="s1g5lj5z" class="syl">
          <text x="2671" y="1782" font-size="0px">
             <tspan id="t16zun95" class="text">
                <tspan font-size="450px">The</tspan>
             </tspan>
          </text>
       </g>
    </g>
 </g>

Expected SVG:
Image

 <g id="nyt03ao" class="note" visibility="hidden">
    …
    <g id="v1bjucqr" class="verse" visibility="visible">
       <g id="s1g5lj5z" class="syl">
          <text x="2671" y="1782" font-size="0px">
             <tspan id="t16zun95" class="text">
                <tspan font-size="450px">The</tspan>
             </tspan>
          </text>
       </g>
    </g>
 </g>

To Reproduce
Steps to reproduce the behavior:

  1. Load the below MusicXML content.
  2. Render to SVG.

Expected behavior
Lyrics should be visible.

Input data

MusicXML minimal example
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 4.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="4.0">
  <part-list>
    <score-part id="P1">
      <part-name>Music</part-name>
    </score-part>
  </part-list>
  <part id="P1">
    <measure number="1">
      <attributes>
        <divisions>1</divisions>
        <key>
          <fifths>0</fifths>
        </key>
        <time>
          <beats>4</beats>
          <beat-type>4</beat-type>
        </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
        </clef>
      </attributes>
      <note print-object="no" print-lyric="yes">
        <pitch>
          <step>A</step>
          <octave>4</octave>
        </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <lyric number="1">
          <syllabic>single</syllabic>
          <text>The</text>
        </lyric>
      </note>
    </measure>
  </part>
</score-partwise>

Verovio information

  • Version of Verovio: 5.1.0
  • Binding: JavaScript (verovio-toolkit-wasm.js)

Environment information (as appropriate)

  • OS: macOS 15.3.1 Sequoia
  • Browser: Safari and Chrome

Additional context

I added a minimal example above, but here is my full file if it's helpful for context: the-morning-breaks_62.musicxml.zip
I'm attaching the lyrics to invisible notes so I can show or hide the Soprano, Alto, Tenor, and/or Bass notes, according to a user setting, without affecting the visibility of the lyrics.

See also related issue #3990

@lpugin
Copy link
Contributor

lpugin commented Apr 15, 2025

My understanding is that marking an element as not visible in MEI affects all its descendants, so I don't really agree with your expected output.

I would suggest bringing the issue to the MEI repository since the expected MEI markup needs to be clarified to achieve wnat you want (and if that is desirable) before changing things in Verovio.

@lpugin lpugin changed the title Unable to control visibility of lyrics separate from notes Control visibility of lyrics separate from notes Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants