-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to specify a set of variants at run time? #72
Comments
I see two approaches that you might check out. Ideally you'd test them, and if they work I'll either include them in the functionality or at least in the documentation. Command line optionsHave a look at http://lilypond.org/doc/v2.21/Documentation/usage/command_002dline-usage#advanced-command-line-options-for-lilypond. This shows how you can pass arbitrary options to LilyPond, for example
Within a LilyPond file you can access its value with #(ly:get-option 'sourceID) I think LIlyPond will print a warning about an unknown command line option, so while this has no negative impact I wouldn't consider it completely clean. Please note that I haven't tested this, and you should properly check it out. I'm not sure whether it's possible to register known command line options on the Scheme level (I don't recall to what conclusion I have once come with this topic). If that's possible I might add something to the scholarLY package itself because your use case seems generic enough. Evaluate a Scheme ExpressionHave a look at the |
Thanks, that helps, but I’m mainly having trouble understanding how to get |
Again, I can't currently test it and have to rely on the manual myself ;-) What you will want to do is \setOption scholarly.choice.preferences.variants "draft" and replace Given my example in the previous comment the following should work as desired: \setOption scholarly.choice.preferences.variants #(ly:get-option 'dsourceID) Does that work? |
I’m wondering if there’s a way to write one centralised function that all the occurrences of |
That's what the |
I just saw your last comment. But isn’t |
Ah, that's something completely different. I'd have to think about how that can be matched on a conceptual level. The To properly think about it I'd have to know a little more about the editorial concept you are after concretely. |
I’m using |
OK, I see, sounds good and reasonable. Probably the current interface doesn't support this out-of-the-box, and I'll have to think about it. "llemma" and "reading" are what they are I'd say, and when you want to override the editor's choice then you will have to add an ID to each choice instance where you will want to allow individual overrides. (It might be possible to write an external script to auto-generate such IDs for speciific or all types of choice, but that is something one would have to run on the input files externally.) If I understand your use case correctly then your user (or the user interface) has to produce a potentially large list of IDs which will not fit nicely with the idea of passing to the command line. In that case I'd look for a solution where this list is written to an auxiliary file, and LilyPond reads that file to populate its list. It seems this calls for an implementation within the package, not for a solution on the user-side. I'll have to consider this, not knowing really when I'll have the time ... |
You’re right, an auxiliary file would be better. For now it’s no problem, I can fake it using LilyPond tags for a demo, and we could talk about it some more whenever you have time to think about it. |
I would like to write a score that allows the user to choose a custom set of variants to be rendered at run time. In the scholarLY docs, it looks like
\choice variants
can be configured so that it always chooses the reading from onesource
, which is set globally. Instead, what I'd like is to give each reading a unique ID, and let the user specify at run time a set of reading IDs, as command-line arguments tolilypond
. The specified readings could come from different sources. Then each\choice variants
would check whether it has a reading with one of the specified IDs. If so, it would output that reading. If not, it would output the default reading given aslemma
. Is there a way to do this already?The text was updated successfully, but these errors were encountered: