lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme problem?


From: Kevin Barry
Subject: Re: Scheme problem?
Date: Thu, 12 Feb 2015 13:13:16 +0000

Hi Takumi,

Is this what you want?

\version "2.18.2"

tremps = #"
2 setlinewidth
0.07 0.07 scale
-10 7 moveto
-5 3 5 3 10 7 curveto
-10 -7 lineto
-5 -3 5 -3 10 -7 curveto
stroke
"

z-trem =
#(define-music-function (parser location music) (ly:music?)
   #{
     \override StemTremolo.stencil =
     #(lambda (grob)
        (let* (
                (dur-log (ly:duration-log (ly:music-property music 'duration)))
                (dir (ly:grob-property grob 'direction))
                )
          (grob-interpret-markup grob
            (markup
             (
               #:translate (cons 0 (if (= 0 dur-log)
                                       0
                                       (if (= UP dir) -0.5 0.5)))
               #:postscript tremps
               )
             )
            )
          )
        )
     $music
   #}
   )


\new Staff {
  \z-trem
  c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
}

On Thu, Feb 12, 2015 at 12:44 PM, takumi ikeda <address@hidden> wrote:
Hello all,

I am trying the following code but I got "Wrong type: ()" error.
I would like to avoid translating tremolos when the note is whole note.
Writing Scheme is quite difficult for me. Any help would be appreciated.

Takumi

>>

\version "2.18.2"

tremps = #"
2 setlinewidth
0.07 0.07 scale
-10 7 moveto
-5 3 5 3 10 7 curveto
-10 -7 lineto
-5 -3 5 -3 10 -7 curveto
stroke
"

z-trem =
#(define-music-function (parser location music) (ly:music?)
   #{
     \override StemTremolo.stencil =
     #(lambda (grob)
        (let* (
                (dur-log (ly:grob-property grob 'duration-log))
                (dir (ly:grob-property grob 'direction))
                )
          (grob-interpret-markup grob
            (markup
             (
               #:translate (cons 0 (if (= 0 dur-log) 0
                                       (if (= UP dir) -0.5 0.5)))
               #:postscript tremps
               )
             )
            )
          )
        )
     $music
   #}
   )


\new Staff {
  \z-trem
  c'1:32 c''8: f'16: g':  c''8: c'4: c''16:
}

_______________________________________________
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user


reply via email to

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