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 (i.e. "do" in a fixed-do system) to
the tonic of the current key, so that

\key a \major
\movableDo { do re mi fa so }


will produce the same output as

\key a \major

a b cs d e


Of course, it would be possible to require the user to repeat the key
information, by writing this:

\key a \major

\movableDo a { do re mi fa so }

But this is inconveniently redundant, and makes errors more likely in large
source files, since the key must now be written in many different places.
So I'm trying to avoid doing it this way if possible.)

In any case, I'm having a very difficult time figuring out how a music
function can get access to the key. It seems that the issue is that the key
is a context property; music functions do not take a context as an
argument, and thus can't get access to context properties the way a
function written with make-apply-context could. But I can't see how to get
around that limitation, or indeed whether it would be possible to get
around it at all.

Suggestions?

-Leah
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to