grame-cncm / libmusicxml

A C/C++ library to support the MusicXML format.
Mozilla Public License 2.0
152 stars 33 forks source link

Fingering position offset problem #48

Open zhwei8090 opened 2 years ago

zhwei8090 commented 2 years ago

Guidoeditor has a fingering offset problem

test_4.xml.zip seen at finale: image

{[ \staff<1> \set<autoHideTiedAccidentals="on"> \title<"test"> \composer<"test", dy=4hs> \auto<autoInstrPos="on"> \instr<"MusicXML Part"> \accol<id=0, range="1-2"> \barFormat<style= "system", range="1-2"> 
   (* meas. 1 *)  \clef<"g2"> \key<0> \meter<"4/4", autoBarlines="off", autoMeasuresNum="system"> \stemsUp \beamBegin:1 \fingering<dy=8hs, dx=0.4, text="5">( c2/8)
 \stemsUp b1/8 \stemsUp a1/8 \stemsUp g1/8 \beamEnd:1 \stemsUp \beamBegin:1 \fingering<dy=10hs, dx=0.6, text="1">( f1/8)
 \stemsUp \fingering<dy=8.6hs, dx=1.4, text="3">( e1/8)
 \stemsUp \fingering<dy=9.6hs, dx=0.4, text="2">( d1/8)
 \stemsUp \fingering<dy=10.6hs, dx=0.6, text="1">( c1/8)
 \beamEnd:1 ]
 , 
[ \staff<2> \set<autoHideTiedAccidentals="on"> \barFormat<style= "system", range="2"> 
   (* meas. 1 *)  \clef<"f4"> \key<0> \meter<"4/4", autoBarlines="off", autoMeasuresNum="system"> _/1 ]
}
zhwei8090 commented 2 years ago

This problem is more obvious, don't you guys notice it?

arshiacont commented 2 years ago

@zhwei8090 Fingering position is full of bugs in MusicXML especially when they come from later versions of Finale (and other software is worse).

In the last LibMusicXML's xml2guido, I decided to take full fingering positions into account since in the prior version we were simply ignoring them and stacking them vertically. This was ofcourse ok for simple scores but was avoiding all other cases (such as fingerings on left/right of a note, mix of below/above etc.).

As a consequence, in a Private Fork of GuidoLib I fixed the GRFingering positions for this purpose. I need to clean that up and submit a PR in GuidoLib for that. Feel free to use my Fork and see if it's any better (use antescofo-master branch on https://github.com/Antescofo/guidolib)

A part from that, in our experience we see horizontal offsets in fingerings which is probably due to a bug in Finale MusicXML encoder (just be aware of that).

dfober commented 2 years ago

Note that the guido engine has the ability to automatically position fingering above or below the notes. It supports chords fingering too using commas. See at https://guidodoc.grame.fr/refs/tags/Text/#fingering

arshiacont commented 2 years ago

@dfober What is missing in the Automatic Positioning of Fingering is a Left/Right placement (it only accepts above or below). Here, I am inferring dx/dy from MusicXML by default and it was not coming out coherently in GuidoLib, hence my modifications in my Fork. I need to clean them up and submit a PR on GuidoLib.

zhwei8090 commented 2 years ago

@arshiacont Yes, I also optimized the fingering position before, until this update, I found that you have changed it too, so I used your PR, I also tend to be able to determine the position based on dx/dy