Hi all When working with larger scores / several voices/instruments, I would like to "loop through every single instrument" to produce the \book-blocks in order to avoid duplicate lilypond code.
Let's take the following MVE: --- MVE START --- \version "2.19.83" notesI = \relative c' { c4 d e f } notesII = \relative c { e4 f g b } generateBook = #(define-music-function (parser location notes) (ly:music?) #{ \book { \score { $notes \layout {} } } #}) \generateBook \notesI \generateBook \notesII --- MVE END --- Lilypond exits with error: .../document.ly:24:1: error: music function cannot return ##<Book> \generateBook \notesI .../document.ly:26:1: error: music function cannot return ##<Book> \generateBook \notesII It looks as if the "output" (return value) of a function can only be of type "music", not "score", "book" aso, which would disappoint me. Am I right? Or is there a way to define/change the type of the return value? What I expect from the MVE is two PDFs, one with a notesI score, one with a notesII score. I have been inspired to do so by the rehearsalMidi function generated by Frescobaldi. I further intend to extend the music function with additional parameters. I'm currently on Win10 and prefer working with lilypond alone - without shell scripting, Python, etc. What I have already studied: NR, chapter 5.6 and sub-chapters Extending, chapter 2.3 and sub-chapters Urs Liskas blogposts on music functions (1-4, 2014) TIA&Regards Steff