[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Creating an ly:pitch? value
From: |
David Kastrup |
Subject: |
Re: Creating an ly:pitch? value |
Date: |
Sun, 20 Jul 2014 20:29:02 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
Richard Shann <address@hidden> writes:
> In music which has a commentary the commentary often refers to excerpts
> from the main music. When the main music is transposed it is sometimes
> desirable that the music excerpts in the commentary should have the same
> transposition.
> To save editing these separately I would like to create a music function
> which would be invoked before both the music and any excerpts and would
> apply a given transposition.
>
> I have got as far as this, for transposing up a semitone as in
> \transpose c cis
>
> \version "2.18.0"
>
> #(define denemo-transpose (ly:make-pitch 0 0 (/ 1 2)))
You can write 1/2 instead of (/ 1 2) here. In 2.19.0, you can actually
write
#(define denemo-transpose #{ cis #})
but I am afraid that this interpretation is not available in 2.18.0
> myfunc = #(define-music-function
> (parser location arg)
> (ly:music?)
> #{
> \transpose c' #denemo-transpose #arg
> #})
>
>
> {c' d' e'
> \myfunc
> {c' d' e'}}
>
> As you can see I have defined a global variable denemo-transpose to be
> the pitch that c' should be transposed to.
> My problem is that the syntax for ly:make-pitch is difficult to
> generate, but I can't seem to find anything to convert a string like
> "cis'" to an ly:pitch? datum.
You could try
denemo-transpose = cis'
--
David Kastrup