In this example, I have function called "scorePart" that returns a
staff that I use to make parts in the score, and this works. I have
another function called "standalonePart" that returns a bookpart, which
I'd like to use to print individual instrument parts. However, when I
attempt to use it I get an error complaining about bad expression type.
What is going on here that it will accept a staff but not a bookpart?
Thanks,
Cameron
%%%
\version "2.24.4"
\header { title = "Example" }
flute.name = "Flute"
flute.key = c'
flute.music = \fixed c'' { \key c \major c4 d e d c1 }
trumpet.name = "B♭ Trumpet"
trumpet.key = bes
trumpet.music = \fixed c' { \key c \major c4 d c b, c1 }
scorePart =
#(define-scheme-function (instrument) (alist?)
#{
\new Staff
\with { instrumentName = #(ly:assoc-get 'name instrument) }
{ #(ly:assoc-get 'music instrument) }
#}
)
standalonePart =
#(define-scheme-function (instrument) (alist?)
#{
\bookpart {
\header { instrument = #(ly:assoc-get 'name instrument) }
\score {
\new Staff
\transpose #(ly:assoc-get 'key instrument) c'
#(ly:assoc-get 'music instrument)
}
}
#}
)
% Score book
\book {
\header { instrument = "Concert Pitch Score" }
\score {
<<
\scorePart \flute
\scorePart \trumpet
>>
}
}
% Book containing all parts
\book {
\standalonePart \flute
\standalonePart \trumpet
}
%%%