For accordion music sheet notation it is common to specify the pitches in parenthesis, e.g. (E in parenthesis in the snippet below). This is my target:
The pitches in parenthesis (1) are not played and should not take up additional logical time in a measure (they are used for player's convenience when reading the music sheet), (2) they should stay near the chord.
My LilyPond code now is as follows:
\version "2.18.2"
\include "deutsch.ly"
#(set-global-staff-size 20.0)
\relative c {
\clef bass
e8 <gis d' e>^7 h, q
\override Stem.details.beamed-lengths = #'(0)
\grace \parenthesize e
\revert Stem.details
e <gis d' e> gis, q
\override Stem.details.beamed-lengths = #'(0)
\grace \parenthesize e'
\revert Stem.details
}
Using lilypond --pdf sample.ly
I get the following as a result:
The result I obtain in LilyPond has several problems: (i) stem length has no effect on grace notes, (ii) grace note is moved to the next bar and ideally it should stay near the chord, (iii) the parenthesis are too small (although it is a minor remark).
How can I achieve the desired effect (i.e. as in the first picture) using LilyPond?
P.S. edit:
I was able to create a workaround (see below), which is not elegant, but does the job:
\version "2.18.2"
\include "deutsch.ly"
#(set-global-staff-size 20.0)
\relative c {
\clef bass
e8 <gis d' e>^7 h, \afterGrace q
{
\override Stem.thickness = #-1.0
\parenthesize e4
\revert Stem.thickness
}
e8 <gis d' e> gis,_B \afterGrace q
{
\override Stem.thickness = #-1.0
\parenthesize e'4
\revert Stem.thickness
}
}
The output of the above snippet is as follows:
Is there a better way to achieve it?
Instead of using \override Stem.thickness = #-1.0
, a more elegant solution would be to use the stencil
property. This property can be used to omit stems, flags, note heads, etc. Also, you can use the statement \once \override <something>
if you want to override just a single note/chord and automatically revert back after it. Finally, you can also define a musical function to take care of all of this automatically, particularly if you are using this construction often. In this example below, the arguments are the note/chord immediately before the grace note and the grace note itself, see:
\version "2.18.2"
\include "deutsch.ly"
#(set-global-staff-size 20.0)
accordionGrace = #(define-music-function
(parser location firstNote secondNote)
(ly:music? ly:music?)
#{
\afterGrace
$firstNote
{
\once \override Stem.stencil = ##f
\once \override Flag.stencil = ##f
\parenthesize $secondNote
}
#}
)
\relative c {
\clef bass
e8 <gis d' e>^7 h,
\accordionGrace q e8
e8 <gis d' e> gis,_B
\accordionGrace q e'8
}