The problem arises because \applyContext is evaluated later than
\transpose. When music functions do their work, contexts have not been
created yet,
The output shows that the original binding of k is in effect when
\transpose is called.
Aha! Thank you — that makes sense.
Hi Leah,
On Thu, Apr 30, 2015 at 7:28 PM, Leah Velleman leah.velle...@gmail.com
wrote:
To do something like you want, you really would need access to context
properties
Ok — good to know I haven't missed some simple solution.
It seems like there ought to be some way of smuggling
On Fri, May 1, 2015 at 7:48 AM, David Nalesnik david.nales...@gmail.com
wrote:
test =
#(define-music-function (parser location music) (ly:music?)
(let ((k ERROR))
#{
\applyContext
#(lambda (context)
(set! k (ly:context-property context 'tonic))
I'm looking to write a \transpose-like music function that will need to be
able to find out what the current key is.
(In case it matters: The reason I'm doing this is to make it possible to
enter music using movable-do solfege. The idea is to have a function
\movableDo that will transpose from C
On Thu, Apr 30, 2015 at 6:41 PM, David Nalesnik david.nales...@gmail.com
wrote:
P.S. Now I'm going to set out to break it...
Well, with simultaneous music you do end up having to repeat the key.
\test
\new PianoStaff
\new Staff
\new Voice {
\key re \major
\voiceOne
Oh goodness, something heinous happened to the formatting there. Let me try
that again.
k = ERROR
test = #(define-music-function (parser location music) (ly:music?)
#{
\applyContext
#(lambda (context)
(set! k (ly:context-property context 'tonic))
(display k)
)
Ah! I hadn't even gotten as far as thinking about key-change events
*within* the scope of the music function, though you're right that those
would be an issue too (and your suggestion looks like a sensible way of
dealing with them).
What I was trying to get at was the key that was current before
Leah,
On Thu, Apr 30, 2015 at 6:34 PM, Leah Velleman leah.velle...@gmail.com
wrote:
Ah! I hadn't even gotten as far as thinking about key-change events
*within* the scope of the music function, though you're right that those
would be an issue too (and your suggestion looks like a sensible way
Hi Leah,
On Thu, Apr 30, 2015 at 3:16 PM, Leah Velleman leah.velle...@gmail.com
wrote:
I'm looking to write a \transpose-like music function that will need to be
able to find out what the current key is.
(In case it matters: The reason I'm doing this is to make it possible to
enter music
Hi Harm,
On Thu, Apr 30, 2015 at 6:36 PM, Thomas Morley thomasmorle...@gmail.com
wrote:
2015-05-01 1:23 GMT+02:00 David Nalesnik david.nales...@gmail.com:
%%
\version 2.18
\language italiano % the closest preset :)
test =
#(define-music-function
To do something like you want, you really would need access to context
properties
Ok — good to know I haven't missed some simple solution.
It seems like there ought to be some way of smuggling information out of an
\applyContext. But I guess there's a variable scope issue that keeps you
2015-05-01 1:23 GMT+02:00 David Nalesnik david.nales...@gmail.com:
Hi Leah,
On Thu, Apr 30, 2015 at 3:16 PM, Leah Velleman leah.velle...@gmail.com
wrote:
I'm looking to write a \transpose-like music function that will need to be
able to find out what the current key is.
(In case it
12 matches
Mail list logo