lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing context properties (e.g. the current key) from a music fun


From: David Nalesnik
Subject: Re: Accessing context properties (e.g. the current key) from a music function?
Date: Fri, 1 May 2015 07:54:50 -0500



On Fri, May 1, 2015 at 7:48 AM, David Nalesnik <address@hidden> wrote:

test =
#(define-music-function (parser location music) (ly:music?)
   (let ((k "ERROR"))
     #{                                                                                                                  
       \applyContext                                                                                             
       #(lambda (context)                                                                                     
          (set! k  (ly:context-property context 'tonic))                                               
          (display k)                                                                                                 
          )                                                                                                                   
       \transpose #(ly:make-pitch 0 0) #k #music

\transpose c #k #music
 
       #(display k)
       #(newline)
     #}                                                                                                                   
     ))

\score {                                                                                                           
  \new Staff {                                                                                                   
    \key a \major                                                      
    \test { a b cis d e }                                                                              
  }                                                                                                                  
}


DN 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]