Richard Shann wrote:
> My problem is that the syntax for ly:make-pitch is
> difficult to generate, but I can't seem to find anything
> to convert a string like "cis'" to an ly:pitch? datum.

Richard,

I'm having trouble visualizing what you're trying to
accomplish, couldn't you just do this?

**********************

myPitch = cis'

myfunc =
#(define-music-function
   (parser location arg)
   (ly:music?)
   #{ \transpose c' #myPitch #arg #})

{
  c' d' e'
  \myfunc { c' d' e' }
}

**********************

Otherwise, if for some reason you really need to convert
a string to a pitch object, here's one way to do it:

**********************

stringToPitch =
#(define-scheme-function
   (parser location str)
   (string?)
   (let* ((clone (ly:parser-clone parser '() location))
          (expr (ly:parse-string-expression clone str)))
       (ly:make-pitch (ly:pitch-octave expr)
                      (ly:pitch-notename expr)
                      (ly:pitch-alteration expr))))

myPitch = \stringToPitch #"cis'"

myfunc =
#(define-music-function
   (parser location arg)
   (ly:music?)
   #{ \transpose c' #myPitch #arg #})

{
  c' d' e'
  \myfunc { c' d' e' }
}

**********************

Hope this helps,
Mark
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to