[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Defining pitches in variables
From: |
David Kastrup |
Subject: |
Re: Defining pitches in variables |
Date: |
Sun, 17 Mar 2013 09:40:12 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
"address@hidden" <address@hidden> 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