Akkordsymbole indivuduell anpassen

Begonnen von senpai96xx, Montag, 31. März 2025, 17:42

« vorheriges - nächstes »

senpai96xx

Hallo liebe Forenmitglieder,

Das Moll-Minus konnte ich bereits durch "mi" ersetzen. Ich würde gern wissen, wie es gehen kann, daß mir ein Dur-Akkord im Akkordnamen so ausgegeben wird: "Cma" anstatt nur "C".
Außerdem habe ich das Major-Dreieck durch "maj" erstetzen können. Wie bekomme ich es hin, das anstelle des durchgestrichenen Kreisen folgendes für halbverminderte Akkorde erzeugt wird: C7(b5)?
Für diejenigen, die die Sinnhaftigkeit in Frage stellen: Es handelt sich um ein pädagogisches Lehrprojekt. Daher diese "seltsamen" Formatierungen.
Danke für Hilfe und Anregungen.

Gruß

Andre

Minimalbsp.:
\version "2.20.0"
\include "C:/LilyPond/usr/share/lilypond/current/ly/harmonyli.ly" %muß immer inkludiert werden

%Akkordschema: COLOR
akkord-color = \chordmode
{
  \set minorChordModifier = \markup { mi }
  \set majorSevenSymbol = \markup { maj7 }

  d2.:m7      | g2.:7      | c2.:maj7    | f2.:maj7
  b2.:m7.5-  | e2.:7      | a2.:m7      | ees2.:7
}

%Noten
  \score
  {
  <<
      \new ChordNames \akkord-color
      \new Staff
      {
        \clef treble
        \time 3/4

          g'2.          | g''2 f''4 | e''2 c''4 | g'2.              |  \break
          d''4 e''4 f''4 | e''2 d''4 | e''2 c''4 | g'2.                |  \break
      } %End Staff
  >>
  } % End Score

Manuela

#1
Herzlich willkommen im Forum.

Ich habe auch eine Weile gebraucht, bis ich das mit den Akkordbezeichnungen behirnt habe. Du kannst jeden Akkord mit einem beliebigen Markup bezeichnen, ich habe ein paar lustige Beispiele eingebaut.

\version "2.25.22"
\language "deutsch"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Akkordbezeichnungen und Contexte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(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 (note-international->markup pitch lowercase?)
   "Return pitch markup for @var{pitch}."
   (define (accidental->markup alteration)
     "Return accidental markup for ALTERATION."
     (if (= alteration 0)
         (make-line-markup (list empty-markup))
         (conditional-kern-before
          (alteration->text-accidental-markup alteration)
          (= alteration FLAT) 0.094725)))
   (define (conditional-string-downcase str condition)
     (if condition
         (string-downcase str)
         str))
   (define (conditional-kern-before markup bool amount)
     "Add AMOUNT of space before MARKUP if BOOL is true."
     (if bool
         (make-line-markup
          (list (make-hspace-markup amount)
                markup))
         markup))
   (make-line-markup
    (list
     (make-simple-markup
      (conditional-string-downcase
       (vector-ref #("C" "D" "E" "F" "G" "A" "B") (ly:pitch-notename pitch))
       lowercase?))
     (accidental->markup (ly:pitch-alteration pitch)))))

ringsps = #"
  0.15 setlinewidth
  0.9 0.6 moveto
  0.4 0.6 0.5 0 361 arc
  stroke
  1.0 0.6 0.5 0 361 arc
  stroke
  "

rings = \markup {
  \with-dimensions #'(-0.2 . 1.6) #'(0 . 1.2)
  \postscript #ringsps
}

#(define my-eyeglassespath
  '((moveto   -3.57   1.80)
     (curveto  -3.65   1.90  -3.55   2.22  -3.33   2.22)
     (curveto  -3.17   2.22  -3.15   2.15  -3.10   2.10)
     (lineto   -2.02   0.94)
     (moveto   -2.06   0.65)
     (curveto  -2.06   1.00  -1.75   1.28  -1.45   1.28)
     (curveto  -1.10   1.28  -1.07   1.05  -1.07   0.90)
     (curveto  -1.07   0.62  -1.30   0.27  -1.70   0.27)
     (curveto  -1.85   0.25  -2.06   0.40  -2.06   0.65)
     (closepath)
     (moveto   -1.14   1.20)
     (curveto  -1.00   1.44  -0.72   1.52  -0.57   1.35)
     (moveto   -0.61   1.05)
     (curveto  -0.61   1.42  -0.30   1.68   0.00   1.68)
     (curveto   0.22   1.68   0.37   1.52   0.37   1.28)
     (curveto   0.37   0.96   0.06   0.65  -0.25   0.64)
     (curveto  -0.30   0.64  -0.61   0.65  -0.61   1.05)
     (closepath)
     (moveto    0.12   1.68)
     (lineto   -1.10   2.69)
     (curveto  -1.50   3.05  -1.80   2.75  -1.71   2.45)))

#(define-markup-command (myEyeglasses layout props)
  ()
 "Prints out alternative eyeglasses, indicating strongly to look at the conductor."
  (interpret-markup layout props
    #{
       \markup
       \override #'(line-cap-style . butt)
       \path #0.15
       \my-eyeglassespath
    #}))

chExBass = {
  < c >1-\markup \super \rings
  < c g >1-\markup \myEyeglasses
  < c e g >1-\markup "ma"
  < c es ges b >-\markup "7(b5)"
}

chExBasses =
#(append
  (sequential-music-to-chord-exceptions chExBass #t)
  ignatzekExceptions)

\layout {
  \context {
    \ChordNames
    chordRootNamer = #note-international->markup %% internationale Notenbezeichnungen
    %% falls deutsche Notennamen bevorzugt werden, das folgende Kommando verwenden
    %% chordRootNamer = #chord-name->german-markup-text-alteration
    noChordSymbol = ##f
    \override ChordName.self-alignment-X = #LEFT
    chordNameLowercaseMinor = ##f
    chordChanges = ##f
    chordNameExceptions = #chExBasses
  }
}

mychords = \chordmode {
  c1 c:1 c:5 c:m c:7 c:maj < c' es' ges' b' >
  c:7.5-.3-
}

<<
  \new ChordNames \mychords
  \new Staff \mychords
>>

Der Schlüssel ist die Variable chExBass hier werden alle gewünschten Formatierungen aufgelistet. Ich hoffe, die Systematik ist klar, zuerst kommen die Noten, wie sie im Akkord ausgehend von C vorkommen, dann kommt das gewünschte Markup. Die Noten werden in absoluter Schreibweise notiert.

Ich habe gleich die Variante für deutsche Notenbezeichnungen eingebaut, dazu die auskommentierte Zeile aktivieren.
Danke für eure Hilfe
viele Grüße
-- Manuela

senpai96xx

Hallo Manuela,

vielen Dank für Deine schnelle Antwort und das ausführliche Beispiel. Das hätte ich mir in 100 Jahren nicht zusammensuchen können :-\

Es fällt mir sehr schwer nachzuvollziehen, was da genau passiert. Soweit ich es verstanden habe, handelt es sich bei den "Define"-Befehlen um eine zusätzliche, andere Umgebung innerhalb von Lilypond. Richtig?
Ich hatte gehofft, daß es für die anderen beiden Fälle eine ähnlich einfache Lösung wie "\set minorChordModifier = \markup { mi }" gibt.

Könntest Du Dein Beispiel sowei eindampfen, daß ich es in meine Arbeit übernehmen kann? Ich bin normalerweise nicht der Typ "mach mal für mich". Aber mittlerweile sitzt mir der Abgabetermin ziemlich im Nacken. Latex geht ganz gut. Aber es war leider nicht abzusehen, daß man für Lilypond ein Informatikstudium summa cum laude benötigt.
Vielen Dank noch einmal für Deine Unterstützung.

Grüße

Andre

Manuela

Ok, hier ist nur das wichtigste mit einem Anwendungsbeispiel

\version "2.25.22"
\language "deutsch"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%% Akkordbezeichnungen und Contexte
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

chExBass = {
  < c >1-\markup \super 1
  < c g >1-\markup \super 5
  < c e g >1-\markup "ma"
  < c es ges b >-\markup "7(b5)"
}

chExBasses =
#(append
  (sequential-music-to-chord-exceptions chExBass #t)
  ignatzekExceptions)

\layout {
  \context {
    \ChordNames
    chordNameExceptions = #chExBasses
  }
}

mychords = \chordmode {
  c1 c:1 c:5 c:m c:7 c:maj < c' es' ges' b' >
  c:7.5-.3-
}

<<
  \new ChordNames \mychords
  \new Staff \mychords
>>

chExBass kannst du nach deinen Bedürfnissen anpassen.
Danke für eure Hilfe
viele Grüße
-- Manuela

senpai96xx

Hi,

damit konnte ich etwas anfangen :-) Schau mal. Ich habe ein wengig herumgespielt:

\version "2.20.0"
\include "C:/LilyPond/usr/share/lilypond/current/ly/harmonyli.ly"

chExBass =
{
  < c e g >-\markup \sub "Dur"
  < c e g a >-\markup {\sub "Dur" \super "g6" }
  < c e g bes >-\markup {\sub "Dur" \super "k7" }
  < c e g b >-\markup {\sub "Dur" \super "g7" }

  < c ees g >-\markup \sub "Moll"
  < c ees g bes >-\markup {\sub "Moll" \super "k7" }
  < c ees g b >-\markup {\sub "Moll" \super "g7" }

  < c es ges bes >-\markup {\sub "Moll" \super "k7(b5)" }
}

chExBasses =
#(append (sequential-music-to-chord-exceptions chExBass #t) ignatzekExceptions)

\layout { \context {\ChordNames chordNameExceptions = #chExBasses } }

mychords = \chordmode
{
  c1 c:6
  c:7 c:maj
  c:m c:m7 c:m7+
  c:m7.5- c:7.5-.3- < c' es' ges' bes' >
}

<<
  \new ChordNames \mychords
  \new Staff \mychords
>>

Vielen Dank!

Manuela

#5
Ich habe noch an dem Markup gearbeitet, falls du die Bezeichnungen übereinander setzen willst.
\version "2.25.22"
%\include "C:/LilyPond/usr/share/lilypond/current/ly/harmonyli.ly"

chExBass =
{
  < c e g >-\markup \sub "Dur"
  < c e g a >-\markup \override #'(baseline-skip . 2)
  \super \left-column {
    "g6" "Dur"
  }
}

chExBasses =
#(append (sequential-music-to-chord-exceptions chExBass #t) ignatzekExceptions)

\layout { \context {\ChordNames chordNameExceptions = #chExBasses } }

mychords = \chordmode
{
  c1 c:6
}

<<
  \new ChordNames \mychords
  \new Staff \mychords
>>

baseline-skip bewirkt, dass der Zeilenabstand nicht zu groß wird. column-left setzt die Ausdrücke linksbündig übereinander

Textbeschriftungsbefehle zum Ausrichten von Text
Danke für eure Hilfe
viele Grüße
-- Manuela

Manuela

Ich habe noch ein Beispiel erstellt, wie du verschiedene Definitionen in einer Datei verwenden kannst.

\version "2.25.22"

chExBass =
{
  < c e g >-\markup \sub "Dur"
  < c e g a >-\markup \override #'(baseline-skip . 2)
  \super \left-column { "g6" "Dur" }
  < c ees g bes >-\markup \override #'(baseline-skip . 2)
  \super \left-column { "Moll" "k7" }

}

chExBasses =
#(append (sequential-music-to-chord-exceptions chExBass #t) ignatzekExceptions)


chExBassx =
{
  < c e g >-\markup \sub "Dur"
  < c e g a >-\markup {\sub "Dur" \super "g6" }
  < c e g bes >-\markup {\sub "Dur" \super "k7" }
  < c e g b >-\markup {\sub "Dur" \super "g7" }
  < c ees g >-\markup \sub "Moll"
  < c ees g bes >-\markup {\sub "Moll" \super "k7" }
  < c ees g b >-\markup {\sub "Moll" \super "g7" }
  < c es ges bes >-\markup {\sub "Moll" \super "k7(b5)" }
}

chExBassesx =
#(append (sequential-music-to-chord-exceptions chExBassx #t) ignatzekExceptions)

\layout {
  \context {
    \ChordNames
    chordNameExceptions = #chExBasses
    \override ChordName.font-size = #3
  }
  \context {
    \ChordNames
    \name ChordNamesx
    \alias ChordNames
    chordNameExceptions = #chExBassesx
  }
  \context {
    \Score
    \accepts ChordNamesx
  }
}

\paper {
  indent = #0
  tagline = ##f
  system-system-spacing.padding = #10
  line-width = #140
}

mychords = \chordmode
{
  \override ChordNames.VerticalAxisGroup.nonstaff-nonstaff-spacing.padding = #3
  c1 c:6
  c:7 c:maj
  c:m c:m7 c:m7+
  c:m7.5- c:7.5-.3- < c' es' ges' bes' >
}

<<
  \new ChordNames \mychords
  \new ChordNamesx \mychords
  \new Staff \mychords
>>

Der Deutlichkeit halbe habe ich die Abstände zwischen den Notenzeilen und den Akkordnamen vergrößert, vielleicht kannst du das ja auch brauchen  :)
Danke für eure Hilfe
viele Grüße
-- Manuela

senpai96xx

Zitat von: Manuela am Dienstag,  1. April 2025, 19:21Ich habe noch an dem Markup gearbeitet, falls du die Bezeichnungen übereinander setzen willst.

Hallo und vielen Dank auch dafür. Das ist sehr hilfreich, weil die Akkordsymbole in meiner jetzigen Fassung doch ganz schön raumgreifend sind. Das baue ich noch ein. So häppchenweise, gemacht für Anfänger wie mich, ist das Ganze gut zu verdauen und nachvollziebar.

Grüße

Andre

senpai96xx

Zitat von: Manuela am Dienstag,  1. April 2025, 19:35Ich habe noch ein Beispiel erstellt, wie du verschiedene Definitionen in einer Datei verwenden kannst.

Cool. Da habe ich doch gleich eine nette Idee für mein Heft. Das kann ich sehr gut gebrauchen.  ;D Scheint gerade Ostern zu sein.  ;)

Am Wochenende habe ich ein wenig mit farbigen Noten herumexperimentiert. Nun verstehe ich diese #define-Umgebung langsam so ein bißchen. Das könnte ja mal hilfreicherweise in einer der vielen Dokumentationen stehen, daß das quasi eine eine neue Umgebung ist, die nach anderen Regeln funktioniert wie lilypond selbst...

Vielen Dank!

Manuela

#9
Farbige Noten? Da habe ich auch was vorrätig, wenn es dich interessiert.

Noch etwas: verwendest du einen Editor? Ich nehme Frescobaldi, das erleichtert die Eingabe ungemein.
Danke für eure Hilfe
viele Grüße
-- Manuela

Manuela

#10
Zitat von: senpai96xx am Freitag,  4. April 2025, 13:08Das könnte ja mal hilfreicherweise in einer der vielen Dokumentationen stehen, daß das quasi eine eine neue Umgebung ist, die nach anderen Regeln funktioniert wie lilypond selbst...

Das steht schon irgendwo in der Doku, ich werde mal suchen.

Hier ist mal ein Anfang: Scheme-Tutorium

Es gibt aber noch etwas anderes, das ich momentan nicht finde.
Danke für eure Hilfe
viele Grüße
-- Manuela