Das archivierte Lilypond-Forum von 2017 ist hier als Lese-Archiv wieder verfügbar!

Hauptmenü

Engstehende Notenköpfe

Begonnen von nepf, Sonntag, 26. April 2026, 18:52

Vorheriges Thema - Nächstes Thema

nepf

Hallo zusammen,

dies ist ein Scan, so soll es werden:
Du darfst diesen Dateianhang nicht ansehen.

und so sieht mein Ergebnis aus:
Du darfst diesen Dateianhang nicht ansehen.

wie bekomme ich es hin, dass die Noten auf einer Silbe so schön eng stehen, wie im Scan?

Mein Code:
\version "2.24.3"
#(set-global-staff-size 16)

\header {
  title = ""
}

\paper{
  paper-width = 12\cm
  paper-height = 20\cm
  indent = 0
}

global = {
  \key bes \major
}


melody = \relative c'' {
  \global
  \omit Score.TimeSignature
  \omit Score.BarLine
  \omit Stem
  \autoBeamOff
   f, c f [g] a [g] a f [f]
 
}

words = \lyricmode {
  Ky -- ri -- e e -- lei -- son.
 
}

\score {
  <<   
    \new Staff { \melody }
    \addlyrics { \words }
  >>
  \layout { \override LyricText #'font-name = #"Nunito Sans" }
  \midi { }
}

+ + + + + + + + + + + + + +
tschüß nepf

Manuela

Guckst du hier : Easy Gregorian notation

Du machst folgendes:
den nachstehenden Code speicherst du unter dem Namen modernGregorian.ily
%%%%% Defs to be saved as "modernGregorian.ily" %%%%%%%%%

%%%% Defining new stem/ligatures:
% long stem
lst = #(define-music-function (mus)
     (ly:music?)
   #{
     \stemDown
     \undo\omit Stem
     \once\override Stem.length = #7
     \once\override Stem.X-extent = #'(.1 . 0)
     \once\override NoteHead.stem-attachment = #'(-1.5 . -.1)
     $mus
     \omit Stem
   #})

%long curved ligature
#(define (long-curved-ligature grob)
   (if (ly:stencil? (ly:stem::print grob))
     (let* ((stencil (ly:stem::print grob))
            (X-ext (ly:stencil-extent stencil X))
            (Y-ext (ly:stencil-extent stencil Y))
            (width (interval-length X-ext))
            (len (interval-length Y-ext)))
       (ly:stencil-translate
         (grob-interpret-markup grob
           (markup
             (#:path width
               (list (list (quote moveto) -0.7 -0.65)
                   (list (quote curveto) -1.2 -0.4 -1.1 -0.2 -0.9 0.5)
                   (list (quote curveto) -0.9 0.5 -0.4 2 -0.8 2.2)))))
         (cons 0 (interval-start Y-ext))))
     #f))

lli = #(define-music-function (mus)
     (ly:music?)
        #{
          \stemUp
          \undo\omit Stem
          \override Stem.stencil = #long-curved-ligature
          $mus
          \omit Stem
        #})

%medium curved ligature
#(define (medium-curved-ligature grob)
   (if (ly:stencil? (ly:stem::print grob))
     (let* ((stencil (ly:stem::print grob))
            (X-ext (ly:stencil-extent stencil X))
            (Y-ext (ly:stencil-extent stencil Y))
            (width (interval-length X-ext))
            (len (interval-length Y-ext)))
       (ly:stencil-translate
         (grob-interpret-markup grob
           (markup
             (#:path width
               (list (list (quote moveto) -0.7 -0.65)
                   (list (quote curveto) -1.2 -0.4 -1.1 -0.2 -0.9 0.5)
                   (list (quote curveto) -0.9 0.5 -0.4 1.9 -1.4 1.8)))))
         (cons 0 (interval-start Y-ext))))
     #f))

mli = #(define-music-function (mus)
     (ly:music?)
        #{
          \stemUp
          \undo\omit Stem
          \override Stem.stencil = #medium-curved-ligature
          $mus
          \omit Stem
        #})

%short curved ligature
#(define (short-curved-ligature grob)
   (if (ly:stencil? (ly:stem::print grob))
     (let* ((stencil (ly:stem::print grob))
            (X-ext (ly:stencil-extent stencil X))
            (Y-ext (ly:stencil-extent stencil Y))
            (width (interval-length X-ext))
            (len (interval-length Y-ext)))
       (ly:stencil-translate
         (grob-interpret-markup grob
           (markup
             (#:path width
               (list (list (quote moveto) -0.7 -0.65)
                   (list (quote curveto) -1.2 -0.4 -1.1 -0.2 -1 0.4)
                   (list (quote curveto) -1 0.4 -0.8 1.5 -1.4 1.3)))))
         (cons 0 (interval-start Y-ext))))
     #f))

sli = #(define-music-function (mus)
     (ly:music?)
        #{
          \stemUp
          \undo\omit Stem
          \override Stem.stencil = #short-curved-ligature
          $mus
          \omit Stem
        #})

%tiny curved ligature
#(define (tiny-curved-ligature grob)
   (if (ly:stencil? (ly:stem::print grob))
     (let* ((stencil (ly:stem::print grob))
            (X-ext (ly:stencil-extent stencil X))
            (Y-ext (ly:stencil-extent stencil Y))
            (width (interval-length X-ext))
            (len (interval-length Y-ext)))
       (ly:stencil-translate
         (grob-interpret-markup grob
           (markup
             (#:path width
               (list (list (quote moveto) -0.7 -0.65)
                   (list (quote curveto) -1.2 -0.4 -1.1 -0.1 -1 0.2)
                   (list (quote curveto) -1 0.2 -0.8 0.7 -1.4 0.6)))))
         (cons 0 (interval-start Y-ext))))
     #f))

tli = #(define-music-function (mus)
     (ly:music?)
        #{
          \stemUp
          \undo\omit Stem
          \override Stem.stencil = #tiny-curved-ligature
          $mus
          \omit Stem
        #})

%% Ornament function
orn =
  -\tweak self-alignment-X #LEFT
  -\tweak Y-offset #0.5
  -\tweak X-offset #1
  -\tweak outside-staff-priority ##f
  -\markup
      \raise #-.3
      \scale #'(1 . .85)
      \rotate #90
      \musicglyph "ties.lyric.short"

%% Left aligning lyric :
lal = \once\override LyricText.self-alignment-X = #LEFT

%% horizontal inside staff spacer
space =
#(define-music-function
     (anzahl)
     (number?)
   #{
     \grace { \repeat unfold #anzahl s }
   #})

% Given some music that represents lyrics, add a prefix to the first
% lyric event.
% syntax is \versus { some lyrics }
% resp. \responsum { some lyrics }
#(define (add-prefix-to-lyrics prefix music)
   (let ((found? #f))
     (map-some-music
      (lambda (m)
    (if found? m
        (and (music-is-of-type? m 'lyric-event)
         (begin
           (set! (ly:music-property m 'text)
             (string-append prefix (ly:music-property m 'text)))
           (set! found? #t)
           m))))
      music)))
% Add unicode 2123 (versicle) as prefix to lyrics.
versus =
#(define-music-function (music) (ly:music?)
   (add-prefix-to-lyrics "℣. " music))
% Add unicode 211F (response) as prefix to lyrics.
responsum =
#(define-music-function (music) (ly:music?)
   (add-prefix-to-lyrics "℟. " music))

%% Defining notelaces (neume, melisma) and dedicated context:
gregorianContext = {
  \cadenzaOn
  \omit Clef
  \omit TimeSignature
  \omit StaffSymbol
  \omit Rest
  \omit Flag
  \omit Beam
  \override SpacingSpanner.packed-spacing = ##t
  \override NoteHead.stencil =
    #(lambda (grob)
       (let ((pos (ly:grob-property grob 'staff-position)))
         (cond ((= pos -6)
             (grob-interpret-markup grob
               #{
                  \markup
                  \concat {
                    \with-dimensions #'(0 . 0) #'(0 . 0)
                    \translate-scaled #'(-.45 . 0)
                    \override #'(thickness . 2)
                    \draw-line #'(1.78 . 0)
                    \hspace #-.21
                    \musicglyph "noteheads.s2"
                    \hspace #-.25
                  }
               #}))
           ((= pos -7)
               (grob-interpret-markup grob
                 #{
                    \markup
                    \concat {
                      \with-dimensions #'(0 . 0) #'(0 . 0)
                      \override #'(thickness . 2)
                      \translate-scaled #'(-.45 . .5)
                      \draw-line #'(1.78 . 0)
                      \hspace #-.21
                      \musicglyph "noteheads.s2"
                      \hspace #-.25
                    }
                 #}))
           ((= pos -8)
               (grob-interpret-markup grob
                 #{
                    \markup
                    \concat {
                      \with-dimensions #'(0 . 0) #'(0 . 0)
                      \override #'(thickness . 2)
                      \translate-scaled #'(-.45 . 1)
                      \draw-line #'(1.78 . 0)
                      \with-dimensions #'(0 . 0) #'(0 . 0)
                      \override #'(thickness . 2)
                      \translate-scaled #'(-.45 . 0)
                      \draw-line #'(1.78 . 0)
                      \hspace #-.21
                      \musicglyph "noteheads.s2"
                      \hspace #-.25
                    }
                  #}))
           (else
              (grob-interpret-markup grob
                     #{
                        \markup
                        \concat {
                          \hspace #-.21
                          \musicglyph "noteheads.s2"
                          \hspace #-.25
                        }
                      #})))))
  \override Accidental.extra-offset = #'(-.2 . 0)
  %%% TODO: find a fixed ledger line with no dimension; see
  %%% https://lists.gnu.org/archive/html/lilypond-user/2015-02/msg00681.html
  %\override LedgerLineSpanner.length-fraction = #'() %%% ???
  %\override LedgerLineSpanner.minimum-length-fraction = #'() %%% ???
}

neume = #(define-music-function (mus)
     (ly:music?)
   #{
     \once\override NoteHead.stencil = #(lambda (grob)
         (grob-interpret-markup grob
           #{
              \markup\concat {
                \hspace #-2
                \score {
                  \transpose c c' { \omit Stem $mus }
                  \layout {
                    indent = 0
                    ragged-right = ##t
                    \context {
                      \Score
                      \gregorianContext
                    }
                  }
                }
              }
           #}))
   #})

melisma = #(define-music-function (mus)
     (ly:music?)
     #{
        {
          \once\override Lyrics.LyricText.self-alignment-X = #LEFT
          \neume { $mus }
          \omit Accidental
          \omit Dots
          #(make-music
            'NoteEvent
            'pitch
            (ly:make-pitch -1 6 0)
            'duration
            (ly:make-duration 2 0 1))
        }
     #})

% Declare default layout
\layout {
  \context {
    \Score
    \omit TimeSignature
  }
}

%%%%%%%%%%%% end of "modernGregorian.ily" %%%%%%%%%

Mit folgendem Code erzielst du das gewünschte Ergebnis

\version "2.24.3"
\language "deutsch"
#(set-global-staff-size 16)
\include "modernGregorian.ily"

\header {
  title = ""
}

\paper{
  paper-width = 12\cm
  paper-height = 20\cm
  indent = 0
}

global = {
  \key b \major
}

melody = \relative c'' {
  \global
  \omit Score.TimeSignature
  \omit Score.BarLine
  \omit Stem
  \autoBeamOff
  f, c < f g > < a g > a < f f >
}

words = \lyricmode {
  Ky -- ri -- e e -- lei -- son.
}

\score {
  <<
    \new Staff {
      \melody
    }
    \addlyrics { \words }
  >>
}

Du notierst die Noten, die eng beisammen stehen sollen, innerhalb eines Akkords.
Danke für eure Hilfe
viele Grüße
-- Manuela

nepf

Wow, Manuela, das ist ja Klasse.
1000 Dank!

Allerdings, guck mal, was passiert:
Du darfst diesen Dateianhang nicht ansehen.

auf der ersten Silbe von e-leison steht das g vor dem a. Es müsste umgekehrt sein.
Das liegt vermutlich an der Akkorddarstellung.
Hast Du dafür auch noch eine Lösung?
+ + + + + + + + + + + + + +
tschüß nepf

Manuela

#3
Vergiss meinen obenstehenden Beitrag. Das geht viel einfacher, ich hatte mich einfach verrannt.

Verwende den folgenden Code aus dem LSR Re-positioning note heads on the opposite side of the stem

\version "2.24.3"
\language "deutsch"
#(set-global-staff-size 16)

\header {
  title = ""
}

\paper{
  paper-width = 12\cm
  paper-height = 20\cm
  indent = 0
}

global = {
  \key b \major
}

#(define ((shift offsets) grob)
"Defines how NoteHeads should be moved according to the given list of offsets."
 (let* (
 ;; NoteHeads
        ;; Get the NoteHeads of the NoteColumn
        (note-heads (ly:grob-array->list (ly:grob-object grob 'note-heads)))
        ;; Get their durations
        (nh-duration-log
          (map
            (lambda (note-head-grobs)
              (ly:grob-property note-head-grobs 'duration-log))
            note-heads))
        ;; Get their length in X-axis-direction
        (stencils-x-lengths
          (map
            (lambda (x)
                (let* ((grob-x-ext (ly:grob-extent x grob X)))
                  (if (interval-sane? grob-x-ext)
                      (interval-length grob-x-ext)
                      0)))
             note-heads))
 ;; Stem
        (stem (ly:grob-object grob 'stem))
        (stem-thick (ly:grob-property stem 'thickness 1.3))
        (stem-x-width (if (ly:grob? stem)
                          (let ((stem-x-ext (ly:grob-extent stem grob X)))
                            (if (interval-sane? stem-x-ext)
                                (interval-length stem-x-ext)
                                (/ stem-thick 10)))
                          ;; Fall back
                          ;; TODO is it ever used?
                          (/ stem-thick 10)))
        (stem-dir (ly:grob-property stem 'direction))
        ;; Calculate a value to compensate the stem-extension
        (stem-x-corr
          (map
            (lambda (q)
               ;; TODO better coding if (<= log 0)
               (cond ((and (= q 0) (= stem-dir 1))
                      (* -1 (+ 2  (* -4 stem-x-width))))
                     ((and (< q 0) (= stem-dir 1))
                      (* -1 (+ 2  (* -1 stem-x-width))))
                     ((< q 0)
                      (* 2 stem-x-width))
                     (else (/ stem-x-width 2))))
             nh-duration-log)))
 ;; Final Calculation for moving the NoteHeads
   (for-each
     (lambda (nh nh-x-length off x-corr)
         (if (= off 0)
           #f
           (ly:grob-translate-axis! nh (* off (- nh-x-length x-corr)) X)))
     note-heads stencils-x-lengths offsets stem-x-corr)))

displaceHeads =
#(define-music-function (offsets) (list?)
"
 Moves the NoteHeads, using (shift offsets)
"
 #{
   \once \override NoteColumn.before-line-breaking = #(shift offsets)
 #})

melody = \relative  {
  \global
  \omit Score.TimeSignature
  \omit Score.BarLine
  \omit Stem
  \autoBeamOff
  f' g < f g > \displaceHeads #'(0 1.75) < a g > a < f f >

}

words = \lyricmode {
  Ky -- ri -- e e -- lei -- son.
}

\score {
  <<
    \new Staff {
      \melody
    }
    \addlyrics { \words }
  >>
}

Du musst halt den Abstand zwischen den Notenköpfen so anpassen, wie es dir zusagt.

Update: geht auch mit 3 oder mehr Notenköpfen.
Falls du die Position der Silbe anpassen willst, probiere es mit
\once \override LyricText.X-offset = #1.5 e
Danke für eure Hilfe
viele Grüße
-- Manuela

nepf

Liebe Manuela,

ich danke Dir sehr, das ist genau das, was ich brauche.
mit Deinem Code kann ich prima arbeiten und ihn auch auf andere Situationen anwenden.

Verstehen tue ich ihn noch nicht, aber da gibst Du mir etwas zum Dazulernen.

Danke!
+ + + + + + + + + + + + + +
tschüß nepf