Autor Thema: Wieder mal Scheme - for-each und define-music-function  (Gelesen 4477 mal)

Manuela

  • Member
Re: Wieder mal Scheme - for-each und define-music-function
« Antwort #15 am: Donnerstag, 24. März 2016, 17:27 »
Für die anderen Fragen, ich brauch mal ne' Pause ;)

Die hast du dir mehr als verdient  :D

Nur um zu illustrieren, worum es mir geht. Das folgende Gebilde würde ich gerne transponieren, und es wäre schön, wenn die Beschriftungen, die jetzt hart verdrahtet sind, auch mittransponiert würden.
Aber lass dir bitte Zeit, ich drehe jetzt auch gleich den Blechtrottel ab und widme mich meinem Piano.
\version "2.19.32"

FootLeft = #(string-append "" )
FootCenter = #(string-append "")
FootRight = #(string-append "gesetzt mit LILYPOND " (lilypond-version) " am " (strftime "%d.%m.%Y %H:%M:%S" (localtime (current-time))))



\language "deutsch"

\include "Schemes.ily"

\paper {
  #(set-paper-size "a4")
  left-margin = #30
  top-margin = #20
  %line-width = #50
  indent = #'0
  %ragged-right=##f
  % annotate-spacing = ##t
  oddFooterMarkup = \markup \fill-line {
    \abs-fontsize #9 { \FootLeft }
    % \abs-fontsize #7.0 { \italic { \FootCenter } }
    \abs-fontsize #9 { \FootRight }
  }
  #(define page-breaking ly:minimal-breaking)
}


\bookpart
{
  \markuplist
  {
     \vspace#1
    \abs-fontsize #12
    {
      \bold \smallCaps
      "Der verminderte Septakkord auf His/Dis/Fis/A"
    }

    \vspace#1
    \justify {
      \override #'(line-width . 40)
      \score {
        \new StaffGroup
        \with
        {
          \remove "System_start_delimiter_engraver"
        }
        <<
          \new Staff
          \with {
            \remove "Time_signature_engraver"
            %\remove "Clef_engraver"
            %\remove "Bar_engraver"
          }
          \relative c' {
            \override Staff.InstrumentName.font-size = #1
            \override Staff.InstrumentName.self-alignment-X = #RIGHT
            \set Staff.instrumentName= "Grundton His"

            < \tweak color #blue his dis fis a >  < dis fis a \tweak color #red his >
            < fis a \tweak color #red his dis >  < a \tweak color #red his dis fis >
            \stopStaff
            \override TextScript #'padding = #-1
            \override TextScript #'staff-padding = #'()
            \override TextScript #'outside-staff-priority = ##f
            s1^\markup {
              \override #'(line-width . 10)
              \fill-line {
                \column {
                  \line {
                    \fontsize #'2 "Cis-Moll "
                  }
                }
              }
            } s1 s1 \key cis \minor
          }

          \new Staff
          \with {
            \remove "Time_signature_engraver"
            %\remove "Clef_engraver"
            %\remove "Bar_engraver"
          }
          \relative c'  {
            \override Staff.InstrumentName.font-size = #1
            \override Staff.InstrumentName.self-alignment-X = #RIGHT
            \set Staff.instrumentName= "Grundton Dis"
            < c \tweak color #red dis fis a >  < \tweak color #blue dis fis a c >
            < fis a c \tweak color #red dis >  < a c \tweak color #red dis fis >
            \stopStaff
            \override TextScript #'padding = #-1
            \override TextScript #'staff-padding = #'()
            \override TextScript #'outside-staff-priority = ##f
            s1^\markup {
              \override #'(line-width . 10)
              \fill-line {
                \column {
                  \line {
                    \fontsize #'2 "E-Moll "
                  }
                }
              }
            } s1 s1 \key e \minor s1
          }
          \new Staff
          \with {
            \remove "Time_signature_engraver"
            %\remove "Clef_engraver"
            %\remove "Bar_engraver"
          }
          \relative c'  {
            \override Staff.InstrumentName.font-size = #1
            \override Staff.InstrumentName.self-alignment-X = #RIGHT
            \set Staff.instrumentName= "Grundton A"
            < c es ges \tweak color #red a >  < es ges \tweak color #red a c >
            < ges \tweak color #red a c es >  < \tweak color #blue a c es ges >
            \stopStaff
            \override TextScript #'padding = #-1
            \override TextScript #'staff-padding = #'()
            \override TextScript #'outside-staff-priority = ##f
            s1^\markup {
              \override #'(line-width . 10)
              \fill-line {
                \column {
                  \line {
                    \fontsize #'2 "B-Moll "
                  }
                }
              }
            } s1 s1 \key b \minor s1
          }
          \new Staff
          \with {
            \remove "Time_signature_engraver"
            %\remove "Clef_engraver"
            %\remove "Bar_engraver"
          }
          \relative c'  {
            \override Staff.InstrumentName.font-size = #1
            \override Staff.InstrumentName.self-alignment-X = #RIGHT
            \set Staff.instrumentName= "Grundton Fis"
            < c es \tweak color #red fis a >  < es \tweak color #red fis a c >
            < \tweak color #blue fis a c es >  < a c es \tweak color #red fis >
            \stopStaff
            \override TextScript #'padding = #-1
            \override TextScript #'staff-padding = #'()
            \override TextScript #'outside-staff-priority = ##f
            s1^\markup {
              \override #'(line-width . 10)
              \fill-line {
                \column {
                  \line {
                    \fontsize #'2 "G-Moll "
                  }
                }
              }
            } s1 s1 \key g \minor s1
          }
        >>
        \layout { indent = #'30 }
      }
    }
  }
}

Und hier noch die Include Datei (die habe ich von irgendwoher):

\version "2.19.32"

#(define (string->string-list strg)
   (define (helper-1 strg ls)
     "
    Converts a string into a list of strings,
    every string of the list has string-length 1
    e.g "1234" -> '("1" "2" "3" "4")
    "
     (if (= (string-length strg) 0)
         (begin
          (set! ls '(""))
          ls)
         (begin
          (set! ls (cons (substring strg 0 1) ls))
          (if (>= (string-length (string-drop strg 1)) 1)
              (helper-1 (string-drop strg 1) ls)
              (reverse ls)))))

   (if (string? strg)
       (helper-1 strg '())
       strg))

#(define (proc l1 l2)
   "
    l1 is supposed to be a list of strings.
    proc will return a new list l2, build of the
    elements of l1.
    Every string of l2 has string-length 1
    e.g '("12" "34") -> '("1" "2" "3" "4")
    "
   (if (null? l1)
       l2
       (begin
        (set! l2 (append l2 (string->string-list (car l1))))
        (proc (cdr l1) l2))))

#(define (stack-chars stencil stils kern)
   (set! stencil (ly:stencil-combine-at-edge stencil X RIGHT (car stils) kern))
   (if (null? (cdr stils))
       stencil
       (stack-chars stencil (cdr stils) kern)))

#(define-markup-command (char-space layout props nmbr args)(number? markup-list?)
   (let* ((new-args (list-join args " "))
          (args+ (reverse (cons " " (reverse new-args))))
          (argls (proc args+ '()))
          (stils (map (lambda (x)(interpret-markup layout props x)) argls))
          (new-stils (reverse (cdr (reverse stils)))))

     (stack-chars empty-stencil new-stils nmbr)))

chExceptionMusic = {
  <c es ges>1-\markup { \super "dim" }
  <c e gis>1-\markup { \super "maj" }
  <c e geses>1-\markup { \super "ddim" }
  <c eses ges >1-\markup { \super "dddim" }
  <c e g h>1-\markup { \super "maj7" }
  <c es g h>1-\markup { "m" \super "maj7" }
  <c es ges h>1-\markup { "m" \super { "maj7" \flat "5" } }
  <c e  ges h>1-\markup { \super { "maj7" \flat "5" } }
  <c es ges heses>1-\markup { \super "dim7" }
  <c e g h d'>1-\markup { \super "maj9" }
  <c e g b d' f a' >1-\markup { \super "13" }
  %<c e g  d' >1-\markup { \super "add9" }
  <c e g b des' as' >1-\markup { \super {  \flat "9"  \flat 13 } }
  <c e g b d' a' >1-\markup { \super "13" }
  <c e g a d'>1-\markup { \super "6(add9)" }
}

% Convert music to list and prepend to existing exceptions.
chExceptions = #( append
                  ( sequential-music-to-chord-exceptions chExceptionMusic #t)
                  ignatzekExceptions)

chExceptions = #( append
                  ( sequential-music-to-chord-exceptions chExceptionMusic #t)
                  ignatzekExceptions)