[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: score in a music function?
From: |
David Kastrup |
Subject: |
Re: score in a music function? |
Date: |
Wed, 06 Feb 2013 10:00:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
Stefan Thomas <address@hidden> writes:
> Dear community,
> is it possible to have the score command in a music function?
A music function returns music. Use a scheme function to return
arbitrary Scheme.
> I need it for a piece with different movements.
> I've tried it with the following code which doesn't work:
>
> \version "2.16.2"
> TheScore = #(define-music-function (parser location x y) (ly:music?
> ly:music?)
> #{
> \score {
> \new StaffGroup
> <<
> \new Staff \with { instrumentName = "first" } $x
> \new Staff \with { instrumentName = "second" } $y
>>>
> }
> #})
Why don't you just return the StaffGroup here? That's music.
I don't have 2.16 installed, but with current versions
\version "2.16.2"
TheScore = #(define-scheme-function (parser location x y) (ly:music?
ly:music?)
#{
\score {
\new StaffGroup
<<
\new Staff \with { instrumentName = "first" } $x
\new Staff \with { instrumentName = "second" } $y
>>
}
#})
first = \relative c' { c4 d e f g1 }
second = \relative c'' { g4 f e d c1 }
\score { \TheScore \first \second }
appears to work. Of course, if you are going to have to write
\score { ... } anyway, the incentive for not just using a music function
is not all that high.
--
David Kastrup