lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme problem?


From: Simon Albrecht
Subject: Re: Scheme problem?
Date: Thu, 12 Feb 2015 22:58:37 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

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 <address@hidden>:
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

_______________________________________________
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]