2013/12/14 Henning Hraban Ramm <lilypon...@fiee.net>:
> Hi,
> someone of you wrote the following function for me some year before, that 
> allows me to set minor chords in lowercase instead of attaching „m“:
>
> #(define (conditional-string-downcase str condition)
>   (if condition
>       (string-downcase str)
>       str))
>
> #(define (pitch-alteration-semitones pitch)
>  (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))

   ....

> My only problem with that is, that es major is now displayed as „Ees“ instead 
> of just „Es“.
> I guess I just need a (case within (= alteration FLAT), but I still don’t 
> speak Lisp (yet)...
>
>
> Greetlings, Hraban

Hi Hraban,

maybe the attached file may give you what you want.
It puts out german chordnames using
e, eis, es, eses
a, ais, ases
h, b, heses
You can choose upcase with "m" for minor-chords or downcase.
Additional bass is downcase.

Cheers,
  Harm
\version "2.14.2"
% up to "2.17.29"

#(set-global-staff-size 19)

% German Chord-Names using the german Note-Names (no sharp- or flat-Symbol),
% with the possibility of lowercase output.
	     
% After -> http://lists.gnu.org/archive/html/lilypond-user/2009-09/msg00622.html

#(define ((chord-name->my-german-markup-text-alteration) 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)
        str))
      
   (let* ((name (ly:pitch-notename pitch))
          (alt-semitones  (pitch-alteration-semitones pitch))
          ;; The following condition is weird. Though, we let them in to ease
          ;; comporability with the original.
          (n-a (cond ((member (cons name alt-semitones) `((6 . -1) (6 . -1)))
                      (cons 7 alt-semitones))
                     (else (cons name alt-semitones)))))
    (make-line-markup
     (list
      (make-simple-markup
       (conditional-string-downcase
        (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
       lowercase?))
      (let ((alteration (/ (cdr n-a) 2)))
        (cond
           ((and (= 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))))))) 
  
%% Not really needed, a little shorter, though
#(define myGermanChords (chord-name->my-german-markup-text-alteration))

%%%%%%%%%%%%
%% Test
%%%%%%%%%%%%

  \layout {
    ragged-right = ##f
    indent = 0
  }

myLayoutOne =
  \layout {
    \context { 
        \ChordNames
        chordNameLowercaseMinor = ##t
        chordRootNamer = #myGermanChords
        chordNoteNamer = #note-name->german-markup
    } 
  }
  
myLayoutTwo =
  \layout {
    \context { 
        \ChordNames
        chordNameLowercaseMinor = ##f
        chordRootNamer = #myGermanChords
        chordNoteNamer = #note-name->german-markup
    } 
  }
            
myMajorChords = \chordmode{
  c:7 cis d dis e eis f fis g gis a ais b bis c/bes
  \break
  c ces b bes a aes g ges f fes e ees d des c
  \break
  cisis disis eisis fisis gisis aisis bisis
  \break
  ceses deses eeses feses geses aeses beses
}

myMinorChords = \chordmode{
  c:m7 cis:m d:m dis:m e:m eis:m f:m fis:m g:m gis:m a:m ais:m b:m bis:m c:m/b
  \break
  c:m ces:m b:m bes:m a:m aes:m g:m ges:m f:m fes:m e:m ees:m d:m des:m c:m
  \break 
  cisis:m disis:m eisis:m fisis:m gisis:m aisis:m bisis:m 
  \break
  ceses:m deses:m eeses:m feses:m geses:m aeses:m beses:m
}

\score {
        \new ChordNames { 
          \myMajorChords
        }
        \layout { \myLayoutOne }
        \header { 
          piece = \markup \column \bold { "Major Chords (german)" \vspace #2 } 
        }
}

\score{ 
        \new ChordNames {
          \myMinorChords
        }
        \layout { \myLayoutOne }
        \header {
          piece = \markup \column \bold { "Minor Chords 1 (german)" \vspace #2 } 
        }
}

\score{ 
        \new ChordNames {
          \myMinorChords
        }
        \layout { \myLayoutTwo }
        \header { 
          piece = \markup \column \bold { "Minor Chords 2 (german)" \vspace #2 } 
        }
}


_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to