[Top][All Lists]

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

Re: calling a music variable using a Scheme function

From: Nicolas Sceaux
Subject: Re: calling a music variable using a Scheme function
Date: Thu, 3 Sep 2009 21:15:15 +0200

Le 3 sept. 09 à 10:47, Valentin Villenave a écrit :

On Fri, Jul 24, 2009 at 10:51 AM, Nicolas Sceaux<address@hidden > wrote:
includeList =
#(define-music-function (parser location variable-names) (list?)
  (map (lambda (variable-name)
         (let ((music (ly:parser-lookup parser (string->symbol
            (if (ly:music? music)
                (make-music 'Music))))

Hi Nicolas,

I've been trying to implement something based on your recent
discussion with Reinhold; I have a few questions though:
- why does scorify-music fail here?
- how can I add a \header block for each \score produced (I can't
figure out where to insert an add-text in this snippet)?

Reinhold has answered your questions.

As for why I use top level markup instead of score headers:
I don't generate scores as Reinhold does, and using a
\header block in an explicit \score is a bad idea when your
score is included at several places: you may not want to have
the same title.

Using current git, your example can be expressed as follows:

\include ""

Prologue = \relative {do re mi fa}
Ouverture = \relative {sol'1 }
Entracte = \relative {si''2 si}

#(define (make-this-music name)
    (let ((music (ly:parser-lookup parser name)))
      (if (ly:music? music)
          (make-music 'Music 'void #t))))

includeList =
#(define-music-function (parser location variable-names) (list?)
   (map (lambda (variable-name)
          (let* ((music (make-this-music variable-name))
                 (score (scorify-music music parser))
                 (layout (ly:output-def-clone $defaultlayout))
                 (header (make-module))
(title (markup #:large (symbol->string variable- name))))
            (module-define! header 'piece title)
            (ly:score-set-header! score header)
            (ly:score-add-output-def! score layout)
            (add-score parser score)))
    (make-music 'Music 'void #t))

\includeList #'(Prologue Ouverture Entracte Dummy)

reply via email to

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