2008/2/13, Reinhold Kainhofer <[EMAIL PROTECTED]>:
> Hi all,
>
> In the large vocal and orchestral piece that I'm currently typesetting, I have
> lots of score and staff definitions, which look exactly the same, except for
> the variable names. Thus it would make tremendous sense to not hard-code
> them, but generate them on the fly by some scheme function. Unfortunately,
> all my attempts so far have failed...
>
>
> In particular, what is the scheme equivalent, producing the same as the
> following lilypond code?
>
> IChorObIScore = \score {
> << \IChorObIStaff >>
> \header { piece = \IChorPieceName }
> }
>
> I simply want a scheme function "generate-intrument-score piece instr", which
> I would then call as
> \generate-instrument-score #"IChor" #"ObI"
>
> Tha scheme function would then use
> (string->symbol (string-concat piece instr #"Staff"))
> to generate \IChorObIStaff and (eval (string->symbol....)) to insert the
> definition of \IChorObIStaff. So, basically, all I need is how to generate
> the \score { <<...>> } in scheme.
You have to use the scheme bindings. There is a ly:make-score
function. 2.11.40 adds a ly:score-add-output-def function that will
allow you define a piece of music
> generate-score = #(define-music-function (parser location piece instr)
> (string string)
> #{
> \score {
IIRC #{ can only contains music expressions.
> << #(eval (string->symbol (string-append piece instr #"Staff"))) >>
Inside scheme the # before a string is not necessary.
--
Han-Wen Nienhuys - [EMAIL PROTECTED] - http://www.xs4all.nl/~hanwen
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user