lilypond-user
[Top][All Lists]
Advanced

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

Creating an ly:pitch? value


From: Richard Shann
Subject: Creating an ly:pitch? value
Date: Sun, 20 Jul 2014 18:04:34 +0100

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)))
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.
As you may guess, the code is intended to be generated programmatically
(from Denemo), which may limit the available solutions.

Any ideas?

Richard Shann





reply via email to

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