Autor Thema: (gelöst) gestrichelte Notenlinien  (Gelesen 2280 mal)

erich

  • Member
(gelöst) gestrichelte Notenlinien
« am: Montag, 13. Februar 2017, 15:37 »
Hallo allen
nach langer Zeit hab ich mal wieder eine Frage, vielleicht kann mir einer weiter helfen.

Das LilyPond Script
\version "2.19.52"
\include "nederlands.ly"

#(ly:set-default-scale (ly:make-scale '#(0 1/2 1 3/2 2 5/2 3 7/2 4 9/2 5 11/2)))

dodecaPitchNames = #(map (lambda (pitchname)
             (let* (
                     (pitch (cdr pitchname))
                     (nominal-steps (vector-ref '#(0 2 4 5 7 9 11)
                                 (ly:pitch-notename pitch)))
                     (fractional-steps
                         (+ nominal-steps (* 2 (ly:pitch-alteration pitch))))
                     (steps (inexact->exact (floor fractional-steps)))
                    )
                 (cons (car pitchname)
                     (ly:make-pitch
                         (ly:pitch-octave pitch)
                         steps
                         (/ (- fractional-steps steps) 2)))))
         pitchnames)

#(ly:parser-set-note-names  dodecaPitchNames)

\layout {
  \context {
    \Score
    \override StaffSymbol.line-positions = #'( 10 6 2 -2 -6 -10 -14 -18 )
    \override StaffSymbol.ledger-positions = #'(-6 -4 0 2 4 6)
    \override StaffSymbol.ledger-extra = #1
  }
}
noten = {\time 14/2
  <a cis' e' a'>2
  <g d' g'b'>2
  <f f' a' c''>2 q4
  <c' e' g' c''>2
  <f f' a' c''>4
  <g d' g' bes'>2 <a d' e' a'>4 <a des' e' a'>2
   \bar "|."
  }
\paper{
  indent = 0\cm
  paper-width = 12\cm
  }
\score{
  <<
  \new Staff \with {\remove "Time_signature_engraver"}
       \noten
  >>
  \midi {\tempo 4=120}
  \layout {}
}

gibt korrekt die Darstellung

aus. Der Violinschlüssel ist falsch; er schlüsselt das e auf, aber das soll nicht erörtert werden.
Abgesehen vom Schlüssel würde ich gerne die folgende Darstellung von LilyPond erzeugen lassen.


Es handelt sich um eine Notation , die Helmut Neumann ähnlich in seiner Puklikation Die Klangreihen-Kompositionslehre nach Othmar Steinbauer (1895-1962) verwendet.

Ich möchte zur Absetzung der beiden Systeme die Zwischenoktave durch schwächere, gestrichelte Notenlinien kenntlich machen.

Kann mir einer von euch dabei helfen?

Herzliche Grüße
Erich
« Letzte Änderung: Dienstag, 14. Februar 2017, 11:32 von erich »

fugenkomponist

  • Member
Re: gestrichelte Notenlinien
« Antwort #1 am: Montag, 13. Februar 2017, 17:16 »
Snippet 880 könnte dir weiterhelfen.

erich

  • Member
Re: gestrichelte Notenlinien
« Antwort #2 am: Montag, 13. Februar 2017, 17:43 »
Danke fugenkomponist

den Schnipsel hatte ich auch entdeckt; einerseits wird von einer festen Zeilendefinition ausgegangen, die sich ändern ließe, und andererseits kann man jede Zeile adressieren, was mehr ist, als ich brauche.
ich hoffte auf eine einfachere Lösung.

Gruß
Erich

Hilflos-im-Code

  • Member
Re: gestrichelte Notenlinien
« Antwort #3 am: Dienstag, 14. Februar 2017, 10:24 »
Sieht kompliziert aus. Aber als ForumsDAU habe ich fünf Minuten gebraucht. Dein Script und das andere zusammen kopiert und gut war es.

%%http://lsr.di.unimi.it/LSR/Item?id=880

% original code (for zig-zag lines) by Thomas Morley (Harm)
% -> http://lists.gnu.org/archive/html/lilypond-user/2012-12/msg00715.html
% slightly modified to create dashed lines by Paul Morris


#(ly:set-default-scale (ly:make-scale '#(0 1/2 1 3/2 2 5/2 3 7/2 4 9/2 5 11/2)))

dodecaPitchNames = #(map (lambda (pitchname)
             (let* (
                     (pitch (cdr pitchname))
                     (nominal-steps (vector-ref '#(0 2 4 5 7 9 11)
                                 (ly:pitch-notename pitch)))
                     (fractional-steps
                         (+ nominal-steps (* 2 (ly:pitch-alteration pitch))))
                     (steps (inexact->exact (floor fractional-steps)))
                    )
                 (cons (car pitchname)
                     (ly:make-pitch
                         (ly:pitch-octave pitch)
                         steps
                         (/ (- fractional-steps steps) 2)))))
         pitchnames)

#(ly:parser-set-note-names  dodecaPitchNames)

\layout {
  \context {
    \Score
    \override StaffSymbol.line-positions = #'( 10 6 2 -2 -6 -10 -14 -18 )
    \override StaffSymbol.ledger-positions = #'(-6 -4 0 2 4 6)
    \override StaffSymbol.ledger-extra = #1
  }
}


dashedStaffSymbolLines =
#(define-music-function (parser location dash-space bool-list)
 ((number-pair? '(0.5 . 0.5)) list?)
"
Replaces specified lines of a StaffSymbol with dashed lines.

The lines to be changed should be given as a list containing booleans, with
the meaning:
  #f - no dashes, print a normal line
  #t - print a dashed line
The order of the bool-list corresponds with the order of the given list of
'line-positions or if not specified, with the default.
If the length of the bool-list and the 'line-positions doesn't match a warning
is printed.

The width of the dashes and the spacing between them can be altered by adding a pair
as first argument while calling the function:
\\dashedStaffSymbolLines #'(1 . 1) #'(#f #f #t #f #f)
the first number of the pair is the width, the second the spacing
"
#{
 \override Staff.StaffSymbol.after-line-breaking =
   #(lambda (grob)
     (let* ((staff-stencil (ly:grob-property grob 'stencil))
            (staff-line-positions
              (if (equal? (ly:grob-property grob 'line-positions) '() )
                '(-4 -2 0 2 4)
                (ly:grob-property grob 'line-positions)))
            (staff-width
              (interval-length
                (ly:stencil-extent staff-stencil X)))
            (staff-space (ly:staff-symbol-staff-space grob))
            (staff-line-thickness (ly:staff-symbol-line-thickness grob))
            ;; width of the dash
            (dash-width (car dash-space))
            ;; space between dashes
            (space-width (cdr dash-space))
            ;; Construct the first dash
            (sample-path `((moveto 0 0)
                           (lineto ,dash-width 0)
                           ))
            ;; Make a stencil of the first dash
            (dash-stencil
              (grob-interpret-markup
                grob
                (markup
                  #:path staff-line-thickness sample-path)))
           ;; width of both dash and space
           (dash-space-width (+ dash-width space-width))
           
           ;; another way: get width of dash from the dash stencil
           ;; (stil-width
           ;;   (interval-length
           ;;     (ly:stencil-extent dash-stencil X)))
           ;; (dash-space-width (+ stil-width space-width))
           
            ;; Make a guess how many dashes are needed.
            (count-dashes
              (inexact->exact
                (round
                  (/ staff-width
                     (- dash-space-width
                        staff-line-thickness)))))
            ;; Construct a stencil of dashes with the guessed count
            (dashed-stil
                (ly:stencil-aligned-to
                  (apply ly:stencil-add
                    (map
                      (lambda (x)
                        (ly:stencil-translate-axis
                          dash-stencil
                          (* (- dash-space-width staff-line-thickness) x)
                          X))
                      (iota count-dashes)))
                  Y
                  CENTER))
            ;; Get the the length of that dashed stencil
            (stil-x-length
              (interval-length
                (ly:stencil-extent dashed-stil  X)))
            ;; Construct a line-stencil to replace the staff-lines.
            (line-stil
              (make-line-stencil staff-line-thickness 0 0 staff-width 0))
            ;; Calculate the factor to scale the dashed-stil to fit
            ;; the width of the original staff-symbol-stencil
            (corr-factor
              (/ staff-width (- stil-x-length staff-line-thickness)))
            ;; Construct the new staff-symbol
            (new-stil
              (apply
                ly:stencil-add
                  (map
                    (lambda (x y)
                      (ly:stencil-translate
                          (if (eq? y #f)
                            line-stil
                            (ly:stencil-scale
                              dashed-stil
                              corr-factor 1))
                          (cons (/ staff-line-thickness 2)
                                (* (/ x 2) staff-space))))
                    staff-line-positions bool-list))))
       
      (if (= (length bool-list)(length staff-line-positions))
        (ly:grob-set-property! grob 'stencil new-stil)
        (ly:warning
          "length of dashed line bool-list doesn't match the line-positions - ignoring"))))
#})


%%%%%%%%%%%%%%%%%%%%%%%%%%
% EXAMPLE
%%%%%%%%%%%%%%%%%%%%%%%%%%

music =
 {
 \time 14/2
  <a cis' e' a'>2
  <g d' g'b'>2
  <f f' a' c''>2 q4
  <c' e' g' c''>2
  <f f' a' c''>4
  <g d' g' bes'>2 <a d' e' a'>4 <a des' e' a'>2
   \bar "|."
}

<<

 \new Staff \with {
           \override StaffSymbol.line-positions = #'(10 6 2 -2 -6 -10 -14 -18)
           \dashedStaffSymbolLines #'(#f #f #f #f #t #t #f #f)
           % make staff smaller:
           fontSize = #-3
           % \override StaffSymbol.staff-space = #(magstep -3)
          %  \override StaffSymbol.thickness = #(magstep -3)
 }
 \music
>>

\layout {
  \context {
    \Score
    \remove "Time_signature_engraver"
    \override StaffSymbol.ledger-positions = #'(-6 -4 0 2 4 6)
    \override StaffSymbol.ledger-extra = #1
  }
}


Entscheidend ist \override StaffSymbol.line-positions = #'(10 6 2 -2 -6 -10 -14 -18)
           \dashedStaffSymbolLines #'(#f #f #f #f #t #t #f #f)

erich

  • Member
Re: gestrichelte Notenlinien
« Antwort #4 am: Dienstag, 14. Februar 2017, 11:27 »
Hilflos-im-Code oder auch gerade nicht; DANKE

Ich wollte mich gerade hinsetzten und mitteilen, dass ich genau das versucht hatte, was du vorschlägst.
In der Tat, man muss die ganze Liste ausfüllen!