Hallo,
hat etwas gedauert aber hier ein Vorschlag:
\version "2.14.2"
%% Only works for v2.14.x sufficiently!!
%% The following prints a warning to the terminal, if another version is used.
#(if (not (= (+ (* (car (ly:version)) 10) (cadr (ly:version))) 34))
(display "\n\tThis file gives sufficient out put with \"2.14.2\" only!"))
#(define (split-at-predicate pred lst)
"Split LST into two lists at the first element that returns #f for
(PRED previous_element element). Return the two parts as a pair.
Example: (split-at-predicate < '(1 2 3 2 1)) ==> ((1 2 3) . (2 1))"
(let ((i (and (pair? lst)
(list-index (lambda (x y) (not (pred x y)))
lst
(cdr lst)))))
(if i
(call-with-values
(lambda () (split-at lst (1+ i)))
cons)
(list lst))))
#(define (natural-chord-alteration p)
"Return the natural alteration for step P."
(if (= (ly:pitch-steps p) 6)
FLAT
0))
#(define (markup-join markups sep)
"Return line-markup of MARKUPS, joining them with markup SEP"
(if (pair? markups)
(make-line-markup (list-insert-separator markups sep))
empty-markup))
#(define (conditional-kern-before markup bool amount)
(if bool
(make-line-markup
(list (make-hspace-markup amount)
markup))
markup))
#(define (accidental->markup alteration)
(if (= alteration 0)
(make-line-markup (list empty-markup))
(conditional-kern-before
(alteration->text-accidental-markup alteration)
(= alteration FLAT) 0.2)))
#(define (pitch-step p)
"Musicological notation for an interval. Eg. C to D is 2."
(+ 1 (ly:pitch-steps p)))
#(define (get-step x ps)
"Does PS have the X step? Return that step if it does."
(if (null? ps)
#f
(if (= (- x 1) (ly:pitch-steps (car ps)))
(car ps)
(get-step x (cdr ps)))))
#(define (replace-step p ps)
"Copy PS, but replace the step of P in PS."
(if (null? ps)
'()
(let* ((t (replace-step p (cdr ps))))
(if (= (ly:pitch-steps p) (ly:pitch-steps (car ps)))
(cons p t)
(cons (car ps) t)))))
#(define (remove-step x ps)
"Copy PS, but leave out the Xth step."
(if (null? ps)
'()
(let* ((t (remove-step x (cdr ps))))
(if (= (- x 1) (ly:pitch-steps (car ps)))
t
(cons (car ps) t)))))
#(define (my-ignatzek-chord-names in-pitches bass inversion context)
(define (remove-uptil-step x ps)
"Copy PS, but leave out everything below the Xth step."
(if (null? ps)
'()
(if (< (ly:pitch-steps (car ps)) (- x 1))
(remove-uptil-step x (cdr ps))
ps)))
(define name-root (ly:context-property context 'chordRootNamer))
(define name-note
(let ((nn (ly:context-property context 'chordNoteNamer)))
(if (eq? nn '())
;; replacing the next line with name-root gives guile-error...? -rz
;; apparently sequence of defines is equivalent to let, not let* ? -hwn
(ly:context-property context 'chordRootNamer)
;; name-root
nn)))
(define (is-natural-alteration? p)
(= (natural-chord-alteration p) (ly:pitch-alteration p)))
(define (ignatzek-format-chord-name
root
prefix-modifiers
main-name
alteration-pitches
addition-pitches
suffix-modifiers
bass-pitch
lowercase-root?)
"Format for the given (lists of) pitches. This is actually more
work than classifying the pitches."
(define (filter-main-name p)
"The main name: don't print anything for natural 5 or 3."
(if
(or (not (ly:pitch? p))
(and (is-natural-alteration? p)
(or (= (pitch-step p) 5)
(= (pitch-step p) 3))))
'()
(list (name-step p))))
(define (glue-word-to-step word x)
(make-line-markup
(list
(make-simple-markup word)
(name-step x))))
(define (suffix-modifier->markup mod)
(if (or (= 4 (pitch-step mod))
(= 2 (pitch-step mod)))
(glue-word-to-step "sus" mod)
(glue-word-to-step "huh" mod)))
(define (prefix-modifier->markup mod)
(if (and (= 3 (pitch-step mod))
(= FLAT (ly:pitch-alteration mod)))
(make-simple-markup (if lowercase-root? "" "m"))
(make-simple-markup "huh")))
(define (filter-alterations alters)
"Filter out uninteresting (natural) pitches from ALTERS."
(define (altered? p)
(not (is-natural-alteration? p)))
(if
(null? alters)
'()
(let* ((lst (filter altered? alters))
(lp (last-pair alters)))
;; we want the highest also if unaltered
(if (and (not (altered? (car lp)))
(> (pitch-step (car lp)) 5))
(append lst (last-pair alters))
lst))))
(define (name-step pitch)
(define (step-alteration pitch)
(- (ly:pitch-alteration pitch)
(natural-chord-alteration pitch)))
(let* ((num-markup (make-simple-markup
(number->string (pitch-step pitch))))
(args (list num-markup))
(total
(if (= (ly:pitch-alteration pitch) 0)
(if (= (pitch-step pitch) 7)
(list (ly:context-property context 'majorSevenSymbol))
args)
(cons (accidental->markup (step-alteration pitch)) args))))
(make-line-markup total)))
(let* ((sep (ly:context-property context 'chordNameSeparator))
(root-markup (name-root root lowercase-root?))
(add-markups (map (lambda (x) (glue-word-to-step "add" x))
addition-pitches))
(filtered-alterations (filter-alterations alteration-pitches))
(alterations (map name-step filtered-alterations))
(suffixes (map suffix-modifier->markup suffix-modifiers))
(prefixes (map prefix-modifier->markup prefix-modifiers))
(main-markups (filter-main-name main-name))
(to-be-raised-stuff (markup-join
(append
main-markups
alterations
suffixes
add-markups) sep))
(base-stuff (if (ly:pitch? bass-pitch)
;; (list sep (name-note bass-pitch #f))
(list (name-note bass-pitch #f))
'()))
;; TODO: base-stuff is doubled, improve me!
(bass-stuff (if (ly:pitch? bass-pitch)
;; (list sep (name-note bass-pitch #f))
(list (name-note bass-pitch #f))
'())))
(set! base-stuff
(append
(list
(conditional-kern-before
(markup-join prefixes sep)
(and (not (null? prefixes))
(= (ly:pitch-alteration root) NATURAL))
(ly:context-property context 'chordPrefixSpacer))
(make-super-markup to-be-raised-stuff))
(if (null? base-stuff)
base-stuff
(reverse (cdr (reverse base-stuff))))))
;; Formatting the output-markup:
(let* ((arg-list
(list root-markup
(make-fontsize-markup -2 (make-line-markup bass-stuff))))
;; chrd-mrkp has to be defined different for v2.14, v2.16, 2.17
;; the following gives nice output for v2.14. only
(chrd-mrkp
(make-translate-markup '(0.9 . 0)
(make-override-markup '(baseline-skip . 2)
(make-line-markup
(list
(make-center-column-markup
(if (ly:pitch? bass-pitch)
arg-list
(reverse arg-list)))
(if (ly:pitch? bass-pitch)
(make-line-markup base-stuff)
(make-raise-markup -1.8
(make-column-markup
(list (make-line-markup base-stuff) " "))))))))))
chrd-mrkp)))
(define (ignatzek-format-exception
root
exception-markup
bass-pitch
lowercase-root?)
(make-line-markup
`(
,(name-root root lowercase-root?)
,exception-markup
.
,(if (ly:pitch? bass-pitch)
(list (ly:context-property context 'chordNameSeparator)
(name-note bass-pitch #f))
'()))))
(let* ((root (car in-pitches))
(pitches (map (lambda (x) (ly:pitch-diff x root)) (cdr in-pitches)))
(lowercase-root?
(and (ly:context-property context 'chordNameLowercaseMinor)
(let ((third (get-step 3 pitches)))
(and third (= (ly:pitch-alteration third) FLAT)))))
(exceptions (ly:context-property context 'chordNameExceptions))
(exception (assoc-get pitches exceptions))
(prefixes '())
(suffixes '())
(add-steps '())
(main-name #f)
(bass-note
(if (ly:pitch? inversion)
inversion
bass))
(alterations '()))
(if exception
(ignatzek-format-exception root exception bass-note lowercase-root?)
(begin
;; no exception.
;; handle sus4 and sus2 suffix: if there is a 3 together with
;; sus2 or sus4, then we explicitly say add3.
(map
(lambda (j)
(if (get-step j pitches)
(begin
(if (get-step 3 pitches)
(begin
(set! add-steps (cons (get-step 3 pitches) add-steps))
(set! pitches (remove-step 3 pitches))))
(set! suffixes (cons (get-step j pitches) suffixes)))))
'(2 4))
;; do minor-3rd modifier.
(if (and (get-step 3 pitches)
(= (ly:pitch-alteration (get-step 3 pitches)) FLAT))
(set! prefixes (cons (get-step 3 pitches) prefixes)))
;; lazy bum. Should write loop.
(cond
((get-step 7 pitches) (set! main-name (get-step 7 pitches)))
((get-step 6 pitches) (set! main-name (get-step 6 pitches)))
((get-step 5 pitches) (set! main-name (get-step 5 pitches)))
((get-step 4 pitches) (set! main-name (get-step 4 pitches)))
((get-step 3 pitches) (set! main-name (get-step 3 pitches))))
(let* ((3-diff? (lambda (x y)
(= (- (pitch-step y) (pitch-step x)) 2)))
(split (split-at-predicate
3-diff? (remove-uptil-step 5 pitches))))
(set! alterations (append alterations (car split)))
(set! add-steps (append add-steps (cdr split)))
(set! alterations (delq main-name alterations))
(set! add-steps (delq main-name add-steps))
;; chords with natural (5 7 9 11 13) or leading subsequence.
;; etc. are named by the top pitch, without any further
;; alterations.
(if (and
(ly:pitch? main-name)
(= 7 (pitch-step main-name))
(is-natural-alteration? main-name)
(pair? (remove-uptil-step 7 alterations))
(reduce (lambda (x y) (and x y)) #t
(map is-natural-alteration? alterations)))
(begin
(set! main-name (last alterations))
(set! alterations '())))
(ignatzek-format-chord-name
root prefixes main-name alterations add-steps suffixes bass-note
lowercase-root?))))))
#(define (note-name->hide pitch lowercase?) empty-markup)
%% after https://liarchiv.joonet.de/index.php?topic=1439.msg7927#msg7927
%% Thanks Torsten
hideRoot =
#(define-music-function
(parser location chords) (ly:music?)
#{
%% Chord-Root nicht anzeigen
\set chordRootNamer = #note-name->hide
%% hier kommt der Chord bzw die Chords
$chords
%% rückgängig
\unset chordRootNamer
#})
\layout {
\context {
\Score
chordNameFunction = #my-ignatzek-chord-names
chordRootNamer = #note-name->markup
chordNoteNamer = #note-name->german-markup
chordNameLowercaseMinor = ##t
chordNameSeparator = #(make-simple-markup "")
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%\paper { ragged-right = ##f }
<<
\new ChordNames
\chordmode {
c1:7
\hideRoot
{
c/b
c/a
c/g
c/f
c/e
c/d
}
c:7/c
g:7.9.11.13
c/c
}
\new Staff
\relative c' {
c1 c c c
c1 c c c
g c
}
>>Bedauerlicherweise ist LilyPond bei der Akkord-Formatierung doch recht unflexibel, deshalb ist der Code auch etwas länger geworden. Teilweise ist er auch etwas "gefummelt"

Neben der Neuformatierung der Akkorde ist auch eine Funktion von Torsten dabei (vielen Dank), mit der der Akkordname verborgen werden kann. Siehe auch seine Anmerkungen dazu
hier.Der Vorteil des Ganzen ist, daß Du die übliche Eingabesyntax für Akkorde benutzen kannst.
Allerdings ist der code auf die von Dir benutzte LilyPond-Version, 2.14.2, zugeschnitten. Mit anderen Versionen müßte einiges verändert werden, da bei einigen markup-commands im Laufe von 2.16, 2.17 einschneidende Veränderungen vorgenommen wurden.
Ich habe auch ein bißchen Code eingefügt der eine Warnung ins Terminal schreibt, falls eine andere Version als 2.14 verwendet wird. convert-ly wird
nicht helfen.
PNG im Anhang.
HTH,
Harm
P.S.
In Deinem ursprünglichen Code hattest Du versucht den "Lyrics"-Kontext zu benutzen.
Dazu noch eine Anmerkung:
Falls Du Lyrics von Staff entkoppelst, d.h. kein \lyricsto, kann man \skip benutzen, sowie Text an jeden beliebigen Zeitpunkt der Musik setzen, auch während Pausen:
<<
\new Staff
\relative c' {
c1 d r r
d r r c
}
\new Lyrics
\lyricmode {
one1 two three four
\skip 1*2 five1 six
}
\new Lyrics
\lyricmode {
\skip 1*2 "3"1 "4"
"4.1" "4.2" "5" "6"
}
>>