Hi,

I'm trying to create some tools for setting choir pieces. I have run
against a problem where I have a music function that needs the result of
another music function. That other function uses a Lilypond code block, so
it takes both parser and location. For reasons I don't understand, I cannot
get this to work. Lilypond gives me a:

  Wrong type to apply: #<Music function #<procedure #f (music)>>

I have tried to create a small toy example to show what I want to achieve:

rest-around = #(define-music-function (parser location music ) (ly:music?)
  #{ r4 $music r4 #})

restful-choir = #(define-music-function (parser location music) (ly:music?)
  (let ((rest-around (rest-around parser location music)))
   #{
     <<
       \new Voice { \voiceOne \transpose c g $rest-framed }
       \new Voice { \voiceTwo $rest-framed }
     >>
   #}))


music =  { c' d' e' }

\score {
  \new Staff { \restful-choir \music }
}

I have run into this problem a couple of times, the current problem I'm
trying to solve is: I have a list of music an I am trying to map each item
of the list with a function that creates a staff with the music. Afterwards
they should be combined as 'SimultaneousMusic. I would like to use Lilypond
code blocks where I think it is clearer than the Scheme counterpart.

Is there something obvious I am doing wrong, or am I perhaps completely off
on this approach...?

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

Reply via email to