lilypond-user
[Top][All Lists]
Advanced

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

Re: Programming question


From: Jay Vara
Subject: Re: Programming question
Date: Wed, 26 Nov 2014 10:10:37 +0000

Yay! That works. Not sure why the other way did not work.

I tried various ways of getting it to output to a string instead of to a file, something like:

#(set! (jv (with-output-to-string

(lambda () #{ \displayMusic \music #}))))


so that we could add the # to the string jv. No luck here as I could not get past the syntax / non-music _expression_ issues.


On Wed, Nov 26, 2014 at 12:41 AM, David Nalesnik <address@hidden> wrote:


On Tue, Nov 25, 2014 at 8:49 AM, Jay Vara <address@hidden> wrote:
Trying to force the lyric in David's program to associate with the Staff/Voice, I added a name "jun" to the voice and see if that worked.
 
 [...]

In this case, the lyrics, that is the pitch numbers, did not show up at all! Wonder why?

I think it's because \music gets interpreted and forces the creation of a new higher-level context, but I'm pretty fuzzy here.

I wonder if there's a way to parse \music without any side effects.  I see various Scheme functions relating to the parser, but I'm pretty unfamiliar with this area.   Would ly:parser-clone get us somewhere?

Anyway, here's an interesting experiment.

First, I created a text file "display.txt" with the Scheme _expression_ for \music.  I did this by running the file "out.ly".

I then added a # in front of the _expression_ in the text file.  Unsure of how to automate that.

Next, I included the contents of the text file in the main file ("another.ly") like so:

\new Staff
<<
  \new Voice = "jun" \music
  \noteNameToLyric \extractPitches \include "display.txt"
>>

And, like magic, it works!

--David


 



reply via email to

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