[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Doing \score { <<...>... } and \context Staff << .... >> in scheme?

From: Reinhold Kainhofer
Subject: Doing \score { <<...>... } and \context Staff << .... >> in scheme?
Date: Wed, 13 Feb 2008 15:29:00 +0100
User-agent: KMail/1.9.7

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: Unknown # object: #\" 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 <<
    \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 Kainhofer, Vienna University of Technology, Austria
email: address@hidden,
 * Financial and Actuarial Mathematics, TU Wien,
 * K Desktop Environment,, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien",

Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]