lilypond-user
[Top][All Lists]
Advanced

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

Re: scheme function returning two scores


From: Caagr98
Subject: Re: scheme function returning two scores
Date: Sun, 25 Feb 2018 22:41:19 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0


On 02/25/18 22:24, Gianmaria Lari wrote:
> 
> 
> On 25 February 2018 at 15:05, Caagr98 <address@hidden 
> <mailto:address@hidden>> wrote:
> 
> 
> 
>     On 02/25/18 14:50, David Kastrup wrote:
>     > In the mean time, you could define a void function and let it just call
>     > toplevel-score-handler on your scores.  Of course, this would no longer
>     > allow you to place those scores in a book or bookpart.
> 
>     Why not call add-score (defined in scm/lily-library.scm) instead? It 
> seems to add the score to the current book/bookpart.
> 
> 
> Dear Caagr98, if would be great if you can refer an example.
> 
> Thanks a lot!
> Ciao, Gianmaria

⋘
\version "2.19.81"
addScore = #(define-void-function (score) (ly:score?) (add-score score))

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

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

The (add-score) function (and the \addScore function I defined up there for 
easier syntax) adds the given score to the closest enclosing \book or \bookpart.

Keep in mind, though, that you can't do anything like this:
⋘
foo = \myScore c1
\book {
  \foo
}
⋙
That'll add the sheet and midi to the toplevel book and leave the second one 
empty.



reply via email to

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