stephband / scribe

Renders music in HTML.
https://labs.cruncher.ch/scribe
614 stars 24 forks source link

Add clefs `treble8up` and `treble8down` #22

Closed udit99 closed 3 months ago

udit99 commented 4 months ago

When I represent the note E2 in the treble clef using the following code

    <scribe-music type="sequence">
      0 E2  0.2 1
  </scribe-music>

I expect to see

image

but I see

image

How can I show the bottom bars?

stephband commented 4 months ago

Currently the treble clef grid supports notes C3–A6, with C4 rendering as middle C, as defined in classes/stave/treble.css. There is no treble clef -8ve, but I do intend to add one.

Also, I think there also may be a bug in downward ledger lines at the moment, but I am about to do a huge merge because we have been working hard on supporting SMuFL fonts (instead of rendering hundreds of svgs from defs), and once that is merged in (tomorrow, probably) I will be testing everything over again and I will make sure ledger lines work.

I am changing the title of this issue to a feature request for treble clefs -8ve and +8ve, which should be relatively easy to add. In case you want to try adding them yourself –

1) Create the files:

classes/stave/treble8up.css
classes/stave/treble8down.css

...and update their contents using treble8up and treble8down as the class names.

2) @import them in:

classes/stave.css

3) In:

modules/staves.js

...copy the export const treble = {...} definition and export the copies as treble8up and treble8down, editing their note maps accordingly.

(Ignore modules/stave.js, it is the beginnings of stave constructor, but is not yet used.)

Done. That should allow you to write:

<scribe-music type="sequence" clef="treble8down">...</scribe-music>

And get what you want. When I have the SMuFL fonts branch merged in it will give us glyphs for treble clefs with the little number 8s.

udit99 commented 4 months ago

Thank you for the prompt response. I ended up going with a different solution for now but I'll come back to this the next time I need sheet music support.