[Top][All Lists]

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

Re: Creating books with Scheme

From: Reinhold Kainhofer
Subject: Re: Creating books with Scheme
Date: Mon, 17 Aug 2009 02:41:47 +0200
User-agent: KMail/1.11.4 (Linux/2.6.28-14-generic; KDE/4.2.4; i686; ; )

Hash: SHA1

Am Sonntag, 16. August 2009 18:52:59 schrieb Nicolas Sceaux:
> Le 14 août 09 à 21:40, Reinhold Kainhofer a écrit :
> > Does anyone have any idea how I can insert a scheme score
> > into the current book using only scheme without the parser?
> I'm doing that with my own framework.
> <> file common/includes.ily

Hmm, to me it seems that you are effectively calling the parser to interpret 
\include "". That is a nice way around my problem, where only the parser 
seems to have a pointer to the current book (so you are invoking the parser to 
insert the scores into the bookpart), but it can't be used in my case.

My problem is that I don't have the score in a file in lilypond syntax at all. 
I have only the notes of the individual instruments, but the whole score 
(containing part-combined staves, etc.) is really generated on-the-fly in 

The code (stripped-down to the relevant parts) is basically (see 
orchestrallily.ily in the git repo

% The helper function to build a score.
#(define (oly:createScoreHelper parser location piece children func)
  (let* (
         (music    (oly:staff_group_handler to create the list of staves))
         (score     '())
         (header    '())
      ; No staves, print tacet
      ; we have staves, apply the piecename to the score and add layout/midi
      ; blocks if needed
        (set! score (scorify-music music parser))
        (oly:set_piece_header score piecename)
        (oly:apply_score_midi score)
        (oly:apply_score_layout score)
        ; Schedule the score for typesetting
        (oly:add-score parser score piecename)
  ; This is a void function, the score has been schedulled for typesetting
  (make-music 'Music 'void #t)

createScore = #(define-music-function (parser location piece children) (string? 
  (oly:createScoreHelper parser location piece children identity)

So, the whole score object is really generated in scheme. The issue is that I 
don't know what function to call to insert that score into the current book, 
rather than the toplevel scores (i.e. what should I use instead of oly:add-
score? Currently, that function simply calls (toplevel-score-handler parser 
score) ). Or the other solution would be to have a way to get the current book 
object, so that I can pass this to the book-score-handler function.

Thanks a lot,
- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, address@hidden,
 * Financial & Actuarial Math., Vienna Univ. of Technology, Austria
 *, DVR: 0005886
 * LilyPond, Music typesetting,
Version: GnuPG v1.4.9 (GNU/Linux)


reply via email to

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