2013/3/30 luis jure <l...@internet.com.uy>

>
>
> hello list,
>
> i created a custom drum staff, where the bass drum uses the laThin note
> head (simplified example, not my actual staff):
>
>
> \version "2.17.14"
>
> #(define mydrums '(
> (bassdrum       laThin  #f      -1)
> ))
>
> \new DrumStaff \with {
> \override StaffSymbol #'line-count = #2
> drumStyleTable = #(alist->hash-table mydrums)
> }
> \drummode { bd8 bd bd2. }
>
>
> now, lilypond chooses a black or white note head (s0, s1 or s2) depending
> on the note duration. but i want to force the use of a white note head
> (noteheads.s0laThin) for all notes, independently of their duration. is it
> possible to do that in the definition of the drumstaff?
>
> i came up with a funtion:
>
> mbd =
> #(define-music-function
> (parser location dur)
> (ly:duration?)
> #{
> \drummode {
>   \tweak NoteHead.stencil #ly:text-interface::print
>   \tweak NoteHead.text
>   \markup \musicglyph #"noteheads.s0laThin"
> bd$dur }
> #})
>
> then this works:
>
> \drummode { \mbd8. \mbd16 r16 \mbd8. }
>
> but i don't know if it is well written. is there an easier/better way? any
> way that i could do that in the drumstaff definition?
>
>
> best,
>
>
> lj
>

Hi Luis,

every function/definition which does what you want is nice. :)

If my own approach is the best possible,  I don't know as well.

Though, if you want to insert sth in \with or \layout you may try the code
below.

It sets 'duration-log 0 if the NoteHead is 'laThin _and_ if it is caused by
using 'bassdrum.
To show that the function distinguishs between different drum-types, a new
definition for hihat is added to `mydrums´
If you don't want this limitation delete the relevant part from the
if-condition.

\version "2.17.12"

alwaysPrintWholeLaThinBassDrum =
\override NoteHead #'duration-log =
  #(lambda (grob)
     (let* ((style (ly:grob-property grob 'style))
            (grob-probs (ly:grob-properties grob))
            (cause (assoc-get 'cause grob-probs))
            (drum-type (ly:prob-property cause 'drum-type)))

     ;; If laThin-NoteHead for bassdrum is detected,
     ;; change duration-log, else default.
     (if (and (eq? style 'laThin) (eq? drum-type 'bassdrum))
         (ly:grob-set-property! grob 'duration-log 0)
         (note-head::calc-duration-log grob))))

#(define mydrums
  '(
    (bassdrum       laThin  #f      -1)
    (hihat laThin  #f      3)
   ))

\new DrumStaff
  \with {
    \override StaffSymbol #'line-count = #2
    drumStyleTable = #(alist->hash-table mydrums)
    \alwaysPrintWholeLaThinBassDrum
  }

\drummode { bd8 bd  bd2. hh1 hh2 hh4 hh8 hh }


HTH,
  Harm
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to