|
From: | David Nalesnik |
Subject: | Re: Accessing context properties (e.g. the current key) from a music function? |
Date: | Thu, 30 Apr 2015 18:23:39 -0500 |
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 \majora b cs d eOf course, it would be possible to require the user to repeat the key information, by writing this:\key a \majorBut 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.)\movableDo a { do re mi fa so }
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.
[Prev in Thread] | Current Thread | [Next in Thread] |