lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme variables and chordmode


From: Gilles THIBAULT
Subject: Re: Scheme variables and chordmode
Date: Mon, 3 Mar 2008 23:20:34 +0100

dostroke = #(define-music-function (parser location chord length)
(ly:music? num
ber?)
        #{
                \chordmode { e,$length:5.8 }
        #}
)

------------------------------------------------------------

        I presume you can all see what I'm trying to achieve here.
However, I
can't get it to work, [...]

You cannot use the parameter "length" as a number because in something like
c4. , the 4. is not a number (because of the dot)
But, using the \makeRhythm  of this snippet :
   http://lsr.dsi.unimi.it/LSR/Item?id=390
and redefining the \transpose function,
you can have something like that :


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.11.40"
\include "rhythm.ly "             %% see the snippet to build this file.

transposeAlt = #(define-music-function (parser location note music)
(ly:music? ly:music?)
(
   let* (
       (from (ly:make-pitch 0 0 0))
       (to (ly:music-property (car (ly:music-property note 'elements))
'pitch))
       (delta (ly:pitch-diff to from))
    )
    (ly:music-transpose music delta)
))

dostroke = #(define-music-function (parser location chord lengthStr )
(ly:music? string?)
#{
       \transposeAlt $chord \makeRhythm  \chordmode { c4:5.8 } $lengthStr
#}
)

                                %%%%%%%%%%%%%%%%%%%%%


\dostroke e' "2."

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Gilles.





reply via email to

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