lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

scheme function returning two scores


From: Gianmaria Lari
Subject: scheme function returning two scores
Date: Sat, 24 Feb 2018 09:01:30 +0100

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]