[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using lyrics in a markup
From: |
Marc Hohl |
Subject: |
Re: Using lyrics in a markup |
Date: |
Tue, 18 Jan 2011 10:02:08 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 |
Am 15.01.2011 21:51, schrieb Neil Puttock:
On 15 January 2011 19:01, Marc Hohl<address@hidden> wrote:
Now I wonder whether it is possible to create a kind of text book by
including the lyrics in a markup, perhaps with a scheme function which
replaces the " -- " by "".
Is it possible to store the text in a variable?
[...]
For simplicity I've ignored hyphens, but it shouldn't be too difficult
to add them (or use their position in the list of strings to restore
the hyphenated words).
This is what I got so far:
\version "2.13.46"
words = \lyricmode { This is my ex -- am -- ple text }
#(define (lyrics->list lyrics)
"Return a flat list containing all syllables and hyphens from
@code{lyrics}."
(let ((extracted-list
(if (ly:music? lyrics)
(if (memq (ly:music-property lyrics 'name) '(LyricEvent
HyphenEvent))
(begin (if (eq? (ly:music-property lyrics 'name)
'LyricEvent)
(list (ly:music-property lyrics 'text))
(list "--")))
(let ((elt (ly:music-property lyrics 'element))
(elts (ly:music-property lyrics 'elements)))
(if (ly:music? elt)
(lyrics->list elt)
(if (null? elts)
'()
(map (lambda(x)
(lyrics->list x))
elts)))))
'())))
(flatten-list extracted-list)))
text = #(lyrics->list words)
melody = \relative c' { c4 d e f | g a c2 }
\new Voice { \melody }
\addlyrics { \words }
#(markup* (make-line-markup text))
The function liyrics->list extracts the syllables and the hyphens.
The second part (eliminating the hyphens in the list and concatenate the
surrounding
syllables) seems a bit harder, but I try to find a solution.
Regards,
Marc
- Using lyrics in a markup, Marc Hohl, 2011/01/15
- Re: Using lyrics in a markup, Neil Puttock, 2011/01/15
- Re: Using lyrics in a markup, Marc Hohl, 2011/01/16
- Re: Using lyrics in a markup,
Marc Hohl <=
- Re: Using lyrics in a markup, jakob lund, 2011/01/18
- Re: Using lyrics in a markup, Jan-Peter Voigt, 2011/01/18
- Re: Using lyrics in a markup, jakob lund, 2011/01/18
- Re: Using lyrics in a markup, Marc Hohl, 2011/01/18
- Re: Using lyrics in a markup, Graham Percival, 2011/01/18
- Re: Using lyrics in a markup, Marc Hohl, 2011/01/18
- Re: Using lyrics in a markup, Jean-Charles Malahieude, 2011/01/18
- Re: Using lyrics in a markup, jakob lund, 2011/01/19
- Re: Using lyrics in a markup, Jan-Peter Voigt, 2011/01/19
- Re: Using lyrics in a markup, jakob lund, 2011/01/20