Am 12.02.2015 um 17:00 schrieb takumi ikeda:
Hi Kevin,
Thank you for your reply. But the part of "(if (= UP dir) -0.5 0.5)"
seems to not working...

BTW, How can I learn the syntax like "(ly:duration-log
(ly:music-property music 'duration))"? I found the documentation
lilypond.org/doc/v2.19/Documentation/internals/scheme-functions but it
says only "Function: ly:duration-log dur". Is "dur" an data type?
Where is the reference of "dur"?
“dur” serves as a placeholder for an argument. You should find it again in the explanatory text on the function, which is sometimes very short. In fact, the argument referenced here as “dur” is of type ly:duration? – that’s the data type. Durations may be created through the scheme function ly:make-duration.

HTH, Simon

2015-02-12 22:13 GMT+09:00 Kevin Barry <barr...@gmail.com>:
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 <i...@de-dicto.net> 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
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

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


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

Reply via email to