|
From: | Graham King |
Subject: | Re: parameters in lyrics? |
Date: | Wed, 16 Dec 2015 15:32:42 +0000 |
143:9: In _expression_ ((#<procedure embedded-lilypond #> parser " \\openBracket #syllable " ...)):Here's a representative sample of code. The idea is that the program chooses one or other of Simon's formatting routines, based on the value of lyricEditorialStyle.
/Users/grahamk/Documents/lilypond/music/testbed/lyric_markup_test2.ly:143:9: Wrong type to apply: #<Prob: Music C++: Music((origin . #<location /Users/grahamk/Documents/lilypond/music/testbed/lyric_markup_test2.ly:250:9>) (duration . #<Duration 4 >) (text . [blind))((display-methods #<procedure #f (lyric parser)>) (name . LyricEvent) (iterator-ctor . #<primitive-procedure ly:rhythmic-music-iterator::constructor>) (types rhythmic-event lyric-event event)) >
\version "2.19.21"
% Allow editorial additions to underlay to be italic or [bracketed] (default).
% Allow colouration in underlay, signifying reduced forces, to be
% red or italic (default).
% This only works with \lyricsto or \addlyrics due to the hardcoded duration.
% Based on Simon Albrecht's code (see lilypond-user list 4 Dec 2015):
%%% Bracketed underlay %%%
openBracket =
#(define-music-function (parser location syllable)(markup?)
#{
#(make-music
'LyricEvent
'text
(format "[~a" syllable)
'duration
(ly:make-duration 2))
#})
%%% Decide what we want:
#(define lyricEditorialStyle
(if (defined? 'lyricEditorialStyle)
lyricEditorialStyle
"bracketed"))
#(ly:message "lyricEditorialStyle: ~a" lyricEditorialStyle)
editorial =
#(define-music-function (parser location syllable)(markup?)
(cond
((string=? lyricEditorialStyle "italic")
(#{ \italic #syllable #}))
((string=? lyricEditorialStyle "bracketed")
(#{ \openBracket #syllable #}))
(else (ly:message "invalid lyricEditorialStyle: ~a" lyricEditorialStyle)))
)
%%{ Test harness begins:
%#(define lyricColourationStyle "red")
%#(define lyricEditorialStyle "italic")
theNotes = {
\relative { e''1 d c }
}
theWords = \lyricmode {
Three \editorial blind mice,
}
\score
{
\new StaffGroup
<<
\new Voice = "voice" \theNotes
\new Lyrics \lyricsto "voice" \theWords
>>
}
%%} Test harness ends.
[Prev in Thread] | Current Thread | [Next in Thread] |