[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?
From: |
Han-Wen Nienhuys |
Subject: |
Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme? |
Date: |
Sun, 17 Feb 2008 16:32:04 -0200 |
2008/2/13, Reinhold Kainhofer <address@hidden>:
> 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 - address@hidden - http://www.xs4all.nl/~hanwen
- Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Reinhold Kainhofer, 2008/02/13
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?,
Han-Wen Nienhuys <=
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Reinhold Kainhofer, 2008/02/17
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Nicolas Sceaux, 2008/02/18
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Mats Bengtsson, 2008/02/19
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Nicolas Sceaux, 2008/02/19
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Han-Wen Nienhuys, 2008/02/20
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Han-Wen Nienhuys, 2008/02/18
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Reinhold Kainhofer, 2008/02/19
- Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?, Han-Wen Nienhuys, 2008/02/20