On 25 February 2018 at 14:15, David Kastrup <[email protected]> wrote:

> Gianmaria Lari <[email protected]> writes:
>
> > On 25 February 2018 at 13:15, David Kastrup <[email protected]> wrote:
> >
> >> Gianmaria Lari <[email protected]> writes:
> >>
> >> > Because lilypond "doesn't expect" to return more than one score I
> tried
> >> to
> >> > put the call to my function returning the score inside a \book. But
> this
> >> > also does not work and I get this error:
> >> >
> >> > This is my code:
> >> >
> >> > \version "2.19.81"
> >> > myScore = #(define-scheme-function (music) (ly:music?) #{
> >> >     \score { $music \layout{} }
> >> >     \score { \unfoldRepeats $music \midi{}}
> >> >   }
> >> > #})
> >>
> >> Where is the book you are purporting to return?
> >>
> >
> > First thing: I made another mistake in the code I copied. This is the
> code
> > I wanted to send:
> >
> > \version "2.19.81"
> >
> > myScore = #(define-scheme-function (music) (ly:music?) #{
> >     \score { $music \layout{} }
> >     \score { \unfoldRepeats $music \midi{}}
> > #} )
> >
> > \book {
> >  \myScore {\repeat percent 2 {c' d' e' f'}}
> >  \myScore {\repeat percent 2 {g c' c' c'}}
> > }
> >
> >
> > Second thing: No, I didn't return a book, I return scores inside a
> > book.
>
> You cannot return "scores" since "scores" is no type.  You can return a
> list of scores (which you would then need to further process), or you
> can return a book or a bookpart containing scores, or you can return a
> single score.
>
> > The reason is that I don't know how many call to myscore I will need so I
> > thought that I have to put it "externally". I don't know if I'm clear.
> >
> > BUT I also tried to do this:
> >
> > \version "2.19.81"
> >
> > myScore = #(define-scheme-function (music) (ly:music?) #{
> >   \book {
> >     \score { $music \layout{} }
> >     \score { \unfoldRepeats $music \midi{}}
> >   } #} )
> >
> > \myScore {\repeat percent 2 {c' d' e' f'}}
> > \myScore {\repeat percent 2 {g c' c' c'}}
> >
> >
> > This would create multiple book inside a single file. It looked to me
> > that it was not the way to go.
>
> How about creating multiple bookparts?


Yes, I tried it but didn't work.... did I made a mistake?

\version "2.19.81"

myScore = #(define-scheme-function (music) (ly:music?) #{
  \bookpart {
    \score { $music \layout{} }
    \score { \unfoldRepeats $music \midi{}}
  } #} )

\myScore {\repeat percent 2 {c' d' e' f'}}
\myScore {\repeat percent 2 {g c' c' c'}}


I also tried bookpart inside a book

\version "2.19.81"

myScore = #(define-scheme-function (music) (ly:music?) #{
  \bookpart {
    \score { $music \layout{} }
    \score { \unfoldRepeats $music \midi{}}
  } #} )

\book {
\myScore {\repeat percent 2 {c' d' e' f'}}
\myScore {\repeat percent 2 {g c' c' c'}}
}
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to