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. I tried generate-score = #(define-music-function (parser location piece instr) (string string) #{ \score { << #(eval (string->symbol (string-append piece instr #"Staff"))) >> \header { piece = #(eval (string->symbol (string-append piece #"PieceName"))) } >> } #} ) But that does not work and results in an error message, which is not helpful at all: lisp_score.ly:34:62: Unknown # object: #\" lisp_score.ly:31:14: Fehler: syntax error, unexpected '-', expecting '=' scr = #(define-music-function (parser location piece instr) (string string) ) Attached is my current attempt. The other lilypond code that I want to auto-generate by scheme is IChorFlIIStaff = \context Staff = IChorFlIISt << \clefFlII \context Voice = IChorFlIIVoice { \IChorSettings\IChorKey\IChorFlII } \set Staff.instrumentName = \instrumentFlII \set Staff.shortInstrumentName = \shortInstrumentFlII >> Again, the \IChorFlII will be generated from the passed strings, and the same for the instrument names. Thanks a lot, Reinhold -- ------------------------------------------------------------------ Reinhold Kainhofer, Vienna University of Technology, Austria email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/ * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/ * K Desktop Environment, http://www.kde.org, KOrganizer maintainer * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
\version "2.11.39" IChorSettings = \notemode { \time 3/4 } IChorPieceName = "Nr. 1 TEST" IChorPieceNameTacet = "Nr. 1 tacet" IChorFlI = \relative c' { <c e g>4 r2 g' a8 r8 r4\bar"|." } clefFl = \clef "tenor" IChorKey = \notemode { \key g \major } IChorFlIStaff = \context Staff = IChorFlISt << \clefFl \context Voice = IChorFlIVoice { \IChorSettings\IChorKey\IChorFlI } \set Staff.instrumentName = "Flauto I" \set Staff.shortInstrumentName = "Fl. I" >> IChorFlIScore = \score { << \IChorFlIStaff >> \header { piece = \IChorPieceName } } % This is the lilypond code, which I want to generate in scheme: \score { << \IChorFlIStaff >> \header { piece = \IChorPieceName } } % My attempts of a scheme function to generate the score: scr = #(define-music-function (parser location piece instr) (string string) #{ \score { << #(eval (string->symbol (string-append piece instr #"Staff"))) >> \header { piece = #(eval (string->symbol (string-append piece #"PieceName"))) } } #} ) % Call to that function: \scr #"IChor" #"FlI"
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user