Skip to content
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

Humdrum: Improve element visibility for suppressed tokens #3436

Merged

Conversation

WolfgangDrescher
Copy link
Contributor

Demo data:

**kern	**kern
=7	=7
*^	*^
2B;yyy	2GG;yy	2g;yy	2d;yyy
=:|!	=:|!	=:|!	=:|!
*	*	*	*
4dyy	4GGyy	4byy	[4gyy
=8	=8	=8	=8
4dyy	4GGyy	4byy	8gL]yy
.	.	.	8f#Jyy
4cyy	4AAyy	4ccyy	8eLyy
.	.	.	8f#Jyy
8BLyy	4BByy	4ddyy	[4gyy
8AJyy	.	.	.
=9	=9	=9	=9
8BLyy	4.BByy	4.ddyy	8gL]yy
8cJyy	.	.	8aJyy
4dyy	.	.	8gLyy
.	8AAyy	8ccyy	8f#Jyy
4dyy	4GGyy	4byy	4gyy
=10	=10	=10	=10
2d;yyy	2D;yy	2a;yy	2f#;yyy
4Byy	[4Eyy	4gyy	4eyy
=	=	=	=
*v	*v	*	*
*	*v	*v
*-	*-

Before:

Bildschirmfoto 2023-05-30 um 21 59 48

After:

Bildschirmfoto 2023-05-30 um 22 01 27

Questions:

  • @craigsapp Should I implement this for HumdrumInput::insertGBeam as well?
  • I'm not sure if this could also be relevant for HumdrumInput::insertBeamSpan
  • beam->SetType("invisible"); does not seem to have any effect for the element visibility and there is no beam::SetVisible member for beams. I fixed this for now with beam->SetColor("transparent") but I'm sure there must be a better solution. Any suggestions?

Comment on lines +20233 to +20234
beam->SetType("invisible");
beam->SetColor("transparent");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any ideas how to improve this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the best way. This is equivalent to visibility: none in CSS: space will be allocated to the beams but they will not be shown. This should be sufficient as long as you don't mind the extra vertical space between staves that this may create.

@craigsapp
Copy link
Contributor

craigsapp commented May 31, 2023

beam->SetType("invisible"); does not seem to have any effect for the element visibility and there is no beam::SetVisible member for beams.

the @type attribute is a more informal system, so it is useful to include for analytic purposes. And at least in general it is not used by verovio for rendering (that is usually done by @form when doing some sort of special rendering in verovio). The @type parameter is converted into a @class attribute in the SVG output from verovio. So you could add a verovio option to the Humdrum file to cause the elements with a transparent class label to be colored transparent:

!!!verovio: svgCss g.invisible { fill: transparent; stroke: transparent; }

Or perhaps equivalently:

!!!verovio: svgCss g.invisible { visibility: none; }

I notice that ledger lines are still visible when notes are set to transparent. Is there also a way to control the color of ledger lines @lpugin? Maybe by adding a verovio option such as --color-ledger-lines-as-note might work (should also work for chords).

Screenshot 2023-05-30 at 6 02 16 PM
Click to view MEI data for above example
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="https://music-encoding.org/schema/dev/mei-all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<mei xmlns="http://www.music-encoding.org/ns/mei" meiversion="5.0.0-dev">
 <meiHead>
  <fileDesc>
   <titleStmt>
    <title />
   </titleStmt>
   <pubStmt />
  </fileDesc>
  <encodingDesc>
   <appInfo>
    <application isodate="2023-05-30T18:03:36" version="3.16.0-dev-b62cd9f-dirty">
     <name>Verovio</name>
     <p>Transcoded from Humdrum</p>
    </application>
   </appInfo>
  </encodingDesc>
  <workList>
   <work>
    <title />
   </work>
  </workList>
 </meiHead>
 <music>
  <body>
   <mdiv xml:id="mjwj3tb">
    <score xml:id="s1eybwzi">
     <scoreDef xml:id="s1edwjv1">
      <staffGrp xml:id="si7c6ug">
       <staffDef xml:id="staffdef-L1F1" n="1" lines="5">
        <clef xml:id="c1t15tkf" shape="G" line="2" />
       </staffDef>
      </staffGrp>
     </scoreDef>
     <section xml:id="section-L1F1">
      <measure xml:id="measure-L1">
       <staff xml:id="staff-L1F1" n="1">
        <layer xml:id="layer-L1F1N1" n="1">
         <note xml:id="note-L3F1" dur="4" oct="4" pname="c" accid.ges="n" />
         <note xml:id="note-L4F1" dur="4" oct="4" pname="d" accid.ges="n" />
         <note xml:id="note-L5F1" dur="4" oct="4" pname="e" accid.ges="n" />
         <note xml:id="note-L6F1" dur="4" oct="4" pname="f" accid.ges="n" />
        </layer>
       </staff>
      </measure>
      <measure xml:id="measure-L7">
       <staff xml:id="staff-L7F1N1" n="1">
        <layer xml:id="layer-L7F1N1" n="1">
         <note xml:id="note-L9F1" dur="4" oct="4" pname="c" color="transparent" accid.ges="n" />
         <note xml:id="note-L10F1" dur="4" oct="4" pname="d" color="transparent" accid.ges="n" />
         <note xml:id="note-L11F1" dur="4" oct="4" pname="e" color="transparent" accid.ges="n" />
         <note xml:id="note-L12F1" dur="4" oct="4" pname="g" color="transparent" accid.ges="n" />
        </layer>
       </staff>
      </measure>
     </section>
    </score>
   </mdiv>
  </body>
 </music>
</mei>

I think it would be good to to create *invis and *Xinvis to be mapped to *color:transparent and *color:black. Then yy would not need to be added to every note that needs to be invisible (this could also be used for **dynam and **text).

@craigsapp Should I implement this for HumdrumInput::insertGBeam as well?

Yes, that would be good (otherwise there will be unattached grace beams like there were with regular beams).

If the purpose of making the music invisible is for students to composite the missing music, then there is a question of security since the notes are still present in the MEI/SVG data and they might eventually figure that out... In that case maybe add *blank and *Xblank which will convert notes into invisible rests.

@lpugin lpugin requested a review from craigsapp June 6, 2023 08:50
@lpugin
Copy link
Contributor

lpugin commented Jun 17, 2023

@craigsapp could you review this and the other one? Thanks

@WolfgangDrescher
Copy link
Contributor Author

Commit 47616c3 fixes the same bug for grace notes

Before:

Bildschirmfoto 2023-06-19 um 11 43 55

After:

Bildschirmfoto 2023-06-19 um 11 44 09

Data:

**kern
16bqLyy
16ddqJyy
1cc
*-

@WolfgangDrescher
Copy link
Contributor Author

Having something like *blank does seem useful. But there is no urgent need for me right now. Same for *invis as it is currently easier to add yy to all data tokens with shed than adding an additional tandem interpretation in the browser.

(Maybe we should add a new filter that allows adding new tandem interpretations.)

@WolfgangDrescher WolfgangDrescher marked this pull request as ready for review June 19, 2023 10:09
@WolfgangDrescher WolfgangDrescher changed the base branch from develop to develop-humdrum June 19, 2023 10:11
@craigsapp craigsapp merged commit 3bb2fff into rism-digital:develop-humdrum Jun 19, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants