Hi,

I have a multi-section piece, with a master .ly file that uses \include for
each of the sections of the piece. Each included file more or less follows
the pattern of the string quartet template that ships with Lilypond: a
series of macros, one per voice, followed by a \bookpart section that
builds a StaffGroup, with one Staff per voice. This bookpart block is
nearly identical in all the included files, with the exception of a title
string used for "piece" property in in a \header section and also also as a
\tocItem.

This all works quite well, and I have a nice score with everything. Now I'd
like to be able to produce parts, and my thought is that rather than have a
literal bookpart block in each file, I should be able to convert the block
into a function that takes the title string parameter. If I can get this to
work, then hopefully I can make the function smart enough to either render
all voices (for the full score) or just a single voice (for parts).

My problem is that I have defined the function, but I can't invoke it.
Here's the function:

scoreSection =
#(define-scheme-function
    (parser location title)
    (string?)
  #{
    \bookpart {
        \header {
          piece = #title
        }
        \tocItem \markup #title
        \markup {
          \italic "Notes other than C have different pitches than notated,
as indicated by a number"
        }
        \markup {
          \italic "in parentheses giving an offset in cents relative to the
notated pitch, shown at"
        }
        \markup {
          \italic "the first appearance of each note that requires
alteration."
        }
        \score {
            \new StaffGroup \with { midiInstrument = "cello" } <<
                \new Staff \with { instrumentName = "String 1" }
                << \global \stringOne >>
                \new Staff \with { instrumentName = "String 2" }
                << \global \stringTwo >>
                \new Staff \with { instrumentName = "String 3" }
                << \global \stringThree >>
                \new Staff \with { instrumentName = "String 4" }
                << \global \stringFour >>
                \new Staff \with { instrumentName = "String 5" }
                << \global \stringFive >>
                \new Staff \with { instrumentName = "String 6" }
                << \global \stringSix >>
                \new Staff \with { instrumentName = "String 7" }
                << \global \stringSeven >>
            >>
        \layout { }
        \midi { }
        }
    }
  #})

And I am trying to invoke it using

\scoreSection #"Part 1"


but I keep getting the error messages like this:

Parsing...
hexany_permutations.ly:127:1: error: bad expression type

\scoreSection #"Part 1"


What am I doing wrong? I'm a Lilypond and Scheme newbie (but a programmer
by trade).

- Dave

Reply via email to