Re: Custom percussion style is ignored for the first note when it is a grace note

David Kastrup <[email protected]>
Newsgroups gmane.comp.gnu.lilypond.bugs
Message-ID <[email protected]>
Stu McKenzie <[email protected]> writes:

> There seems to have been various reports of bugs when the first note
> is a grace note, but this bug has been in many LilyPond versions to
> date.
>
> When the first note of a drum score has a grace note, LilyPond outputs
> the default note, rather than the custom percussion style.
>
> In this case, \acciaccatura is used to create each grace note - main
> note combination.
>
> Here's a "Tiny example":
>
> \version "2.24.0"
> #(define mydrums '( (hightom default #f 3)))
> \score {
>   \new DrumStaff <<
>     \set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
>     \new DrumVoice { \voiceTwo \drummode { \partial 2 \acciaccatura
> tomh8 tomh4 \acciaccatura tomh8 tomh4 } }
>   >>
> }

This is not a bug.  You specify you _want_ simultaneous music by using
<< ... >> and the settings of DrumStaff.drumStyleTable are performed
_on_ the beat while the grace notes are performed _before_ the beat.

This is _exactly_ as you tell LilyPond you want things to happen.  If
you want to have things to happen in sequence, you have to write them in
sequence.

Using { ... } instead of << ... >> here probably gives something closer
to your expectations.

Now for things that _pervade_ a context rather than switch around, it
makes sense not to set them at the first time step but generally, by
using a \with block:

\version "2.24.0"
#(define mydrums '( (hightom default #f 3)))
\score {
  \new DrumStaff \with { drumStyleTable = #(alist->hash-table mydrums) }
  {
    \new DrumVoice { \voiceTwo \drummode { \partial 2 \acciaccatura tomh8 tomh4 \acciaccatura tomh8 tomh4 } }
  }
}

-- 
David Kastrup
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.