ssb22 / jianpu-ly

Jianpu in Lilypond
http://ssb22.user.srcf.net/mwrhome/jianpu-ly.html
Apache License 2.0
70 stars 18 forks source link

after grace with \< and \! will get a warning when process midi #9

Closed lianghongzhuo closed 3 years ago

lianghongzhuo commented 3 years ago

after grace with \< and ! will get a warning when process midi

example:

1=D
2/4
q1. \< ( s1 ) q1. ( s1 [2]g ) \!

warning message:

Parsing...
test.ly:128:135: warning: Unattached SlurEvent
    \new Staff { \new Voice="midi" { \transpose c d { \key c \major  \time 2/4 c'8. \< ( c'16 ) c'8. (  \afterGrace { c'16 } { d'16 } 
                                                                                                                                      ) \! } } }

expect behavior: should not have this warning output.

ssb22 commented 3 years ago

Just a warning? On lilypond 2.18.2 it's an error.

The reason why Lilypond doesn't like this is, the ) and the \! should both be inside the braces of the afterGrace, i.e. it should be { d'16 ) \! } not { d'16 } ) \!

jianpu-ly currently passes all \ and slur/tie commands directly to Lilypond without checking if their positions should change. I should probably change the word.startswith("\\") logic to check out[-1] for afterGrace (if out is non-empty of course), and, when this is the case, add the extra command to the appropriate part of out[-1] instead of appending to out.

lianghongzhuo commented 3 years ago

Thanks for the explanation! And in lilypond 2.20 it's only a warning. The output midi and pdf are as expected.

ssb22 commented 3 years ago

fixed in 1.44

lianghongzhuo commented 3 years ago

Thanks for the fix!