Deutsches Lilypond Forum (Archiv)
Allgemein => Fragen zu Funktionen => Thema gestartet von: lc am Dienstag, 18. Dezember 2012, 23:38
-
Hallo,
ich suche nach einer Möglichkeit, Akkordsymbole so auszugeben, dass beispielsweise gis/H statt g#/H oder As/C statt Ab/C erscheint, ich hätte also gern die vollen Notennamen ohne Kreuz/B. Leider habe ich bisher nichts gefunden, das mir da weiterhilft - habt ihr einen Tip?
Danke,
lc
-
Hallo,
willkommen im Forum!
Zum Thema:
Ob ich den Code schon mal irgendwo gepostet hatte, weiß ich im Moment nicht.
Er gründet sich auf die Arbeit von Carl Sorensen (link im Code).
Es ist zwar \version "2.14.1" angegeben, er funktioniert jedoch unverändert auch mit 2.16.1 und 2.17.6.
\version "2.14.1"
#(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->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)
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))))
(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 (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))
%-------------------- Test -----------------------------------------------------
\layout {
ragged-right = ##f
indent = 0
}
myLayoutOne =
\layout {
\context {
\ChordNames
chordNameLowercaseMinor = ##t
chordRootNamer = #germanChords
chordNoteNamer = #note-name->german-markup
}
}
myLayoutTwo =
\layout {
\context {
\ChordNames
chordNameLowercaseMinor = ##f
chordRootNamer = #germanChords
chordNoteNamer = #note-name->german-markup
}
}
myMajorChords = \chordmode{
c 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:m 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
\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 } }
}
HTH,
Harm
-
Super, vielen Dank! Das ist genau das, wonach ich gesucht hatte! lc