I've finally got back to this problem, and have tried to write a wrapper around Simon's code. However, I now find myself at that peculiarly humiliating stage of grappling with Scheme code, in which one's increasingly-desperate random changes to punctuation are beginning to go round in circles. Please could someone point out my error(s)?
The code extract below generates the following error(s): 143:9: In expression ((#<procedure embedded-lilypond #> parser " \\openBracket #syllable " ...)): /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)) > 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. \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.
_______________________________________________ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user