Hi,

Thank you for your answer - seems so much good is coming :-). Lilypond is
just amazing!
  - and also a lesson to myself about checking renames in example code :-)

Best regards,
Morten

On Sun, Mar 12, 2017 at 11:30 PM, Thomas Morley <[email protected]>
wrote:

> 2017-03-12 22:46 GMT+01:00 Morten Lemvigh <[email protected]>:
> > 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 }
>
> rest-framed is not defined see terminal-output:
>
> error: GUILE signaled an error for the expression beginning here
>        \new Voice { \voiceOne \transpose c g $
>                                               rest-framed }
> Unbound variable: 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,
>
> You did not post your lily-version ;)
>
> > or am I perhaps completely off
> > on this approach...?
> >
> > Best regards,
> > Morten
>
> This works for newer devel-versions:
>
> \version "2.19.56"
>
> rest-around = #(define-music-function (music ) (ly:music?)
>   #{ r4 $music r4 #})
>
> restful-choir = #(define-music-function (music) (ly:music?)
>   (let ((rest-framed (rest-around music)))
>    #{
>      <<
>        \new Voice { \voiceOne \transpose c g $rest-framed }
>        \new Voice { \voiceTwo $rest-framed }
>      >>
>    #}))
>
>
> music =  { c' d' e' }
>
> \score {
>   \new Staff { \restful-choir \music }
> }
>
>
> Cheers,
>   Harm
>
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to