Fuga c moll (BWV 847)

Zur Navigation springen Zur Suche springen

staffup       = { \change Staff = "right" \voiceTwo }
staffdown     = { \change Staff = "left" \voiceOne }

sopran = \relative {
  \key es \major
  s8 g''16-4 fis g8 c, es g16 fis! g8 a
  d,8 g16 fis g8 a c,16 d es4 d16 c

%%% 5
  b8 es16 d es8 g, as f'16 es f8 a,
  b8 g'16 f g8 h, c d16 es f4~
  f8 es16 d c b! as g f8 as' g f
  es d es f h, c d h
  c8 g'16 fis g8 d es4 g8\rest e-5

%%% 10
  f8-2-5 f16 e f8 c-1-3 d4 f8\rest d-1-5
  es8-2-5 es16 d es8 b-1-3 c es16-2-4 d!-1-4 es8 f
  b,8 es16 d es8 f as,16 b c4 b16 as
  g16 es f g as b c d es d c d es f g a
  b16 f, g as! b c d! e f es d es f g a h

%%% 15
  c8 h16 a g f! es d c8[ es-2-5 d-2-5 c-3-5]
  b8-1-4 a-2-3 b-2-4 c-3-5 fis,!-1-3 g-3-5 a!-3-5 fis
  g8-2-5 d'16 c d8 r r e16 d e8 r
  r fis16 e fis8 r f\rest g,16-3-5 f! g8 r
  r a16 g a8 r r h16 a h8 r

%%% 20
  r8 c16-4 h c8 g as c16-2-4 h! c8 d
  g,8-1-2 c16 h c8 d f,16 g as4 g16 f
  es8 c'16 h c8 g-1-3 as4 r8 a-1-4
  b8-2-5 b16 a b8 f g4 r8 g-2-5~
  g8 as16-3 b c-5 h c as-3 f2~-4

%%% 25
  f8 d'16 c d8 f,-3 es es'16 d es8 g,-1-3
  f8 f'16 es f8 as,-1-3 g16 f' es d c h a-2-4 g
  c8[-1-5 f es d] r as-1-5[ g f]
  g8-1-5 f16-1-4 es f8 d as'-1-5 g-2-5 r a-4
  h8 c f,16-5 es d c-2 c8-1 c'16[ h] c8 g
%%% 30
  as8 c16 h c8
  \once \override Staff.AccidentalPlacement.positioning-done = ##t
  \once \override Accidental.X-offset = #-1.8
  < h! d >-4-5 g-1-3 c16 h c8 d
  f,16 g as4 g16-5 f e2\fermata

% Append markup in the text property to the grob
#(define (append-markup grob old-stencil)
    old-stencil X RIGHT (ly:text-interface::print grob)))

bassToTreble = {
  \clef treble
  % Fake staff clef appearance
  \once \override Staff.Clef.glyph-name = #"clefs.F"
  \once \override Staff.Clef.Y-offset = #1
  % Make sure any key signatures will printed with respect to
  % correct middle c position expected for bass clef
  \once \set Staff.middleCClefPosition = 6
  % Append change clef to the time signature
  \once \override Staff.TimeSignature.text = \markup {
    \hspace #1.2
    \lower #1
    \musicglyph "clefs.G_change"
  \once \override Staff.TimeSignature.stencil = #(lambda (grob)
                                                   (append-markup grob (ly:time-signature::print grob)))

alt = \relative {
  r8 c''16-2 h c8 g as c16 h c8 d
  g,8 c16 h c8 d f,16-4 g as4 g16 f
  es16 c' h a g f! es d c8[ es'-2 d-1 c]
  b8[ a b c]-1 fis,[-3 g a fis]

%%% 5
  g4 es16\rest c d es f g as8~ as16 d, es f

  g16 a b8~ b16 es,-5 f g as g-1 f es d8
  c'16 h!
  c4 c,4\rest c8\rest f' es d
  g,8\rest as g f g f16 es f8 d
  g4 g8\rest h c c16^3 h! c8 g

%%% 10
  as4 g8\rest a b b16^3 a! b8 f
  g4 g8\rest g
  \set Voice.beatStructure = #'(2 2)
  as as g f
  c8\rest as b c c as16[ g]-1 as8 f
  b8 c b as b g f es
  f8 des' c b c as g f

%%% 15
  g8 g'16 fis g8 c, es \staffup

  g16 fis! g8 a
  d,8 g16 fis^1 g8 a! c,16 d^2 es4 d16 c^1
  \unset Voice.beatStructure
  b8 r r16 d e fis g-4 a-1 b8~ b16 e,! f g
  a16-4 b-1 c8~ c16 fis,-1 g a b8 es,!16 d es8 g,-1
  as!8-1 f'16 es f8 a,-1 b-1 g'16 f g8 h,

%%% 20
  c16\noBeam \staffdown f-1 es d c-1 b!-1 as-1-5 g-2
  \set Voice.beatStructure = #'(2 2)
  f8 \staffup as' g f
  es8 d es f h, c d h
  \unset Voice.beatStructure
  c4 r8 e f f16^3 e! f8 c
  d4 r8 d es es16 d es8 b
  c2~-1 c8 d16 es f es f d

%%% 25
  h8 r r h! c r r es
  d8 r r f~ f r r f
  es8[ as! g f] es-2[ d es f]
  h,8[ c d h!] h c s c
  f16 d es c~ c8 h c4 r8 e

%%% 30
  f4 r8
  \once \override Accidental.X-offset = #-.8
  < f as! >^1^2 f es16 d es8 <as f>
  <h, d>8 r <h d> r <g c>2

bass = \relative c {
  \key es \major
  s1 * 6
  \clef bass
  %\set Timing.beamExceptions = #'()

  r8 c'16-2 h c8 g as c16 h! c8 d
  g,8 c16 h c8 d f,16-4 g as4 g16 f
  es16 c' h a g-1 f es d c-5 d-3 es d c-1 b! as! g

%%% 10
  f16 b'-2 as g f es! d c b c d c b as g-1 f-4
  es16 as'-2 g f es des c b
  \set Voice.beatStructure = #'(2 2)
  as8 c' b as

  g8 f g as d, es-2-4 f d
  es8-1-4 as-1-3 g f g es-1-3 d c
  d8 b'-1-3 as g as f es d!

%%% 15
  es8 r8 r4 r8 c-3 b a
  r8 es' d c
  \unset Voice.beatStructure
  d-1 c16 b c8 d
  g,8 b'16-2 a b8 d, es c'16 b c8 e,
  f8 d'16 c d8 fis, g4 r16
  \voiceTwo g, a h
  c16 d es8^~ es16 a, b c d-1 es-2 f8^~ f16 h,^( c d

%%% 20
  \set Voice.beatStructure = #'(2 2)
  es8) r r e
  \once \override Beam.positions = #'(-1 . -1)
  f-1 \oneVoice f,_3 es! d
  r8 as' g f
  \unset Voice.beatStructure
  g-1 f16 es f8 g
  c16-4 d es d c-1 b! as  g f b'-2 as g f-1 es! d c
  b16 c d c b as g-1 f-4 es as'-2 g f es d c-1 b
  as16 b c b as g-1 f-3 es d g' f es d c h a

%%% 25
  g4 r r16 g a h c d es f
  g16 f-3 as-2 g-1 f es d c h8 c16 h c8 g as c16 h! c8 d
  g,8 c16 h c8 d f,16-4 g as4 g16 f
  es4 r8 es'

  d8_[ c g' g,] <c, c'>2~

%%% 30
  q \fermata

#(set-global-staff-size 20)
Struktur =
  \override Score.NonMusicalPaperColumn.page-break-permission = ##f
  \override Score.SpacingSpanner.common-shortest-duration = #(ly:make-moment 1/11)
  \time 4/4
  s1 * 15 \pageBreak

\paper {
  top-margin = 25\mm
  ragged-bottom = ##f
  ragged-last-bottom = ##f
  bottom-margin = 25\mm
  line-width = 175\mm
  indent = 10
  markup-system-spacing.padding = #1
  %system-system-spacing.padding = #6
  %markup-markup-spacing.padding = #3
  print-page-number = ##f

\header {
  title = "Fuga II"
  subtitle = "a 3 Voci"
  composer = "Johann Sebastian Bach"
  opus="BWV 847"

  tagline = ##f

\bookpart {
  \score {
    \new PianoStaff {
      \set PianoStaff.midiInstrument = "harpsichord"
        \new Staff = right <<
          \new Voice \sopran
          \new Voice \alt
          \new NullVoice \Struktur
        \new Staff = left {
          \new Voice \bass

#(set-global-staff-size 22)
#(define ((chord-name->german-markup-text-alteration B-instead-of-Bb) pitch lowercase?)

   (define (pitch-alteration-semitones pitch)
     (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))

   (define (conditional-string-downcase str condition)
     (if condition
         (string-downcase str)

   (let* ((name (ly:pitch-notename pitch))
          (alt-semitones  (pitch-alteration-semitones pitch))
          (n-a (if (member (cons name alt-semitones) `((6 . -1) (6 . -1)))
                   (cons 7 (+ (if B-instead-of-Bb 1 1) alt-semitones))
                   (cons name alt-semitones))))
         (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
       (let ((alteration (/ (cdr n-a) 2)))
          ((and (equal? lowercase? #f) (= alteration FLAT) (= (car n-a) 7)) (make-simple-markup ""))
          ((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2) )) (make-simple-markup "s"))
          ((= alteration FLAT) (make-simple-markup "es"))
          ((and (= alteration DOUBLE-FLAT) (or (= (car n-a) 5)(= (car n-a) 2) )) (make-simple-markup "ses"))
          ((= alteration DOUBLE-FLAT) (make-simple-markup "eses"))
          ((= alteration SHARP) (make-simple-markup "is"))
          ((= alteration DOUBLE-SHARP) (make-simple-markup "isis"))
          (else empty-markup)))))))

#(define germanChords (chord-name->german-markup-text-alteration #t))

make-midi-list =
#(define-void-function (name score tempolist)
   ((string? #f) ly:score? list?)
    (lambda (tempo)
        (list score))
         \midi {
           \tempo 4 = $tempo
       (format #f "~a_~a"
         (or name "midi")

editorsColor = #grey
ed =
#(define-music-function (grob col mus)
   (symbol-list-or-symbol? (color? editorsColor) ly:music?)
   ;; for abbreviations, we need a symbol instead of a one-element list
   (let ((grob (if (= 1 (length grob)) (car grob) grob)))
      ;; define abbreviations
      ;; which call the function recursively with a value
      ;; leading into the (else) clause
      ;; (or to _another_ abbreviation)
      ;; be careful to avoid infinite recursion :-)
      ;; – abbreviation names must not be actual grob names
      ;; (at least if they’re used in the corresponding
      ;; clause) or recursion will be infinite also
      ;; It is recommended to use singular forms only
      ;; for abbreviations.
      ((Caut) #{ \ed Staff.AccidentalCautionary #})
      ((LedgerLine) #{ % barline is workaround to issue 3949
        \ed Staff.LedgerLineSpanner {
        \startStaff #})
      ((Mmr) #{ \ed MultiMeasureRest $mus #})
      ((Note) #{ \ed Staff.Accidental
                 \ed Beam
                 \ed Dots
                 \ed Flag
                 \ed LedgerLine
                 \ed NoteHead
                 \ed Rest
                 \ed Stem $mus #})
      ((Pitch) #{ \ed NoteHead $mus #})
      ((Suggest) #{ \ed Staff.AccidentalSuggestion #})
      ((StemWithFlag) #{ \ed Stem \ed Flag $mus #})
      ((Tuplet) #{ \ed TupletNumber \ed TupletBracket $mus #})
      ;; ‘normal’ case
         \override $grob . color = #col
         \revert $grob . color

#(define new-stil
   (lambda (grob)
     (let* ((sz (ly:grob-property grob 'font-size 0.0))
            (mult (magstep sz))
            (dir (ly:grob-property grob 'direction))
            (thick 0.15)
            (radius 0.7)
            (scaled-radius (* mult radius))
             (format #f
             0 ~a translate
             ~a setlinewidth
             ~a 0 moveto
             0 0 ~a 180 0 ~a
               (* thick dir)
               (- scaled-radius)
               (if (negative? dir) "arcn" "arc"))))

        (list 'embedded-ps
          (format #f
              gsave currentpoint translate
        (cons (- scaled-radius) scaled-radius)
         (if (negative? dir) 0 (- scaled-radius))
         (if (negative? dir) scaled-radius 0))))))

soft =
-\tweak stencil #new-stil \fermata

#(define-markup-command (text-fromproperty layout props text-1 symbol text-2)
   (markup? symbol? markup?)
   #:category other
   (let ((m (chain-assoc-get symbol props)))
     (if (markup? m)
         ;; prevent infinite loops by clearing the interpreted property:
          (cons (list (cons symbol `(,property-recursive-markup ,symbol))) props)
          (make-concat-markup (list text-1 m text-2)))

klavier =
%% simple orgelsatz nur SATBs
#(define-music-function (sop alt ten bas stru)
   (ly:music? ly:music? ly:music? ly:music? ly:music?)
       \new PianoStaff="leadsheet"
         \new Staff="Discant"
           \new Voice="Alt" { $sop }
           \new Voice { $alt }
         \new Staff="Bass"
           \new Voice { $ten }
           \new Voice { $bas }
           \new NullVoice $stru

mynote =
#(define-music-function (m)
     \override Score.RehearsalMark.break-align-symbols = #'(time-signature)
     \once \override Score.RehearsalMark.self-alignment-X = #-1
     \mark \markup \fontsize #-3.5 \note { $m } #UP

oob = { \once \override Score.BarNumber.stencil = ##f \bar "" }
bnf = \once \override Score.BarNumber.stencil = ##f
#(use-modules (ice-9 regex))

dynamictext =
#(define-event-function (text) (markup?)
   (if (string? text)
       (let* ((underscores-replaced
                (lambda (x) (if (eq? x #\_) #\space x))
              (split-text (string-split underscores-replaced #\space))
              (formatted (map
                          (lambda (word)
                            (if (string-match "^[mrzfps]*$" word)
                                (markup #:dynamic word)
                                (markup #:normal-text #:italic word)))
           #(make-dynamic-script (make-line-markup formatted))
       ;; user provided a full-blown markup, so we don't mess with it:
         #(make-dynamic-script (markup #:normal-text text))

startMyGrace = {
  \temporary \override Slur.minimum-length = #0.1
  <>-#(make-music 'LaissezVibrerEvent)
  \revert Slur.minimum-length

myAcc =
#(def-grace-function startMyGrace stopSlashedGraceMusic)

dropLyrics =
#(define-scheme-function (amount) (number?)
     \override LyricText.extra-offset = #`(0 . ,amount)
     \override LyricHyphen.extra-offset = #`(0 . ,amount)
     \override LyricExtender.extra-offset = #`(0 . ,amount)
     \override StanzaNumber.extra-offset = #`(0 . ,amount)

raiseLyrics = {
  \revert LyricText.extra-offset
  \revert LyricHyphen.extra-offset
  \revert LyricExtender.extra-offset
  \revert StanzaNumber.extra-offset

%%% Liedverse Formatierung

#(define-markup-list-command (paragraph layout props args) (markup-list?)
   #:properties ((x-shift 2))
   (interpret-markup-list layout props
     (make-justified-lines-markup-list (cons (make-hspace-markup x-shift) args))))

#(define (numbering-start lst strt)
   "Returns a list of custom formated markups for numbers, relying on the length
of @var{lst}, starting with number 2"
   (if (eq? strt 0)
        (lambda (i)
          #{ \markup \concat \paragraph { " " } #})
        (iota (length lst)))
        (lambda (i)
          #{ \markup \concat \paragraph { \bold #(format #f "~2d. " i) } #})
        (iota (length lst) strt 1))))

#(define (equal-sized-splited-list lst n rl)
   "Split @var{lst} in equal sized parts of length @var{n}.
If @var{lst} is finally not empty add the remaining rest."
   (cond ((null? lst) (reverse rl))
     ((< (length lst) n) (reverse (cons lst rl)))
      (equal-sized-splited-list (drop lst n) n (cons (take lst n) rl)))))

columns-markup-list =
#(define-scheme-function (lines-per-verse ls)(index? markup-list?)
   "Returns a markup-list.  Each markup is done from a subset of @var{ls} under
control of @var{lines-per-verse}.  The markups are custom-formated using
@code{\\column-lines}, @code{\\column} and a hard-coded @code{baseline-skip} of
value 3"
   (let ((splitted-ls (equal-sized-splited-list ls lines-per-verse '())))
      (lambda (l)
        #{ \markup \override #'(baseline-skip . 3)
           %\override #`(font-name . ,myMin)
           \override \largerFont
           \column \column-lines $l #})
      splitted-ls) ))

formatAdditionalVerses =
#(define-scheme-function (center-overshoot number-start columns lst)
   ((boolean? #t) index? index? markup-list?)
   (let* ((numberings (numbering-start lst number-start))
            (lambda (x y)
                \override #'(baseline-skip . 3)
                \line {
                  \paragraph {
                    \overlay {
                      \right-align \transparent "222"
                      \right-align \number $x
          (lst-lngth (length lst))
           (if (and (odd? lst-lngth)
                    (= (remainder lst-lngth columns) 1)
               (drop-right new-list 1)
           (if (and (odd? lst-lngth)
                    (= (remainder lst-lngth columns) 1)
               (take-right new-list 1)
          (columns-format-list (make-list columns LEFT))
           #{ \markuplist {
             \override #'(font-size . -1)
             \table #columns-format-list #table-lst
           } #})
            (if odd-tail
                  \markuplist \override #'(font-size . -1)
                  %% hier nix ändern, das sind die Nummerierungen!!
                  \column-lines { \fill-line { \line { #odd-tail } } }

#(define-markup-list-command (paragraph layout props args) (markup-list?)
   #:properties ((x-shift 2))
   (interpret-markup-list layout props
     (make-justified-lines-markup-list (cons (make-hspace-markup x-shift) args))))

#(define (reorder-lists lists)
   ;; TODO better name and DOC
   (reorder-lists '((a) (b c) (d e f)))
   ->'(a b d "" c e "" "" f)"
   (let* ((max-length (apply max 0 (map length lists)))
            (lambda (l)
              (let ((length-diff (- max-length (length l))))
                (if (zero? length-diff)
                    (append l (make-list length-diff "")))))

     (define (new-lists lists rl)
       ;; TODO better name and DOC
       (new-lists '((a b c) (d e f) (g h i)) '())
       '((a d g) (b e h) (c f i))"
       (if (every null? lists)
           (reverse rl)
            (map cdr lists)
            (cons (map car lists) rl))))

     (apply append '() (new-lists equal-length-lists '()))))

#(define (numbering-start lst strt)
   "Returns a list of custom formated markups for numbers, relying on the length
of @var{lst}, starting with number 2"
   (if (eq? strt 0)
        (lambda (i)
          #{ \markup \concat \paragraph { " " } #})
        (iota (length lst)))
        (lambda (i)
          #{ \markup \concat \paragraph { \bold #(format #f "~2d. " i) } #})
        (iota (length lst) strt 1))))

formatTwoColumns =
#(define-scheme-function (trenner r-col r-start l-col l-start)
   ((string? " ") markup-list? index? markup-list? index?)
     \markuplist {
       %\override #`(font-name . ,myMin)
       %s\override \largerFont
       %\override #'(baseline-skip . 3)
       %\override #'(padding . 0)
       #'(1 -1 1 1 -1)
          ;; numbering is done for each list, because we can't warrant equal
          ;; length of each list
          (numbering-start r-col r-start)
          (make-list (length r-col) trenner)
          (numbering-start l-col l-start)

%% LSR 233 https://lsr.di.unimi.it/LSR/Item?id=233
hairpinWithCenteredText =
#(define-music-function (parser location text) (markup?)
    \once \override Voice.Hairpin.after-line-breaking = 
      #(lambda (grob)
        (let* ((stencil (ly:hairpin::print grob))
               (par-y (ly:grob-parent grob Y))
               (dir (ly:grob-property par-y 'direction))
                 (ly:output-def-lookup (ly:grob-layout grob) 'line-thickness))
               (new-stencil (ly:stencil-aligned-to
                   (ly:stencil-aligned-to stencil X CENTER)
                   Y dir
                           (+ (ly:staff-symbol-staff-space grob)
                              (/ staff-line-thickness 2)))
                           text)) X CENTER))
                 X LEFT))
               (staff-space (ly:output-def-lookup
                 (ly:grob-layout grob) 'staff-space))
               (par-x (ly:grob-parent grob X))
               (dyn-text (grob::has-interface par-x 'dynamic-text-interface))
                 (if dyn-text
                     (ly:stencil-extent (ly:grob-property par-x 'stencil) X))
                 (if dyn-text 
                     (+ staff-space dyn-text-stencil-x-length)
                     (* 0.5 staff-line-thickness)) 0)))
        (ly:grob-set-property! grob 'Y-offset 0)
        (ly:grob-set-property! grob 'stencil 
            x-shift X))))
\layout {
  \context {
    beamExceptions = #'()
    \override BreathingSign.text =
    \markup { \musicglyph "scripts.lvarcomma" }
    \override Stem.neutral-direction = #down
    \override Script.outside-staff-priority = #'()
    \override Script.padding = #1
    \override Tie.thickness = #1
    \override PhrasingSlur.thickness = #3
    \override Rest.voiced-position = #0
    \override MultiMeasureRest.expand-limit = #3
  \context {
    \name FirstVoice
    \alias Voice
  \context {
    \name SecondVoice
    \alias Voice
    \remove "Tuplet_engraver"
    \remove "Rest_engraver"
    \remove "Multi_measure_rest_engraver"
    %\override NoteHead.font-size = #smallerNoteHead
  \context {
    \override VerticalAxisGroup.staff-affinity = #CENTER
    \override LyricText.font-size = #-1.5
    \override StanzaNumber.font-size = #-1.5
  \context {
    printPartCombineTexts = ##f
    beamExceptions = #'()
    \override BreathingSign.text =
    \markup { \musicglyph "scripts.lvarcomma" }
    \override InstrumentName.font-features = #'("smcp")
    \consists #Span_stem_engraver
    \accepts FirstVoice
    \accepts SecondVoice
  \context {
    \override VerticalAxisGroup.remove-first = ##t
    skipBars = ##f
    \override MetronomeMark.font-size = #1
    \override MetronomeMark.font-shape = #'caps
    \override BarLine.thick-thickness = 5
    \override Timing.beamExceptions = #'()
    \override BarNumber.color = #(rgb-color 0.7 0.7 0.7)
    \override BarNumber.layer = #-200
    \override BarNumber.padding = #0.4
    \override BarNumber.outside-staff-priority =#'()
    \override BarNumber.after-line-breaking = ##f
    \override BarNumber.font-size = #-1
    \override BarNumber.font-series = #'bold
    \override BarNumber.self-alignment-X = #0
    \override BarNumber.break-visibility = #end-of-line-invisible
    \override SystemStartBar.collapse-height = #4

  \context {
    chordNameLowercaseMinor = ##f
    \remove Staff_performer
    chordRootNamer = #germanChords
    \override ChordName.font-name = #"Orator10 BT"
    chordNoteNamer = #(chord-name->german-markup #f)
    \override ChordName.X-offset =
    \override ChordName.self-alignment-X = #CENTER
    \override ChordName.font-name = #"Arial Narrow"
    \override ChordName.layer = #2
    \override ChordName.font-size = #-0.5
    noChordSymbol = ##f
  \context {
    \override StaffGrouper.staffgroup-staff-spacing.basic-distance = #2
    \override StaffGrouper.staffgroup-staff-spacing.minimum-distance = #0
  \context {
    \override SystemStartBracket.collapse-height = #4
    \override SystemStartBracket.thickness = #.2