[prev in list] [next in list] [prev in thread] [next in thread]
List: lilypond-user
Subject: Re: Scheme function to return pitchnames as markup/text
From: Stephen Cummings <stevecummings () seldenhouse ! com>
Date: 2019-11-27 15:39:42
Message-ID: f48ae432-e346-4a95-478b-4799c9faa8eb () seldenhouse ! com
[Download RAW message or body]
David, a follow-up--
I came across a post of yours from some years back in response to a
sort-of-similar question,
in which you suggested a more direct/more succinct way to access
LilyPond's music-to-string functionality,
via "value->lilystring." (More succinct, that is, if don't count the
necessary "use-modules" line).
So this:
#(use-modules (scm display-lily))
musmarkA = ^\tweak self-alignment-X #CENTER
-$(define-scheme-function (music) (ly:music?)
(value->lily-string music)) \etc
{
c'\musmarkA { c' }
}
...is equivalent, I think, to this:
musmarkA = ^\tweak self-alignment-X #CENTER
-$(define-scheme-function (music) (ly:music?)
(with-output-to-string (lambda () (displayLilyMusic
music)))) \etc
{
c'\musmarkA { c' }
}
...the suggestion you made to me.
David Kastrup wrote on 11/20/2019 3:40 AM:
> Stephen Cummings <stevecummings@seldenhouse.com> writes: .....
> I would be skeptical anyway that \displayLilyMusic would be the best
> approach for your purpose but I did want to point out that catching
> output in a string is always an option in Scheme's port model.
>> David Kastrup wrote on 11/19/2019 3:43 PM:
>>> Stephen Cummings <stevecummings@seldenhouse.com> 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.
[Attachment #3 (text/html)]
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=windows-1252">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p><font size="+1">David, a follow-up-- <br>
</font></p>
<p><font size="+1">I came across a post of yours from some years
back in response to a sort-of-similar question,<br>
in which you suggested a more direct/more succinct way to access
LilyPond's music-to-string functionality,<br>
via "value->lilystring." (More succinct, that is, if don't
count the necessary "use-modules" line). <br>
</font></p>
<p><font size="+1">So this:<br>
</font></p>
<blockquote>
<p><font size="+1">#(use-modules (scm display-lily))<br>
<br>
musmarkA = ^\tweak self-alignment-X #CENTER<br>
-$(define-scheme-function (music) (ly:music?)<br>
(value->lily-string music)) \etc<br>
{<br>
c'\musmarkA { c' }<br>
}<br>
</font></p>
</blockquote>
<p><font size="+1">...is equivalent, I think, to this:</font></p>
<blockquote>
<p><font size="+1">musmarkA = ^\tweak self-alignment-X #CENTER<br>
-$(define-scheme-function (music) (ly:music?)<br>
(with-output-to-string (lambda () (displayLilyMusic
music)))) \etc<br>
{<br>
c'\musmarkA { c' }<br>
}</font></p>
</blockquote>
<p><font size="+1">...the suggestion you made to me.</font></p>
<div class="moz-cite-prefix"><font size="+1">David Kastrup wrote on
11/20/2019 3:40 AM:<br>
</font></div>
<blockquote type="cite" cite="mid:87sgmi93od.fsf@fencepost.gnu.org"
id="mid_87sgmi93od_fsf_fencepost_gnu_org" class=" cite">
<pre class="moz-quote-pre" wrap=""><font size="+1">Stephen Cummings <a \
class="moz-txt-link-rfc2396E" \
href="mailto:stevecummings@seldenhouse.com"><stevecummings@seldenhouse.com></a> \
writes:
.....
</font></pre>
<pre class="moz-quote-pre" wrap=""><font size="+1">I would be skeptical anyway \
that \displayLilyMusic would be the best approach for your purpose but I did want to \
point out that catching output in a string is always an option in Scheme's port \
model.
</font></pre>
<blockquote type="cite" id="Cite_4361803" class=" cite">
<pre class="moz-quote-pre" wrap=""><font size="+1">David Kastrup wrote on \
11/19/2019 3:43 PM: </font></pre>
<blockquote type="cite" id="Cite_1314804" class=" cite">
<pre class="moz-quote-pre" wrap=""><font size="+1">Stephen Cummings <a \
class="moz-txt-link-rfc2396E" \
href="mailto:stevecummings@seldenhouse.com"><stevecummings@seldenhouse.com></a> \
writes:
</font></pre>
<blockquote type="cite" id="Cite_7622886" class=" cite">
<pre class="moz-quote-pre" wrap=""><font size="+1">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?
</font></pre>
</blockquote>
<pre class="moz-quote-pre" wrap=""><font size="+1">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.
</font></pre>
</blockquote>
</blockquote>
</blockquote>
</body>
</html>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic