lilypond-user
[Top][All Lists]
Advanced

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

Re: parameters in lyrics?


From: David Nalesnik
Subject: Re: parameters in lyrics?
Date: Wed, 16 Dec 2015 09:46:23 -0600



On Wed, Dec 16, 2015 at 9:32 AM, Graham King <address@hidden> wrote:
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))
   #})

Extra parens:

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)))

DN


reply via email to

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