[Top][All Lists]

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

Re: Custom drum noteHead in define expression

From: Thomas Morley
Subject: Re: Custom drum noteHead in define expression
Date: Wed, 4 Apr 2018 02:39:58 +0200

2018-04-03 18:25 GMT+02:00 Karim Haddad <address@hidden>:

> And thanx also for your snippet. I have already tried it and works 
> marvelously.
> But concerning customizing new note heads i think checking the code itself 
> seems necessary.
> Do you know if define-grobs.scm is a good place to start with ?

Well, some scheme-knowledge is needed.
There is a scheme-tutorial in the docs. Several guile tutorials out
there, as well as the guile manual.
Best general training is reading this list, though, trying to
understand the requests and trying to solve them.
If you read someones code, try to understand what happens and why, can
it be improved and ...

The Extending Manual is not bad as well.
I remember as a starter I did several exercises, defining several
custom-markup-command, markup-list-commands, substitution functions
etc etc
Homework, like a decade ago, but I'm still learning ;)

If you try to solve an own problem searching the archives is always a
good starting point.

On topic.
There's something annoying happening while using custom-styles. I just
wrote a bug-report about it:

So with the workaround, in the bug-report as well you could do:

\version "2.19.81"

#(define mydrums '(
         (bassdrum        myStyle   #f           -1)
         (snare           myStyleII   #f           0)
         (hihat           cross     #f           1)
         (halfopenhihat   cross     "halfopen"   1)
         (pedalhihat      xcircle   "stopped"    2)
         (lowtom          diamond   #f           3)))

#(define stencil-for-my-style
  (lambda (grob)
      ((eq? 'myStyle (ly:grob-property grob 'style))
          (ly:grob-set-property! grob 'style '())
          (grob-interpret-markup grob
              \markup \vcenter \musicglyph #"pedal.*"
      ((eq? 'myStyleII (ly:grob-property grob 'style))
          (ly:grob-set-property! grob 'style '())
          (grob-interpret-markup grob
%% from
%% slightly changed
               \markup \vcenter \scale #'(0.4 . 0.4) {
                     \translate #(cons -1.25 0) \combine
                       \draw-circle #0.65 #0 ##t
                       \override #'(thickness . 2.5) \draw-line #'(3 . -3)
                     \translate #(cons 1.25 0) \combine
                       \draw-circle #0.65 #0 ##t
                       \override #'(thickness . 2.5) \draw-line #'(-3 . -3)
      (else (ly:note-head::print grob)))))

\new DrumStaff
  \with {
    drumStyleTable = #(alist->hash-table mydrums)
    \override NoteHead.stencil = #stencil-for-my-style
  \drummode {

You may want to adjust stem-attachment.
I leave it as an exercise ;)


reply via email to

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