Le 27/02/2022 à 09:50, Pierre-Yves Saumont a écrit :
Hi,
The Lilypond documentation says that any lilypond code can be use in a
Scheme function by enclosing it in a #{ ... #} block, but it seems
\include doesn't work in this case.
I am building a program to handle multiple Big Band scores. I need to
extract parts for each instrument (16 to 22) and for all titles in a
given program (10 - 15).
At this time, here is what I do:
\include "../Doxy/Doxy_music.ly"
\include "partAltoI.ly"
\include "../Alfie/Alfie_music.ly"
\include "partAltoI.ly"
\include "../CestSiBon/CestSiBon_music.ly"
\include "partAltoI.ly"
\include "../BeyondTheSea/BeyondTheSea_music.ly"
\include "partAltoI.ly"
\include "../CloseToYou/CloseToYou_music.ly"
\include "partAltoI.ly"
.
.
.
include "../Doxy/Doxy_music.ly"
\include "partAltoII.ly"
\include "../Alfie/Alfie_music.ly"
\include "partAltoII.ly"
\include "../CestSiBon/CestSiBon_music.ly"
\include "partAltoII.ly"
\include "../BeyondTheSea/BeyondTheSea_music.ly"
\include "partAltoII.ly"
\include "../CloseToYou/CloseToYou_music.ly"
\include "partAltoII.ly"
.
.
.
include "../Doxy/Doxy_music.ly"
\include "partTenorI.ly"
\include "../Alfie/Alfie_music.ly"
\include "partTenorI.ly"
\include "../CestSiBon/CestSiBon_music.ly"
\include "partTenorI.ly"
\include "../BeyondTheSea/BeyondTheSea_music.ly"
\include "partTenorI.ly"
\include "../CloseToYou/CloseToYou_music.ly"
\include "partTenorI.ly"
.
.
.
This is tedious, and I would like to be able to simply have to enter
the list of titles:
Doxy
Alfie
CestSiBon
BeyondTheSea
CloseToYou
.
.
.
and the list of instruments:
AltoI
AltoII
TenorI
TenorII
Baritone
.
.
.
The result should be a series of PDF files, one for each
instrument, containing the specific parts for all selected tunes.
I tried to write a function such as:
part = #(define-void-function (score instrument) (string? string?)
#{
\include "../Doxy/Doxy_music.ly"
\include "partAltoI.ly"
#})
(Here, I am not constructing the file names from the arguments, only
testing the use of \include in the function.
This doesn't work, producing the following error:
.../include/LilyJAZZwithBarNums.ily:62:1 <0>: error: syntax error,
unexpected SCM_TOKEN, expecting end of input
#(define jazz-map '(
/tmp/frescobaldi-1mgd5_wr/tmpys2kq_gz/March2022_parts_alto1.ly:13:1
<1>: error: error in #{ ... #}
\part "Doxy" "AltoI"
The message says the error is in LilyJAZZwithBarNums.ily, but since
the same instructions work when not in a function, I presume it's not
related to this file.
Is there a way to make this work, or is there another way to achieve
the intended result? For example, is there a way to read a lilypond
variable from a file without including the whole file?
Thanks for any advice!
As with
https://lists.gnu.org/archive/html/lilypond-user/2022-02/msg00537.html,
this is being answered on lilypond-user-fr.
Jean