[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; ; ) |
-----BEGIN PGP SIGNED MESSAGE-----
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.
> <http://repo.or.cz/w/nenuvar.git> file common/includes.ily
Hmm, to me it seems that you are effectively calling the parser to interpret
\include "file.ly". 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
scheme.
The code (stripped-down to the relevant parts) is basically (see
orchestrallily.ily in the git repo http://repo.or.cz/w/orchestrallily.git):
% 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?
list?)
(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
- --
- ------------------------------------------------------------------
Reinhold Kainhofer, address@hidden, http://reinhold.kainhofer.com/
* Financial & Actuarial Math., Vienna Univ. of Technology, Austria
* http://www.fam.tuwien.ac.at/, DVR: 0005886
* LilyPond, Music typesetting, http://www.lilypond.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
iD8DBQFKiKdLTqjEwhXvPN0RAteSAJ9jZs1+TsPQpe0RSkgTJIfclSKDTQCdGu1H
efJt+xny+C7WWg74NpLRWb0=
=15lu
-----END PGP SIGNATURE-----
- Creating books with Scheme, Reinhold Kainhofer, 2009/08/14
- Re: Creating books with Scheme, Nicolas Sceaux, 2009/08/16
- Re: Creating books with Scheme,
Reinhold Kainhofer <=
- Re: Creating books with Scheme, Reinhold Kainhofer, 2009/08/29
- Re: Creating books with Scheme, Nicolas Sceaux, 2009/08/29
- [PATCH] Re: Creating books with Scheme, Reinhold Kainhofer, 2009/08/29
- Re: [PATCH] Re: Creating books with Scheme, Carl Sorensen, 2009/08/29
- Re: [PATCH] Re: Creating books with Scheme, Nicolas Sceaux, 2009/08/30