The following very simple code generate 4 scores: two layout scores and two
midi scores.

\version "2.19.81"

music = {\repeat percent 2 {c' d' e' f'}}
\score { \music \layout{}}
\score { \unfoldRepeats \music \midi{}}

music = {\repeat percent 2 {g c' c' c'}}
\score { \music \layout{}}
\score { \unfoldRepeats \music \midi{}}


I would like to write the same more concisely like this:

\version "2.19.81"

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

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

But I get the error

error: syntax error, unexpected \score, expecting end of input

\score { \unfoldRepeats $music \midi{}}


The issue is clear but I have no idea how I can fix it. Any suggestion?

Thank you, g.


P.S. Instead of returning two score, I tried myScore to return a "\book"
containing two score but this also didn't work.
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to