Neueste Beiträge

#71
Fragen und Probleme aller Art / Antw:Engstehende Notenköpfe
Letzter Beitrag von nepf - Freitag, 1. Mai 2026, 11:01
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!
#72
Fragen und Probleme aller Art / Antw:Engstehende Notenköpfe
Letzter Beitrag von Manuela - Montag, 27. April 2026, 10:44
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
#73
Fragen und Probleme aller Art / Antw:Engstehende Notenköpfe
Letzter Beitrag von nepf - Montag, 27. April 2026, 10:18
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?
#74
Fragen und Probleme aller Art / Antw:Engstehende Notenköpfe
Letzter Beitrag von Manuela - Sonntag, 26. April 2026, 23:17
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.
#75
Fragen und Probleme aller Art / Antw:Ambitus feststellen?
Letzter Beitrag von Manuela - Sonntag, 26. April 2026, 20:58
Zitat von: harm6 am Sonntag, 26. April 2026, 16:33
Zitatder Code ist natürlich von Harm.
Hm, da erinnere ich mich nicht dran. Hast du einen link?

Gruß,
  Harm

Hast recht, anscheinend habe ich  einen vorhandenen Code umgeschrieben, hier der Link Niedrigste/höchste Note aus Musik herausfiltern. Bin ich doch schlauer als ich dachte?  ;)
#76
Fragen und Probleme aller Art / Engstehende Notenköpfe
Letzter Beitrag von nepf - Sonntag, 26. April 2026, 18:52
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 { }
}

#77
Fragen und Probleme aller Art / Antw:Ambitus feststellen?
Letzter Beitrag von harm6 - Sonntag, 26. April 2026, 16:33
Zitatder Code ist natürlich von Harm.
Hm, da erinnere ich mich nicht dran. Hast du einen link?

Gruß,
  Harm
#78
Fragen und Probleme aller Art / Antw:Ambitus feststellen?
Letzter Beitrag von Manuela - Sonntag, 26. April 2026, 07:18
Zitat von: ingmar am Samstag, 25. April 2026, 19:54Nur, was du an der Stelle
      (let ((elt (ly:music-property mus 'element)))
         (fold loop ...

..genau machst, ist mir nicht klar.

Mir auch nicht, der Code ist natürlich von Harm. So wie ich das verstehe, arbeitet sich das Programm durch alle Musikelemente durch, aber Scheme ist für mich sehr schwer zu durchschauen.
#79
Fragen und Probleme aller Art / re: Ambitus feststellen?
Letzter Beitrag von ingmar - Samstag, 25. April 2026, 19:54
ZitatMit wenig Aufwand kannst du aus diesem Code die gewünschten Funktionen basteln.

Das war schon mehr, als ich gehofft hatte. Der Code funktioniert einwandfrei. – Danke, Manuela! : - )

Nur, was du an der Stelle
      (let ((elt (ly:music-property mus 'element)))
         (fold loop ...

..genau machst, ist mir nicht klar.

Gruß, : - )
--ingmar
#80
Fragen und Probleme aller Art / Antw:Ambitus feststellen?
Letzter Beitrag von Manuela - Dienstag, 21. April 2026, 17:33
Meinst sowas wie diese Funktion?

\version "2.25.80"

musicextrema =
#(define-music-function (mus)(ly:music?)
   (let*
    (
      (alle-pitches
       (let loop ((mus mus) (pitches '()))
         (let ((p  (ly:music-property mus 'pitch)))
           (if (ly:pitch? p)
               (cons p pitches)
               (let ((elt (ly:music-property mus 'element)))
                 (fold loop
                       (if (ly:music? elt)
                           (loop elt pitches)
                           pitches)
                       (ly:music-property mus 'elements)))))))
      (alle-sortiert (sort alle-pitches ly:pitch<?))
      (tief (car alle-sortiert))
      (hoch (car (reverse alle-sortiert)))
      )
    ;     (display tief )(display hoch)
    ;     (write-me "alle pitches----> " (list? alle-pitches))
    (make-music
     'SequentialMusic
     'elements
     (list
      (make-music
       'NoteEvent
       'duration
       (ly:make-duration 2)
       'pitch
       tief)
      (make-music
       'NoteEvent
       'pitch
       hoch
       'duration
       (ly:make-duration 2))))
    ))

mymus = \relative { c' c c, c,, }
{ \clef bass \musicextrema \mymus }

Mit wenig Aufwand kannst du aus diesem Code die gewünschten Funktionen basteln.