Thanks so much, Jérôme! I think I understand the syntax there, but I
can't actually get it to work. I will try to explain, now that I have
more time, exactly what I am attempting.
I am working on a multi-movement orchestral score. I want to be able to
print a final score using bookparts, but while I work on each movement,
I want to render it in isolation. I don't expect to publish the separate
movements, so I don't care if they are perfect, but I need them to play
and render as I am working. I will eventually need to make parts too,
but at the moment I'm not thinking that far ahead.
So, here is my file structure:
FullScore.ly - this contains \version and \paper, and then it defines
variables title, composer, etc. Then, it includes the first movement's
.ly; then it resets title, composer, etc. to \null so that they won't be
repeated on each movement.
Now, each movement is an .ly file too, e.g. movtI.ly - in this, I set
movtTitle, I set global key, time, and tempo, and a var for midiTempo.
Then I set each instrument's music as a music block, e.g.
scoreAFlute = \relative c'' {
\global
...
}
Finally, at the end of the movt. file I include "score_def.ly"
score_def.ly is a single file, having info that is shared for every
movement. It defines instruments and assigns the previously set music to
them, e.g.
scoreAFlutePart = \new Staff \with {
instrumentName = "Flute"
shortInstrumentName = "Fl."
midiInstrument = "flute"
} \scoreAFlute
Then it sets a \bookpart, which contains a \header and two \scores - one
for display rendering, and one for midi rendering (uses articulate.ly)
This is where I am having the problem - I say it's all the same for
every file, but the one thing that is different is that the header
elements are unique - those are delivered as variables in the \header
block. This is fine, in the structure as above, when I render the full
score. But if I try to render a single movement, the variables are not
defined, so I get an error. That's why I was hoping to either a) set the
variable in the movt.ly file, like title = \title || "", or b) do that
right in the score_def, so that in the header I could just do title =
\title || "", So I tried your solution, and I keep getting an error -
I've tried putting it in various places, and changing the syntax every
way I can think of, but it's always an error.
Of course, I AM AN IDIOT - I just moved the variables from the fullscore
into each movt.ly file, and set them all to "" except the first movt.,
and I get exactly what I want. So, no real problem - I just was not
thinking clearly before I guess. BUT, I would still love to find out how
to do this, as I know it will come up again in some other context.
At any rate, thanks again for trying to help - I really appreciate it!
On 8/4/2015 8:23 AM, Jérôme Plût-2 [via Lilypond] wrote:
> Pridie Nonas Augustas MMXV scripsit unlabeled :
>
> > Thank you all so much, i'm just getting into lilypond and trying to
> figure
> > out how to make it work for my workflow. i have a solution i like to
> this,
> > or similar, issue, which i will share soon. meanwhile, i have a
> question
> > that will help me finish it:
> > is there such a thing as a null0if, or a ternary operator that can
> be used
> > inline? I want to do something like this:
> >
> > \header {
> > title = \title
> > }
> >
> > but if \title hasn't been defined (because I'm running an ily
> outside its
> > container), then it fails. Would like to do something like title =
> \title ||
> > "" (to borrow javascript syntax - use \title var if it exists, else
> use an
> > empty string).
> >
> > I guess if not, I can write a scheme function, but haven't delved
> into that
> > yet, and trying to figure out the simplest approach.
>
> I think the easiest way is to scheme it:
> (warning, I cannot test the code below right now):
>
> #(if (not (defined? 'title)) (set! title ""))
>
> You can even meta-scheme it:
>
> #(define (define-default symbol)
> (if (not (defined? symbol)) (module-add! (current-module) symbol "")))
>
> #(map define-default '(title subtitle instrument composer))
>
>
> _______________________________________________
> lilypond-user mailing list
> [hidden email] </user/SendEmail.jtp?type=node&node=179263&i=0>
> https://lists.gnu.org/mailman/listinfo/lilypond-user
>
>
> ------------------------------------------------------------------------
> If you reply to this email, your message will be added to the
> discussion below:
> http://lilypond.1069038.n5.nabble.com/Pull-in-external-LilyPond-files-into-a-score-of-movements-tp161839p179263.html
>
>
> To unsubscribe from Pull in external LilyPond files into a score of
> movements, click here
> <http://lilypond.1069038.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=161839&code=aXJhc2hraW5AZ21haWwuY29tfDE2MTgzOXwxMzk0NDAzNzIw>.
> NAML
> <http://lilypond.1069038.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
>
--
View this message in context:
http://lilypond.1069038.n5.nabble.com/Pull-in-external-LilyPond-files-into-a-score-of-movements-tp161839p179275.html
Sent from the User mailing list archive at Nabble.com.
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user