"m...@mikesolomon.org" <m...@mikesolomon.org> writes:

> I am writing a percussion part that shadows a vocal part one-on-one
> and I'd like to do something like:
>
> vocal = #(define-music-function (parser location) ()
> #{
>   foo = { a' }
>   bar = { a'' }
> #})
>
> percu = #(define-music-function (parser location) ()
> #{
>   foo = { snare }
>   bar = { tomh }
> #})
>
> music = {
> foo8 bar8 foo8 bar8
> }
>
> <<
> \new Staff { \vocal \music }
> \new DrumStaff { \percu \music }
>>>
>
> Obviously the above doesn't get the desired effect but I hope people
> get the idea.  Is there a way to do this?

Enter the part as vocals, then use something like a music function with
the core
(map-some-music
  (lambda (m)
    (and (ly:pitch? (ly:music-property m 'pitch))
         (music-clone m 'pitch '()
            'drum-pitch (assoc-ref `((,#{ a' #} . snare)
                                     (,#{ a'' #} . tomh))
                                   (ly:music-property m 'pitch)))))
  music)
on it.

-- 
David Kastrup


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

Reply via email to