Hello,
I have a "Theme and Variations" questions. I started notating a piece
what could be handled with (3.1.2 "Multiple scores in a book", see also
http://lsr.dsi.unimi.it/LSR/Item?id=310). But I need a lot of layout
setup in the PianoStaff, that is bound to the \score. Further I would
like to write the Upper, Lower and Dynamics of the three variations in a
similar way as I did for the theme.
What is a convinient way to continue this notation work? I would like to
avoid duplicating text group by copy and paste.
Any other suggestions are welcome.
Best regards,
Helge
\version "2.10.4"
\include "deutsch.ly"
\include "pedal.ly"
upperStaff = \relative c' {
\clef treble \key ces \major \time 2/4
\set Staff.midiInstrument = "harp"
\tempo 4=60
\repeat volta 2 {
\set fingeringOrientations = #'(left)
<ces-4 es-3 ces'-1>4(^"Andante"_\markup \harp-pedal #"^^^|^^^-" <ces es ces'>) |
<< { ces'4\>\arpeggio( b4-2) } \\ { <des, fes>2\arpeggio } >> |
<des fes b>4( <des fes b>) |
<< { b'4\arpeggio( as) } \\ {
\set fingeringOrientations = #'(left)
\once \override Staff.Arpeggio #'padding = #-0.2
<ces,-4 es-3>2\arpeggio } >> |
< es as ces es>4( < es as ces es>) |
<< { es'4.\arpeggio des8 } \\ { <fes, as b>2\arpeggio } >> |
<es as ces>4 <des g b> |
<ces as'>2\accent |
}
\repeat volta 2 {
<es ges ces es>8.[\arpeggio des'16(-2 ces8.)-3 es16](-2 |
ges2) |
<ces,, es as ces>8.[\arpeggio b'16-2 as8.-3 ces16-2] |
es2 |
<fes, as des fes>4\arpeggio <fes as des fes>\arpeggio |
<fes as des fes>4\arpeggio <fes as es'>8.-1\arpeggio des'16-2 |
<fes, as des>4-1\arpeggio <fes as ces>8.-1 b16-2 |
<des, g b>4-1\arpeggio es-3 |
<ces es ces'>4( <ces es ces'>) |
<< { ces'4\arpeggio( b) } \\ { <des, fes>2\arpeggio } >> |
<des fes b>4( <des fes b>4) |
<< {
\set fingeringOrientations = #'(left)
b'\arpeggio( as)
} \\ { <ces,-4 es-3>2\arpeggio } >> |
<es as ces es>4( <es as ces es>) |
<< { <ces' es>4.\arpeggio <b des>8 } \\ { <fes as>2\arpeggio } >> |
<es as ces>4 <des g b> |
<ces as'>2
}
}
dynamic = {
% line 1
s4\p\< s\! s\> s\! |
s4\< s\! |
s4\> s\! |
s4\< s\! |
s2 |
% line 2
s4\> s | s2\! |
s2 | s2 | s2 | s2 |
% line 3
s2 | s2 | s4\> s | s4 s\! |
s4\p\< s\! | s4\> s\! |
% line 4
s4\< s\! |
s4\> s\! |
s4\< s\! |
s4 s\> | s s | s2\! |
}
lowerStaff = \relative c {
\clef bass \key ces \major \time 2/4
\set Staff.midiInstrument = "harp"
\repeat volta 2 {
<as as,>4 <as as'> |
<g g'>2 |
<g g,>4 <g g'>4 |
<as as'>2
<ces ces,>4 <ces ces'>4 |
<des des'>2
es4 es, |
as'4 as, |
}
\repeat volta 2 {
<ces es ges ces>4\arpeggio <ces' es>
<ces ces,>4 <ces es> |
<as es ces as>4\arpeggio <as ces> |
<as as,>4 <as ces> |
<des, as fes des>4\arpeggio <des fes as des>\arpeggio |
<des as fes des>4\arpeggio <des fes as des>\arpeggio |
<des des,>4 <des des'> |
<es es,>4 r |
<as, as,>4 <as as'> |
<g g'>2 |
<g g,>4 <g g'> |
<as as'>2 |
<ces ces,>4 <ces ces'> |
<des des'>2 |
es4 es, |
as'4 as, |
}
a b c
}
\book {
\header {
title = \markup { \italic "Thema" }
subtitle = " "
composer = \markup { "John Thomas" }
dedication = { }
tagline = \markup { "" }
}
\score {
\context PianoStaff <<
\set PianoStaff.connectArpeggios = ##t
\set PianoStaff.instrumentName = "Harfe"
\new Staff = "upper" \upperStaff
\new Dynamics = "Dynamics_pf" \dynamic
\new Staff = "lower" \lowerStaff
>>
\layout {
% define Dynamics context
\context {
\type "Engraver_group"
\name Dynamics
\alias Voice
\consists "Output_property_engraver"
\consists "Piano_pedal_engraver"
\consists "Script_engraver"
\consists "New_dynamic_engraver"
\consists "Dynamic_align_engraver"
\consists "Text_engraver"
\consists "Skip_event_swallow_translator"
\consists "Axis_group_engraver"
pedalSustainStrings = #'("Ped." "*Ped." "*")
pedalUnaCordaStrings = #'("una corda" "" "tre corde")
\override DynamicLineSpanner #'Y-offset = #0
\override TextScript #'font-size = #2
\override TextScript #'font-shape = #'italic
\override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 1)
}
% modify PianoStaff context to accept Dynamics context
\context {
\PianoStaff
\accepts Dynamics
}
}
}
\score {
\unfoldRepeats {
\context PianoStaff <<
\context Staff = upper \upperStaff
\context Staff = lower \lowerStaff { a b c d e f g }
>>
}
\midi { }
}
}
% The following defines a new markup command
% \harp-pedal #"^-v|--v^"
% for harp pedal diagrams. Possible values in the string are:
% ^ ... pedal is up
% - ... pedal is neutral
% v ... pedal is down
% | ... vertical divider line
% The function does not check if the string has the typical form of three
% pedals, then the divider and then the remaining four pedals. Instead it
% simply prints each symbol in the order as given. This means you can place
% the divider (even multiple dividers) anywhere you want.
%
% There is also a \harp-pedal-verbose version, which
% takes a list of directions and a possible |. Unfortunately, it has some
% caveats:
% 1) the | cannot be given as a string "|", but as a character #\|
% 2) if one wants to use directions like UP, CENTER or DOWN, one cannot use
% '(UP DOWN CENTER #\| ....), because the contents of that list are
% never evaluated. Instead one has to explicitly create a list like
% (list UP DOWN CENTER #\| ....)
#(define-markup-command (harp-pedal-verbose layout props pedal-list) (list?)
"Make a harp pedal diagram containing the directions indicated in @var{pedal-list}.
For example,
@example
\\markup \\pedal-diagram-verbose #'(1 0 -1 #\\| 0 0 1 1)
\\markup \\pedal-diagram-verbose #(list UP CENTER DOWN #\\| CENTER CENTER UP UP)
@end example
"
(make-harp-pedal layout props pedal-list))
#(define-markup-command (harp-pedal layout props definition-string) (string?)
"Make a harp pedal diagram. For example, say
@example
\\markup \\harp-pedal #\"^-v|^^^^\"
@end example
"
(make-harp-pedal layout props (harp-pedals-parse-string definition-string)))
#(define (harp-pedals-parse-string definition-string)
"Parse a harp pedals diagram string and return a list containing 1, 0, -1 or #\\|"
(map (lambda (c)
(case c
((#\^) 1)
((#\v) -1)
((#\-) 0)
((#\|) #\|)
(else c)))
(string->list definition-string)))
#(define (make-harp-pedal layout props pedal-list)
"Make a harp pedals diagram markup"
; FIXME the size variable should be defined by a prop. lookup
(define sz 1.2)
; TODO is it worth adding a thickness variable here?
(let* ((x (* sz 4))
(y (* sz 2))
(box-width (* sz 0.4))
(box-height (* sz 1))
(space (* sz 0.5))
(box-x-dimensions (lambda (prev-x p) (cons (+ prev-x space)
(+ prev-x space box-width))))
(box-y-dimensions (lambda (prev-x p) (cons (+ (- y (/ box-height 2)) p)
(+ y (/ box-height 2) p))))
(divider-command (lambda (xpos) (list 'draw-line 0.2 xpos 0 xpos (* y 2))))
(result (let process-pedal ((remaining pedal-list)
(prev-x 0)
(stencils '()))
(if (null? remaining)
(cons prev-x stencils)
(case (car remaining)
((1 0 -1)
(let* ((p (car remaining))
(stencil (make-filled-box-stencil
(box-x-dimensions prev-x p) (box-y-dimensions prev-x p)))
(new-prev-x (+ prev-x space box-width space)))
(process-pedal (cdr remaining) new-prev-x (cons stencil stencils))))
((#\|)
(let* ((xpos (+ prev-x space))
(stencil (ly:make-stencil (divider-command xpos)))
(new-prev-x (+ prev-x (* 2 space))))
(process-pedal (cdr remaining) new-prev-x (cons stencil stencils))))
(else
(display "unhandled entry in harp-pedal:")
(display (car remaining))
(newline)
(process-pedal (cdr remaining) prev-x stencils))))))
(final-x (car result))
(stencils (reverse (cdr result))))
; Add the horizontal line and combine all stencils:
(apply ly:stencil-add
(cons
(ly:make-stencil (list 'draw-line 0.2 0 y final-x y))
stencils))))
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user