[Top][All Lists]

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

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

From: Reinhold Kainhofer
Subject: Re: Doing \score { <<...>... } and \context Staff << .... >> in scheme?
Date: Sun, 24 Feb 2008 02:12:12 +0100
User-agent: KMail/1.9.6

Am Samstag, 23. Februar 2008 schrieb Han-Wen Nienhuys:
> 2008/2/21, Reinhold Kainhofer <address@hidden>:
> >  > \makeScore "Test" { c'4 d' e' f' g'1 }
> >
> > Dang, that looked so promising!
> >  It worked fine in all my tests, until I started switching my orchestral
> > score to my own createscore function... The problem is that cue notes do
> > not appear in the score!!!
> See scm/lily-library.scm , function scorify-music.  You need to run
> toplevel-music-functions over the music first.
> Without this,  << \\ >> also doesn't work.

Thanks a lot! Simply replacing ly:make-score by scorify-music does the trick 
(although due to the need of the parser variable this cannot be used inside a 
define'd function returning the score, but only inside a void music function, 
which also schedulles the score to the typeset... But then, in my case, this 
is just fine, I'm generating the scores only on the fly whenever I really 
want to print them out).

> >  Apparently your makeScore function is not exactly the same as
> >  \score {
> Correct. If you want to know what lily is up to, best is to look at
> lily/parser.yy, where you can see the scorify-music call in the
> score_body rule.

Thanks for the hint. 

Now, my next problem is that if my createscore function is called within a 
\book block, I'd need to use book-score-handler instead of 
Is there an easy way to detect wheter we are inside a book block?
From parser.yy I see that lilypond does not explicitly check this, but uses 
the implicit context information from the parser instead...

The other issue I'm running into now is: How can I call a music-function from 
within another music-function? I haven't found any example for this in the 
docs or the LSR...

As an example, here I define a music function that does nothing and another 
one that just calls the first one:

identity = #(define-music-function (parser location music) (ly:music?) music)
otheridentity = #(define-music-function (parser location music) (ly:music?) 
(identity parser location music))
\otheridentity {c'1}

However, I always get an error message: In expression (identity parser 
location ...): Wrong type to apply: #<Music function 
#<procedure #f (parser location music)>>


Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden,
 * Financial and Actuarial Mathematics, TU Wien,
 * K Desktop Environment,, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien",

reply via email to

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