\version "2.20" %%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Functions copied from %% https://lists.gnu.org/archive/html/lilypond-user/2013-12/msg01027.html rochadeAlpha = { \override Score.BreakAlignment.break-align-orders = #(make-vector 3 '(left-edge ambitus breathing-sign staff-bar clef key-cancellation key-signature time-signature custos)) \once \override Score.TimeSignature.space-alist = #'( (first-note fixed-space . 2.0) (right-edge extra-space . 0.5) (staff-bar minimum-space . 2.5)) \once \override Score.KeySignature.space-alist = #'( (time-signature extra-space . 1.15) (first-note fixed-space . 1.0) (right-edge extra-space . 0.5) (staff-bar minimum-space . 2.5)) } onceTextLengthOn = { \once\override TextScript.extra-spacing-width = #'(0 . 0) \once\override TextScript.extra-spacing-height = #'(-inf.0 . +inf.0) } staffStop = { \onceTextLengthOn \stopStaff \cadenzaOn } staffStart = { \once\override Score.BarNumber.break-visibility = #'#(#f #t #t) \startStaff \cadenzaOff \set Staff.forceClef = ##t } #(define-markup-command (bar-line layout props strg)(string?) #:properties ((font-size 0) (thin-thickness #f) (thick-thickness #f) (kern #f) (add-height 0)) " Please note: @code{bar-line} isn't finished. There are some weird codings in it. I wouldn't be surprised, if it crashes soon. " (define (string->string-list str) "Convert a string into a list of strings with length 1. @code{"aBc"} will be converted to @code{("a" "B" "c")}. An empty string will be converted to a list containing @code{""}." (if (and (string? str) (not (zero? (string-length str)))) (map (lambda (s) (string s)) (string->list str)) (list ""))) (define (make-bar-line thickness height font-size blot-diameter) "Draw a simple bar line." (ly:round-filled-box (cons 0 (* (magstep font-size) thickness)) (interval-widen (cons 0 (+ add-height height)) (magstep font-size)) blot-diameter)) (define (make-colon-bar-line height font-size) (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) props))) (dot (ly:font-get-glyph font "dots.dot"))) (ly:stencil-add dot (ly:stencil-translate-axis dot (magstep (+ (/ add-height 2) font-size)) Y)))) (define (make-bracket-bar-line height font-size dir thick-bar ) "Draw a bracket-style bar line. If @var{dir} is set to @code{LEFT}, the opening bracket will be drawn, for @code{RIGHT} we get the closing bracket." (let* ((font (ly:paper-get-font layout (cons '((font-encoding . fetaMusic)) props))) (brackettips-up (ly:font-get-glyph font "brackettips.up")) (brackettips-down (ly:font-get-glyph font "brackettips.down")) ;; the x-extent of the brackettips must not be taken into account ;; for bar line constructs like "[|:", so we set new bounds: (tip-up-stil (ly:make-stencil (ly:stencil-expr brackettips-up) (cons 0 0) (ly:stencil-extent brackettips-up Y))) (tip-down-stil (ly:make-stencil (ly:stencil-expr brackettips-down) (cons 0 0) (ly:stencil-extent brackettips-down Y))) (stencil (ly:stencil-add thick-bar (ly:stencil-translate-axis tip-up-stil (+ (/ (+ add-height height) 2) (magstep font-size)) Y) (ly:stencil-translate-axis tip-down-stil (* -1 (+ (/ (+ add-height height) 2) (magstep font-size))) Y)))) (if (eq? dir LEFT) stencil (ly:stencil-scale stencil -1 1)))) ;; TODO: changing global-staff-size will ruin the output for the braces ;; manual readjustment needed :( (define (make-brace-bar-line height font-size) (let* ((pt (ly:output-def-lookup layout 'pt)) (new-height (/ (+ height add-height) pt)) (line-thickness (ly:output-def-lookup layout 'line-thickness)) (font (ly:paper-get-font layout (cons '((font-encoding . fetaBraces) (font-name . #f)) props))) (glyph-count (1- (ly:otf-glyph-count font))) (scale (ly:output-def-lookup layout 'output-scale)) ;; Why `+ 2´ ? (scaled-size (+ 2 (/ (ly:pt new-height) scale))) ;; TODO How about font-size? ;; (scaled-size ;; (+ 2 (magstep font-size) (/ (ly:pt new-height) scale))) (glyph (lambda (n) (ly:font-get-glyph font (string-append "brace" (number->string n))))) (get-y-from-brace (lambda (brace) (interval-length (ly:stencil-extent (glyph brace) Y)))) (find-brace (binary-search 0 glyph-count get-y-from-brace scaled-size)) (glyph-found (glyph find-brace))) (if (or (null? (ly:stencil-expr glyph-found)) (< scaled-size (interval-length (ly:stencil-extent (glyph 0) Y))) (> scaled-size (interval-length (ly:stencil-extent (glyph glyph-count) Y)))) (begin (ly:warning (_ "no brace found for point size ~S ") new-height) (ly:warning (_ "defaulting to ~S pt") (/ (* scale (interval-length (ly:stencil-extent glyph-found Y))) (ly:pt 10))))) glyph-found)) (let* ((line-thickness (ly:output-def-lookup layout 'line-thickness)) (size (ly:output-def-lookup layout 'text-font-size 12)) ;; Numerical values taken from the IR ;; making them overrideable (kern (or kern (* line-thickness 3.0))) (thin-thickness (or thin-thickness (* line-thickness 1.9))) (thick-thickness (or thick-thickness (* line-thickness 6.0))) (blot (ly:output-def-lookup layout 'blot-diameter)) ;; Not sure about the numerical value, found it by try and error. (thin-bar-line (ly:stencil-aligned-to (make-bar-line thin-thickness (/ size 9) font-size blot) Y CENTER)) (thick-bar-line (ly:stencil-aligned-to (make-bar-line thick-thickness (/ size 9) font-size blot) Y CENTER)) (colon-bar-line (ly:stencil-aligned-to (make-colon-bar-line (/ size 9) font-size) Y CENTER)) (bracket-left-bar-line (ly:stencil-aligned-to (make-bracket-bar-line (/ size 9) font-size -1 thick-bar-line) Y CENTER)) (bracket-right-bar-line (ly:stencil-aligned-to (make-bracket-bar-line (/ size 9) font-size 1 thick-bar-line) Y CENTER)) (brace-left-bar-line (ly:stencil-aligned-to (make-brace-bar-line (/ size 9) font-size) Y CENTER)) (strg-list (string->string-list strg)) (find-bar-line-proc (lambda (x) (cond ((string=? ":" x) colon-bar-line) ((string=? "|" x) thin-bar-line) ((string=? "." x) thick-bar-line) ((string=? "[" x) bracket-left-bar-line) ((string=? "]" x) bracket-right-bar-line) ((string=? "{" x) brace-left-bar-line) (else empty-stencil)))) (bar-line-stils (remove ly:stencil-empty? (map find-bar-line-proc strg-list))) (stil (stack-stencils X RIGHT (* (magstep font-size) kern) bar-line-stils)) (stil-y-length (interval-length (ly:stencil-extent stil Y)))) ;; Hm, should the stencil-translate be hard-coded? (ly:stencil-translate-axis stil 0;(/ stil-y-length 4) Y))) %% The BarLine to add is defined using the markup-command \bar-line, %% It depends of 'start-bar-length' (y-length) %% 'kern' (kerning) %% 'start-bar-type (type) %% 'thick-thickness (harcoded thick-thickness) #(define (start-bar-markup kern start-bar-length thick-thickness start-bar-type) #{ \markup \with-dimensions #(cons kern kern) #'(0 . 0) \override #`(add-height . ,start-bar-length) \override #`(thick-thickness . 0.5) \bar-line #start-bar-type #}) %% The 'markup' is turned into a stencil and moved in %% Y-direction to fit. #(define ((new-start-bar start-bar-length markup) grob) (let* ((layout (ly:grob-layout grob)) (staff-space (ly:output-def-lookup layout 'staff-space)) (size (ly:output-def-lookup layout 'text-font-size 12)) (line-thickness (ly:output-def-lookup layout 'line-thickness)) (new-start-bar-stil (grob-interpret-markup grob markup)) (new-stencil (ly:stencil-combine-at-edge (ly:bar-line::print grob) X LEFT (ly:stencil-translate-axis new-start-bar-stil (+ staff-space (/ line-thickness 2) (/ (+ start-bar-length (/ size 9)) -2)) Y) 0))) new-stencil)) addBar = #(define-music-function (kern start-bar-type start-bar-length) (number? string? number?) " Adds a custom-bar-line to @code{\\bar "|"}. @var{kern} is for kerning @var{start-bar-type} determines the type @var{start-bar-length} determines the Y-length Also, other settings are used to fake the appearence of a starting system. Using custom-staff-sizes or other global-staff-size will result in the need to readjust the value for @var{start-bar-length} " #{ \once \override Staff.BarLine.stencil = #(new-start-bar start-bar-length (start-bar-markup kern start-bar-length 0.5 start-bar-type)) \once\override Score.BarLine.hair-thickness = #1.6 \once\override Score.SpanBar.hair-thickness = #1.6 \once\override Score.BarLine.Y-extent = #'(0 . 0) \bar "|" \rochadeAlpha \once\override Score.RehearsalMark.self-alignment-X = #LEFT #}) space = #(define-music-function (width) (number?) " Adding a gap of width @var{width} into a StaffSymbol. Only works in the middle of a Staff. SpanBars are forced. Ofcourse this will only work, if the Span_bar_engraver is present. " #{ \noBreak \staffStop \onceTextLengthOn s1*1/1000000-\markup \with-dimensions #(cons 0 width) #'(0 . 0) \null \once \override Staff.BarLine.allow-span-bar = ##t \once \override Score.Clef.font-size = #'2 \staffStart \noBreak #}) noSpan = \with { \override BarLine.allow-span-bar = ##f } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Début de la partition de Gérard %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \header { title = "Espaňa" instrument = "Accordéon" composer = "E. Chabrier" tagline = " Gravé avec LilyPond, un logiciel gratuit et libre (http://lilypond.org)" } \paper { system-system-spacing.padding = #0 oddFooterMarkup = \markup \fill-line { \center-column { \line { \fontsize #-4 \fromproperty #'header:title } \on-the-fly #last-page \line { \fontsize #-1 \fromproperty #'header:tagline } \italic \line { \fontsize #-1 { GR le #(strftime "%d %m %y" (localtime (current-time))) } } } } } \layout { \context { \Score \consists "Span_bar_engraver" } \context { \ChordNames %% pour imprimer le signe "coda" -vv \consists "Text_engraver" %% noms des accords en français \frenchChords \override ChordName.font-family = #'serif \override ChordName.extra-offset = #'(-1 . 0) } \override Score.BarNumber.color = #red \override Score.BarNumber.font-shape = #'italic \override Score.BarNumber.font-size = #0.2 ragged-last = ##t } logo= \markup { \with-dimensions #'(0 . 0) #'(0 . 0) { \translate #'(2 . -1) %% Vérifier le chemin, puis décommenter (-vv) ""%\epsfile #X #15 #"../accordéon.eps" }} codaBreak = { \stopStaff \cadenzaOn s1 \once \override BreathingSign.X-extent = #'(0 . 12) \once \override BreathingSign.transparent = ##t \breathe s \cadenzaOff \startStaff \set Staff.forceClef = ##t \once \override Staff.Clef.full-size-change = ##t } %%% extension du LaissezVibrer xLV = #(define-music-function (parser location further) (number?) #{ \once \override LaissezVibrerTie.X-extent = #'(0 . 0) \once \override LaissezVibrerTie.details.note-head-gap = #(/ further -2) \once \override LaissezVibrerTie.extra-offset = #(cons (/ further 2) 0) #}) global = { \key f \major \time 3/4 \tupletUp \defineBarLine ";;" #'(";;" "" ";;") } right = \relative c'' { \global r4 f8_4 f f4 r << {d^2 ( c_3)} \\ {a2_1} >> r4 e'8_4 e e4 r << {d^3 ( c_1)} \\ {bes2_2} >> r4 e8_4 e e4 r << {d^3 ( e_4} \\ bes2_2 >> << f'2.^3) ~ \\ a,2._1 ~ >> << f'4 \\ a,4 >> r r\bar "||" \mark \markup \musicglyph #"scripts.segno" r4 f'8_4 f f4 d8_3 d d4 c_2 c d8_3 d d4 e_4 ( d_3^.) c_2^. c_2 c8 c c4 d8_3 d d4 e_4 e4_3 f8_4 f f4 e8_3 e e4 c_1 c f8_4 f f4 d8_3 d d4 c_2 c d8_3 d d4 e_4 ( d_3^.) c_2^. c c8 c c4 d8_3 d d4 e_4^\markup "3ème fois" \mark \markup \musicglyph #"scripts.coda" e4 e8 e c4 \set Score.repeatCommands = #' ((volta "1°")) f_4^^ d_3 ( c_2) \set Score.repeatCommands = #' ((volta #f)) \bar ":|." \set Score.repeatCommands = #' ((volta "2°")) f_4^^^\markup {\italic Fin}\bar ";;" a_5 ( g_4 \set Score.repeatCommands = #' ((volta #f)) \bar ".|:" f_3^^ d_2 c_1 f,_2 a_1 c_3 e8_4) r \tuplet 3/2 {d8 ( e d} c4 ~ c4) d_3 ( g_5 e_4 d_3 g,_2 c_1 d_2 e_3) f8_4 e_2 f_3 g_4 a4_5 r4 a_5 ( g_4 f_3 d_2 c_1 f,_2 a_1 c_3 e8_4) r \tuplet 3/2 {d8 ( e d} c4 ~ c4) d_3 ( g_5 e_4 d_3 g,_2 c_1 d_2 e_3) \set Score.repeatCommands = #' ((volta "1°")) f8_4^> g_5 f_4 e_3 f4_4^> r4 \xLV #6 a_5 \laissezVibrer g_4 \break \set Score.repeatCommands = #' ((volta #f))\bar ":|." \set Score.repeatCommands = #' ((volta "2°")) 2. ~ \key f \major q4 r r \set Score.repeatCommands = #' ((volta #f)) \bar "||" \mark \markup \musicglyph #"scripts.segno" } left = \relative c' { \global \clef F f,,4_4 f'_3 f c_2 f_3 f g,_3 c'_2 c c,_4 c'_2 c g,_4 g'_2 g-"B.S." c,_4 d_2 e_4 f_5 c_4 a_5 r 4 f,_4 f'_3 f c_2 f_3 f f,_4 f'_3 f-"B.S." c_3 f,_4 fis_2 g_3 c'_2 c c,_4 c'_2 c g, c' c c, c' e,, f f' f c f f f, f' f-"B.S." c_3 f,_4 fis_2 g c' c c, c' c g, c' g_3 ges_2 r r f f' f << {r d_3 aes_5} \\ {a2_4 s4} >> g4_3 c'_2 c c,_4 c'_2 c g,_3 c'_2 c c, c' c f,, f' f-"B.S." c_3 d_5 e_3 f,_4 f'_3 f d,_4 d'_2 d g,_4 g'_2 g c,_4 c'_2 c g,_3 c'_2 c c,_4 c'_2 e,,_5 f f' r c' e f, c'_3 a_4 r } accords = \chordmode { f2. s c:7 s g:m c:7 f s2 c4:7 f2. s s s c:7 s s s f s s s c:7 s s f f f s c:7 s c:7 s f s f d:m c:7/g c:7 c:7 s f s f s2 c8:7 s } codaAccords = \chordmode { c2.:7 f bes g:7 c:m f:7 c:m f:7 bes s bes g:7 c:m f:7 c:m f:7 bes s bes f d:7 c:7/g c:7 c:7 s f s f s c:7 s g:m7 c:7 f s4 c2:7 f2. s2 c4:7 } codaRight= \relative c' { \clef G \key f\major e'4_4 e8 e c4_2 f8_4^>\noBeam f,_2\noBeam g_3 a_1 bes_3 c_1 \bar "||" \key bes \major \bar".|:" d4_2 \( g2_5 ( g4)\)f_4 \( d_2 es8_3 f_4 g2_5 ( g4) \) c,_2 \( d_3 es_1 f_2 ( g_3) g\) a2_4^> bes8_5^^ r a_4 g_3 f4_2 r g_4 ( f_3) d_2 \( g2_5 ( g4) \) f_4 \( d_2 es8_3 f_4 g2_5 ( g4) \) c,_2\( d_3 es_1 f_2 g_3 ( g)\) a2_4^> bes2._5 \set Score.repeatCommands = #' ((volta "1°")) bes8 r g4_4 f_3 \set Score.repeatCommands = #' ((volta #f)) \bar ":|." \set Score.repeatCommands = #' ((volta "2°")) bes8_2\repeatTie r c,8_3 c_2 c_3 c_2\bar ".|:-||" \break \set Score.repeatCommands = #' ((volta #f)) \key f \major d4_4^. c8_3 bes_2 a4_1 r4 a8_3 a_2 a_3 a_2 a4_3 g8_2 a_3 bes4_4 r4 bes8_4 bes_3 bes_4 bes_3 c4_4^. bes8_3 a_4 g4_3 r g8_3 g_2 g_3 g_2 g4_3 f8_2 g_3 a4_4 r c8_4 c_3 c_4 c_3 d4_4^. c8_3 bes_2 a4_1 r f'8_4 f_3 f_4 f_3 f4_4^. c8_2 d_3 e4_4 r g8_4 g_3 g_4 g_3 g4_4^. d8_2 e_3 f4_4 e_3 d_2 c_1 \set Score.repeatCommands = #' ((volta "1°")) d4_2^. c8_1 bes_2 a'4_1 r c,8_2 c_3 c_2 c_3 \set Score.repeatCommands = #' ((volta #f)) \bar ":|." \set Score.repeatCommands = #' ((volta "2°")) f2._4 f4 r r \set Score.repeatCommands = #' ((volta #f)) \bar "||" \mark \markup \musicglyph #"scripts.segno" } codaLeft = \relative c { \clef F \key f\major g c' 8 r r4 r \key bes \major << {r4 bes'_3 bes} \\ {bes,2._4} >> << {r4 g'_2 g} \\ {b,2._4} >> c4_4 c'_2 c f,,_4 f'_2 f c_4 c'_2 c f,,_4 f'_2 f bes,_4 bes'_3 bes f,_2 bes'_3 bes << {r4 bes_3 bes} \\ {bes,2._4} >> << {r4 g'_2 g} \\ {b,2._4} >> c4_4 c'_2 c f,,_4 f'_2 f c_4 c'_2 c f,,_4 f'_2 f-"B.S." bes,_4 f'_3 d_5 8 r r4 r 8 r r4 r \key f \major f_4 f'_3 f fis,_4 d'_2 d g,_3 c'_2 c c,_4 c'_2 c g, c' c c, c' c f,, f' f c_2 f_3 f f,_4 f'_3 f c_2 f_3 f g,_3 c'_2 c c,_4 c'_2 c g, c' c c, c' c f,, f' r < c' c'>2 -"B.S." f,4 c' a r } \logo \score { \new PianoStaff \with { midiInstrument = "accordion" } << \new Staff { \right \codaBreak \addBar #0.3 "{" #13.25 \codaRight } \new ChordNames \with { midiInstrument = "music box" midiMaximumVolume = #80 } { \accords s1^\markup \center-column { \hspace #1 "CODA" \musicglyph #"scripts.coda" } s \codaAccords } \new Staff { \left \codaBreak \codaLeft } >> \layout { } \midi { \tempo 4=100 } } %%%%