rism-digital / verovio

🎵 Music notation engraving library for MEI with MusicXML and Humdrum support and various toolkits (JavaScript, Python)
https://www.verovio.org
GNU Lesser General Public License v3.0
687 stars 185 forks source link

Support for rendering non-standard key signatures #148

Closed alastair closed 5 years ago

alastair commented 9 years ago

We're investigating verovio for rendering turkish makam music. One of our requirements is for makam style key signatures - which include half- and quarter- sharps and flats:

screenshot from 2015-09-25 18-29-33 screenshot from 2015-09-25 18-30-14

@sertansenturk tells me that these symbols are available in smufl, however I had a quick look at the key signature rendering code and it looks like this type of keysignature isn't possible yet (https://github.com/rism-ch/verovio/blob/610951c81be20c111ea59bdbf99e4e6111cbffde/src/keysig.cpp#L26)

Do you think it would be possible to support these accidentals easily?

I'm still investigating the work required to convert our scores (in a custom KERN-like format :https://github.com/MTG/SymbTr/tree/master/mu2) to mei.

lpugin commented 9 years ago

I am not sure how the key signature should be encoded in MEI, but are you thinking of have something like:

<staffDef>
    <keySig>
        <keyAccid accid="xf">
    </keySig>
</staffDef>

(with the appropriate accid value)?

Supporting this would actually be quite easy. For now only @key.sig is read in staffDef, but everything is in place for supporting <keySig>. You would need to add keyAccid element support and reading them. You would then need to modify the rendering method and to add the SMuFL glyphs, but this is basically it. I can provide you with more information on all of this.

Regarding the conversion, you might want to look at a fork of @craigsapp and contact him. https://github.com/craigsapp/verovio/blob/master/src/iohumdrum.cpp https://github.com/craigsapp/verovio/blob/master/include/vrv/iohumdrum.h I am not sure this would be useful to you, but just in case.

lpugin commented 5 years ago

This is now implemented

<keySig>
  <keyAccid pname="b" accid="1qf"/>
  <keyAccid pname="f" accid="s"/>
</keySig>

image