lilypond-user
[Top][All Lists]
Advanced

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

Re: Programming question


From: Mike Solomon
Subject: Re: Programming question
Date: Sun, 23 Nov 2014 23:31:20 +0200

> On Nov 23, 2014, at 10:21 PM, Jay Vara <address@hidden> wrote:
> 
> Given that NoteNames are really a type of lyrics, is it possible to have a 
> function that just takes music and returns a text string that is a lyric.
> 
> For example:
> 
> music  = \relative c' { c4 d e f g a b c }
> 
> notenameLyric = \NoteNameToLyric \music
> 
> would make
> 
> notenameLyric = "c d e f g a b c"
> 
> so that we can write
> 
> \newLyric \lyricmode \notenameLyric
> 
> I understand that such a function would probably map the music and extract 
> the 'text from it and concatenate it to get the result. Not yet successful in 
> getting it to work.

Cool idea!  You’re thinking is exactly how I’d do it.
I'd copy and paste the naturalizeMusic function from the doc and adapt it to 
return a list of pitch classes from the music.
Then, you can flatten the returned list (if need be) and do a map on the list 
with a lambda function that takes a numeric pitch class and returns a markup 
with a note name.

Cheers,
MS


reply via email to

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