Gianmaria Lari <gianmarial...@gmail.com> writes:

> I'm trying to put the score functionality inside a function (consider it a
> test). Here it is the code:
>
> \version "2.19.80"
> myScore =
> #(define (music) (ly:music?) #{
>   \score {
>     $music
>     \layout{}
>     \midi{}
>    } #} )
>
> \myScore {a b c'}
>
>
> The code correctly generate a score but it does not generate the midi file.
> Why???

There is a difference between define (which defines a pure Scheme
function or expression) and define-music-function (which defines
something taking arguments in LilyPond syntax and returning a music
expression) and your input is an interesting mashup where \myScore will
probably be left as *unspecified* after you define an argumentless
Scheme function named `music' that first calls ly:music? without
argument and then would return a score if the ly:music? call had not
already caused an error due to a missing argument.

Now a score is not a music expression anyway, so you should rather
replace define with define-scheme-function here in order to avoid
errors: the resulting \myScore can then return arbitrary expressions
including whole scores.

-- 
David Kastrup

_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to