Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Lilypond grace note affects formatting

Tags:

lilypond

When I start this piece with a grace note, it messes up formatting: bad formatting

Code:

\version "2.18.2"

\header {
    title = "Sonata in D Major"
    composer = "Joseph Haydn"
    opus = "Hob. XVI/37"
}

\language "english"

upper = \relative c'' {
    \clef treble
    \key d \major
    \time 4/4

    r4 r8 <cs a'> <d gs>( <cs a'>) <d gs>( <cs a'>) %m1
}

lower = \relative c {
    \clef treble
    \key d \major
    \time 4/4

    \grace gs''8( a-!) a,-! a-! a-! b(\trill a) b(\trill a)
}

\score {
    \new PianoStaff <<
        \set PianoStaff.instrumentName = #"Piano  "
        \new Staff = "upper" \upper
        \new Staff = "lower" \lower
    >>
    \layout { }
    \midi { }
}

If I remove the \grace indication, it works (but of course, without the grace note):

good format

How can I use this grace note while keeping the correct formatting? Is this a bug with Lilypond?

like image 321
MCMastery Avatar asked Feb 07 '23 02:02

MCMastery


1 Answers

This is a knnown problem but there is a workaround: just add a spacer grace note ( \grace s8 ) at the upper staff, before the r4 rest.

\grace s8 r4 r8 <cs a'> % etc

lilypond output sample

A fix for the problem is proposed to be investigated this summer during Google GSoC, see http://lilypond.org/google-summer-of-code.html

like image 143
Paco Avatar answered May 15 '23 20:05

Paco