lilypond-user
[Top][All Lists]
Advanced

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

Re: Scheme function to return pitchnames as markup/text


From: Stephen Cummings
Subject: Re: Scheme function to return pitchnames as markup/text
Date: Tue, 19 Nov 2019 18:20:48 -0800
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1

Quite comfortable with such cheek. Thank you. 

Still, I will try to package up a more formally named version of that little function. A translating map or loop will then be needed to extract note names and render them in more conventional form, but that won't require inscrutable-for-me ly:xxx calls. (Pardon the mistaken reference to displayMusic rather than displayLilyMusic.)

I'll pursue getting my original to work for learning purposes, and with the thought that discarding non-pitch events early rather than late might be better: if pitch -> convert to custom note name -> add to output string -> loop; then return the string. Sure helps to know that pitch-notename returns a number. 

David Kastrup wrote on 11/19/2019 3:43 PM:
Stephen Cummings <address@hidden> writes:

Am I missing a basic LilyPond command/directive--something built-in
that takes music as input and returns note names as text? Such a 
functionality would seem to be useful in all kinds of
annotations/quotations. I know about \displayMusic but its output only 
goes to the console/output stream and can't be routed to markup, correct?
Hm?

musmark
= ^\tweak self-alignment-X #CENTER
  -$(define-scheme-function (music) (ly:music?)
     (with-output-to-string (lambda () (displayLilyMusic music)))) \etc

{
  c'\musmark { c' }
}

Though it's probably a bit cheeky to $\etc the scheme function
in anonymously.  But you could give a name to the define-scheme-function
call as usual.




reply via email to

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