lilypond-user
[Top][All Lists]
Advanced

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

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


From: Nicolas Sceaux
Subject: Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?
Date: Mon, 18 Feb 2008 21:12:11 +0100


Le 18 févr. 08 à 00:17, Reinhold Kainhofer a écrit :

Am Sonntag, 17. Februar 2008 schrieb Han-Wen Nienhuys:
2008/2/13, Reinhold Kainhofer <address@hidden>:
In particular, what is the scheme equivalent, producing the same as the
following lilypond code?

IChorObIScore = \score {
 << \IChorObIStaff >>
 \header { piece = \IChorPieceName }
}

You have to use the scheme bindings. There is a ly:make-score
function.

Thanks for the hint... Works so far (see attached example).

However, how can I define a function so that instead of scheme, i.e.
    \score { #(createscore "test") }
i can simply do:
    % This does NOT work (syntax error)
    \score { \createscore #"test"}
or even better:
    \createscore #"test"

Now that this works more or less, how can I set 'header:piece only for this
score? I tried ly:prob-set-property! and ly:context-set-property!, but
neither works. Which type of object is a score?

A score is a Score :-)

Have you considered using a toplevel markup instead of
\header { piece = ... }?
Then, if you don't need to specify a custom \layout block for your
generated score (which would need to explicitely create a score),
defining a score can be as easy as writing:

  \generateScore "Some title" { ..some music.. }

Example:

generateScore =
#(define-music-function (parser location title music)
                        (string? ly:music?)
  ;; add a toplevel markup for the piece title
  (collect-scores-for-book parser
    (list (markup #:huge #:fill-line (title))))
  ;; no page break between the title and the score
  (collect-music-for-book parser
   (make-music 'Music
               'page-marker #t
               'page-break-permission 'forbid))
  ;; the score music itself
  music)

\generateScore "The title" { c'4 d' e' f' g'1 }

This adds a top-level markup, a top-level noPageBreak between the
title and the music, and a toplevel music expression, which is used
to automatically create a score. The staff is automatically
created too. (Lots of automatically. Lily rocks.)

2.11.40 adds a ly:score-add-output-def function that will
allow you define a piece of music

What exactly does that do? There's no description, and the only use is in the incipit example inside a lambda function used as a stencil definition. That's
wayyyy above my head with regards to lilypond internals.

It programmaticaly attaches a \layout block to a score. That way,
you can change, say, the indentation, or the ragged-right property
of a programmaticaly generated score.

nicolas





reply via email to

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