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
680 stars 185 forks source link

fingering #803

Closed sannedubois closed 6 years ago

sannedubois commented 6 years ago

Is it possible to have also fingerings rendered in verovio, by default at the left side of each notes? I attached a chord with fingerings. Fingerings used on chord might take too much vertical space if you place in below or above the notes. As music xml 3.0 my example is exported as:

    <notations>
      <technical>
        <fingering default-y="-31" font-size="10.25" relative-x="-10">1</fingering>
        <fingering default-y="-46" font-size="10.25" relative-x="-10">2</fingering>
        <fingering default-y="-20" font-size="10.25" relative-x="-10">3</fingering>
        <fingering default-y="-8" font-size="10.25" relative-x="-10">3</fingering>
        <fingering default-y="5" font-size="10.25" relative-x="-10">4</fingering>
      </technical>
    </notations>

Often a music font like Petrucci is used for this.

craigsapp commented 6 years ago

Similar to issue https://github.com/rism-ch/verovio/issues/725

But this is also related to styling of the finger numbers: placing numbers above, below, before, after a note:

screen shot 2018-03-13 at 8 46 55 am

Automatic placement of fingerings is difficult in the general case, particularly for piano music. For example the fingerings 2, 4, and 5 at the end of this example:

screen shot 2018-03-13 at 8 37 04 am

are placed underneath the notes so that they do not disrupt the layout of the beam and slur above the notes (keeping the music more readable). Also the finger numbers are both placed off and on the staff.

sannedubois commented 6 years ago

Solution of fingerings could be to place them always exactly at the left of a note, like your example:

piano_example

​But, this would mean that you need more horizontal place. How many items can you have in between the width of the page? Even without fingerings in an extreme example:

collissions

​So you can think of automatically break the bar in two pieces. If you don't you will probably not like the solution of having the fingerings placed next to the notes. These 2 functionalities are linked. ​

2018-03-13 16:46 GMT+01:00 Craig Stuart Sapp notifications@github.com:

Similar to issue #725 https://github.com/rism-ch/verovio/issues/725

But this is also related to styling of the finger numbers: placing numbers above, below, before, after a note:

[image: screen shot 2018-03-13 at 8 46 55 am] https://user-images.githubusercontent.com/3487289/37352548-b829e57e-269a-11e8-907c-fdbe28bda183.png

Automatic placement of fingerings is difficult in the general case, particularly for piano music. For example the fingerings 2, 4, and 5 at the end of this example:

[image: screen shot 2018-03-13 at 8 37 04 am] https://user-images.githubusercontent.com/3487289/37351906-54d5bc7e-2699-11e8-8dbb-04d65ac1fc6e.png

are placed underneath the notes so that they do not disrupt the layout of the beam and slur above the notes (keeping the music more readable). Also the finger numbers are both placed off and on the staff.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rism-ch/verovio/issues/803#issuecomment-372712738, or mute the thread https://github.com/notifications/unsubscribe-auth/APa0E_N_28mGHLHlnuBOzGF_HLMTpXouks5td-nigaJpZM4SoibL .

craigsapp commented 6 years ago

Here is an example MusicXML from MuseScore with fingering:

First, as typeset in MuseScore:

screen shot 2018-03-14 at 10 20 42 am

Then exporting to a MusicXML file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise>
  <work>
    <work-title>Title</work-title>
    </work>
  <identification>
    <creator type="composer">Composer</creator>
    <encoding>
      <software>MuseScore 2.1.0</software>
      <encoding-date>2018-03-14</encoding-date>
      <supports element="accidental" type="yes"/>
      <supports element="beam" type="yes"/>
      <supports element="print" attribute="new-page" type="yes" value="yes"/>
      <supports element="print" attribute="new-system" type="yes" value="yes"/>
      <supports element="stem" type="yes"/>
      </encoding>
    </identification>
  <defaults>
    <scaling>
      <millimeters>7.05556</millimeters>
      <tenths>40</tenths>
      </scaling>
    <page-layout>
      <page-height>1683.36</page-height>
      <page-width>1190.88</page-width>
      <page-margins type="even">
        <left-margin>56.6929</left-margin>
        <right-margin>56.6929</right-margin>
        <top-margin>56.6929</top-margin>
        <bottom-margin>113.386</bottom-margin>
        </page-margins>
      <page-margins type="odd">
        <left-margin>56.6929</left-margin>
        <right-margin>56.6929</right-margin>
        <top-margin>56.6929</top-margin>
        <bottom-margin>113.386</bottom-margin>
        </page-margins>
      </page-layout>
    <word-font font-family="FreeSerif" font-size="10"/>
    <lyric-font font-family="FreeSerif" font-size="11"/>
    </defaults>
  <credit page="1">
    <credit-words default-x="1134.19" default-y="1501.67" justify="right" valign="bottom" font-size="12">Composer</credit-words>
    </credit>
  <credit page="1">
    <credit-words default-x="595.44" default-y="1626.67" justify="center" valign="top" font-size="24">Title</credit-words>
    </credit>
  <part-list>
    <score-part id="P1">
      <part-name>Piano</part-name>
      <part-abbreviation>Pno.</part-abbreviation>
      <score-instrument id="P1-I1">
        <instrument-name>Piano</instrument-name>
        </score-instrument>
      <midi-device id="P1-I1" port="1"></midi-device>
      <midi-instrument id="P1-I1">
        <midi-channel>1</midi-channel>
        <midi-program>1</midi-program>
        <volume>78.7402</volume>
        <pan>0</pan>
        </midi-instrument>
      </score-part>
    </part-list>
  <part id="P1">
    <measure number="1" width="171.84">
      <print>
        <system-layout>
          <system-margins>
            <left-margin>-0.00</left-margin>
            <right-margin>555.42</right-margin>
            </system-margins>
          <top-system-distance>195.00</top-system-distance>
          </system-layout>
        </print>
      <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 default-x="75.17" default-y="-40.00">
        <pitch>
          <step>E</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>1</fingering>
            </technical>
          </notations>
        </note>
      </measure>
    <measure number="2" width="113.75">
      <note default-x="12.00" default-y="-30.00">
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>2</fingering>
            </technical>
          </notations>
        </note>
      </measure>
    <measure number="3" width="113.75">
      <note default-x="12.00" default-y="-30.00">
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>1</fingering>
            </technical>
          </notations>
        </note>
      <note default-x="12.00" default-y="-15.00">
        <chord/>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>2</fingering>
            </technical>
          </notations>
        </note>
      <note default-x="12.00" default-y="0.00">
        <chord/>
        <pitch>
          <step>F</step>
          <octave>5</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>3</fingering>
            </technical>
          </notations>
        </note>
      </measure>
    <measure number="4" width="122.75">
      <note default-x="12.00" default-y="-30.00">
        <pitch>
          <step>G</step>
          <octave>4</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>1</fingering>
            </technical>
          </notations>
        </note>
      <note default-x="12.00" default-y="-15.00">
        <chord/>
        <pitch>
          <step>C</step>
          <octave>5</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>2</fingering>
            </technical>
          </notations>
        </note>
      <note default-x="12.00" default-y="10.00">
        <chord/>
        <pitch>
          <step>A</step>
          <octave>5</octave>
          </pitch>
        <duration>4</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering>5</fingering>
            </technical>
          </notations>
        </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
        </barline>
      </measure>
    </part>
  </score-partwise>

The <fingering> elements do not contain positioning information, so loading back into MuseScore places the fingerings automatically:

screen shot 2018-03-14 at 10 21 38 am

Likewise, loading the MusicXML file generated by MuseScore into Finale requires automatic placement of the fingerings (which is not very good):

screen shot 2018-03-14 at 10 23 22 am

Manually repositioning the fingerings in Finale:

screen shot 2018-03-14 at 10 25 22 am

And then exporting MusicXML from Finale will preserve the positions (as in Derk's analysis):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE score-partwise PUBLIC "-//Recordare//DTD MusicXML 3.0 Partwise//EN" "http://www.musicxml.org/dtds/partwise.dtd">
<score-partwise version="3.0">
  <movement-title>Title</movement-title>
  <identification>
    <creator type="composer">Composer</creator>
    <encoding>
      <software>Finale v25 for Mac</software>
      <encoding-date>2018-03-14</encoding-date>
      <supports attribute="new-system" element="print" type="yes" value="yes"/>
      <supports attribute="new-page" element="print" type="yes" value="yes"/>
      <supports element="accidental" type="yes"/>
      <supports element="beam" type="yes"/>
      <supports element="stem" type="yes"/>
    </encoding>
  </identification>
  <defaults>
    <scaling>
      <millimeters>7.0273</millimeters>
      <tenths>40</tenths>
    </scaling>
    <page-layout>
      <page-height>1691</page-height>
      <page-width>1195</page-width>
      <page-margins type="even">
        <left-margin>57</left-margin>
        <right-margin>57</right-margin>
        <top-margin>57</top-margin>
        <bottom-margin>114</bottom-margin>
      </page-margins>
      <page-margins type="odd">
        <left-margin>57</left-margin>
        <right-margin>57</right-margin>
        <top-margin>57</top-margin>
        <bottom-margin>114</bottom-margin>
      </page-margins>
    </page-layout>
    <system-layout>
      <system-margins>
        <left-margin>0</left-margin>
        <right-margin>0</right-margin>
      </system-margins>
      <system-distance>103</system-distance>
      <top-system-distance>60</top-system-distance>
    </system-layout>
    <appearance>
      <line-width type="stem">0.7487</line-width>
      <line-width type="beam">5</line-width>
      <line-width type="staff">0.7487</line-width>
      <line-width type="light barline">0.7487</line-width>
      <line-width type="heavy barline">5</line-width>
      <line-width type="leger">0.7487</line-width>
      <line-width type="ending">0.7487</line-width>
      <line-width type="wedge">0.7487</line-width>
      <line-width type="enclosure">0.7487</line-width>
      <line-width type="tuplet bracket">0.7487</line-width>
      <note-size type="grace">60</note-size>
      <note-size type="cue">60</note-size>
      <distance type="hyphen">120</distance>
      <distance type="beam">8</distance>
    </appearance>
    <music-font font-family="Maestro,engraved" font-size="19.9"/>
    <word-font font-family="Times New Roman" font-size="10"/>
  </defaults>
  <credit page="1">
    <credit-words default-x="1139" default-y="1502" font-family="FreeSerif" font-size="12" justify="right" valign="bottom">Composer</credit-words>
  </credit>
  <credit page="1">
    <credit-words default-x="598" default-y="1633" font-family="FreeSerif" font-size="24" justify="center" valign="top">Title</credit-words>
  </credit>
  <part-list>
    <score-part id="P1">
      <part-name>Piano</part-name>
      <part-name-display>
        <display-text font-family="FreeSerif">Piano</display-text>
      </part-name-display>
      <part-abbreviation>Pno.</part-abbreviation>
      <part-abbreviation-display>
        <display-text font-family="FreeSerif">Pno.</display-text>
      </part-abbreviation-display>
      <score-instrument id="P1-I1">
        <instrument-name>Piano</instrument-name>
      </score-instrument>
      <midi-instrument id="P1-I1">
        <midi-channel>1</midi-channel>
        <midi-program>1</midi-program>
        <volume>79</volume>
        <pan>0</pan>
      </midi-instrument>
    </score-part>
  </part-list>
  <!--=========================================================-->
  <part id="P1">
    <measure number="1" width="181">
      <print>
        <system-layout>
          <system-margins>
            <left-margin>0</left-margin>
            <right-margin>555</right-margin>
          </system-margins>
          <top-system-distance>195</top-system-distance>
        </system-layout>
        <measure-numbering>system</measure-numbering>
      </print>
      <attributes>
        <divisions>2</divisions>
        <key>
          <fifths>0</fifths>
          <mode>major</mode>
        </key>
        <time>
          <beats>4</beats>
          <beat-type>4</beat-type>
        </time>
        <clef>
          <sign>G</sign>
          <line>2</line>
        </clef>
      </attributes>
      <sound tempo="120"/>
      <note default-x="83">
        <pitch>
          <step>E</step>
          <octave>4</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering default-x="-12" default-y="-47" placement="below">1</fingering>
          </technical>
        </notations>
      </note>
    </measure>
    <!--=======================================================-->
    <measure number="2" width="111">
      <note default-x="13">
        <pitch>
          <step>G</step>
          <octave>4</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering default-x="5" default-y="6" placement="above">2</fingering>
          </technical>
        </notations>
      </note>
    </measure>
    <!--=======================================================-->
    <measure number="3" width="111">
      <note default-x="13">
        <pitch>
          <step>G</step>
          <octave>4</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering default-x="-9" default-y="-37" placement="below">1</fingering>
            <fingering default-x="-8" default-y="-17" placement="above">2</fingering>
            <fingering default-x="-10" default-y="3" placement="above">3</fingering>
          </technical>
        </notations>
      </note>
      <note default-x="13">
        <chord/>
        <pitch>
          <step>C</step>
          <octave>5</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
      </note>
      <note default-x="13">
        <chord/>
        <pitch>
          <step>F</step>
          <octave>5</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
      </note>
    </measure>
    <!--=======================================================-->
    <measure number="4" width="123">
      <note default-x="16">
        <pitch>
          <step>G</step>
          <octave>4</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
        <notations>
          <technical>
            <fingering default-x="4" default-y="19" placement="above">1</fingering>
            <fingering default-x="5" default-y="33" placement="above">2</fingering>
            <fingering default-x="5" default-y="48" placement="above">5</fingering>
          </technical>
        </notations>
      </note>
      <note default-x="16">
        <chord/>
        <pitch>
          <step>C</step>
          <octave>5</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
      </note>
      <note default-x="16">
        <chord/>
        <pitch>
          <step>A</step>
          <octave>5</octave>
        </pitch>
        <duration>8</duration>
        <voice>1</voice>
        <type>whole</type>
      </note>
      <barline location="right">
        <bar-style>light-heavy</bar-style>
      </barline>
    </measure>
  </part>
  <!--=========================================================-->
</score-partwise>

The positions look correct, but when loading the MusicXML back into Finale, the position information is mostly ignored:

screen shot 2018-03-14 at 10 29 37 am

And loading the Finale export of MusicXML into MuseScore, the fingering positions will be ignored and they will be autoplaced, also pretty poorly:

screen shot 2018-03-14 at 10 31 09 am
craigsapp commented 6 years ago

Here are examples of fingering by C.P.E. Bach in his sonata (Wq 63/5), end of the second movement:

screen shot 2018-03-14 at 10 17 05 am
sannedubois commented 6 years ago

When you do the first bar like this and you use zapfdingbats asa font for the string notation, it is possible in my earlier suggested approach:

finale 2011:

piano_example2

music xml with string-symbols as <word> and fingering as <technical><fingering> tags.

Assuming multiple voices on 1 staff I placed the stringsymbols on beam-side.

So a fragment of music xml showing both:

        <beam number="1">begin</beam>
        <beam number="2">begin</beam>
        <notations>
          <technical>
            <fingering default-y="-9" font-size="10.25" relative-x="-14">2</fingering>
            <fingering default-y="-22" font-size="10.25" relative-x="-14">3</fingering>
          </technical>
        </notations>
      </note>
      <direction placement="above">
        <direction-type>
          <words default-y="51" font-family="Zapf Dingbats" font-size="15.4">¬</words>
        </direction-type>
        <staff>1</staff>
      </direction>
lpugin commented 6 years ago

Cannot be solved until MEI fingering are implemented

craigsapp commented 6 years ago

Temporary hack is possible via Humdrum with this commit https://github.com/rism-ch/verovio/commit/517056a0df29109dce6477e6c2f595abed6bc707

screen shot 2018-03-22 at 4 51 32 pm

Generated from the Humdrum data:

**kern  **fing
*clefG2 *
*M4/4   *
=1  =1
4c  1
4d  2
4e  3
4f  1
=2  =2
4g  2
4a  3
4b  4
4cc 5
=2  =2
4b  4
4a  3
4g  2
4f  1
=2  =2
4e  3
4d  2
2c  1
==  ==
*-  *-

And mapped into <dir> rather than <fing> for now.

sannedubois commented 6 years ago

I think it's a good solution as long as string symbols are not used for chords and polyfony: there might be confusion with regard to which string is connected to which finger.

2018-03-22 16:57 GMT+01:00 Craig Stuart Sapp notifications@github.com:

Temporary hack is possible via Humdrum with this commit 517056a https://github.com/rism-ch/verovio/commit/517056a0df29109dce6477e6c2f595abed6bc707

[image: screen shot 2018-03-22 at 4 51 32 pm] https://user-images.githubusercontent.com/3487289/37781918-fc6ee80c-2df1-11e8-94de-4935b0db2bc5.png

Generated from the Humdrum data:

kern fing clefG2 M4/4 =1 =1 4c 1 4d 2 4e 3 4f 1 =2 =2 4g 2 4a 3 4b 4 4cc 5 =2 =2 4b 4 4a 3 4g 2 4f 1 =2 =2 4e 3 4d 2 2c 1 == == - -

And mapped into

rather than for now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/rism-ch/verovio/issues/803#issuecomment-375358856, or mute the thread https://github.com/notifications/unsubscribe-auth/APa0E1M0_8jiSvxhrO-fXktkIxxkWL4Dks5tg8n1gaJpZM4SoibL .

lpugin commented 6 years ago

Generic request