lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to display a rim shot


From: Aaron Hill
Subject: Re: How to display a rim shot
Date: Mon, 10 Sep 2018 09:31:00 -0700
User-agent: Roundcube Webmail/1.3.6

On 2018-09-09 4:46 pm, OTIS DOSS III wrote:
As my subject indicates, I want to display a rim shot, which is
typically indicated by a note with a diagonal slash:

I've searched the documentation, but I can't find out how to do this.
Can this been done?  And how?  Thanks times infinity in advance for
any help.

Hi Bill,

Would something like the following help?

%%%%
\version "2.19.82"

slash-over-note = #(lambda (grob)
  (let* ((note (ly:note-head::print grob))
         (x-extent (ly:stencil-extent note X))
         (y-extent (ly:stencil-extent note Y))
         (scaling (magstep (ly:grob-property grob 'font-size 0.0)))
(slash (ly:make-stencil (list 'draw-line 0.15 0 1.5 1.5 0) '(0 . 1.5) '(0 . 1.5)))
         (transformed (ly:stencil-translate
           (ly:stencil-scale (centered-stencil slash) scaling scaling)
(cons (interval-center x-extent) (interval-center y-extent))))
         (combined (ly:stencil-add note transformed)))
    (ly:make-stencil (ly:stencil-expr combined) x-extent y-extent)))

rhythms = \drummode { snare 4 8 8 2 }
\score { << \new DrumStaff { \rhythms
  \override NoteHead.stencil = #slash-over-note \rhythms
  \revert NoteHead.stencil \rhythms
} >> }
%%%%

-- Aaron Hill

Attachment: rimshot.cropped.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]