• Willkommen im Forum „Archiviertes Lilypond Forum (2017)“.
 

Dies ist das Archiv des alten Forums (bis März 2017). Das aktuelle Forum ist unter lilypondforum.de zu finden.
This is the archive of the old forum (until March 2017). You can find the current forum at lilypondforum.de.

Hauptmenü

Rest position (etc) bei Zweistimmigkeit

Begonnen von kilgore, Sonntag, 15. Mai 2011, 16:02

Vorheriges Thema - Nächstes Thema

kilgore

Liebe Lilys,

Es geht um Zweistimmigkeit zum Zweck Dynamik!  Ich habe eine extra Stimme geschafft nur mit Dynamik, um die Eingabe etwas zu erleichtern.  Da verhält sich Lilypond aber sehr komisch bei den Pausen!  Die werden nämlich runter gezogen, ganz weit unter der unsichtbarer zweite Stimme.  Wo bitte wäre das überhaupt sinnvoll??  Jedenfalls möchte ich, dass die erste Stimme (also die mit den Tönen) sich so benimmt als wäre kein zweite Stimme da.  Hat jemand ein Idee wie ich das am geschicksten mache?

Danke!

kil



\version "2.12.3"

\relative c' {
<< {
\stemNeutral \tieNeutral \slurNeutral \phrasingSlurNeutral \dynamicNeutral
  \override Script #'direction = #DOWN
  \override Rest #'direction = ##f
  \override MultiMeasureRest #'direction = ##f
  \time 3/8
  dis4.~ dis4.~
  dis4 \breathe gis8:32~ gis4.:32~
  \time 4/8
  gis8:32 \breathe fis4.~
  fis4. r8
  \time 5/8
  ais4.:32->~ \bar ":" ais!4:32~
  ais4:32 \bar ":" r4.

}
\\
%START DYNAMICS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
       {
  \override DynamicText #'staff-padding = #2
  \stemNeutral
  \hideNotes
  c4.\mf
  c4\< c8\f
  c8.\< c8.\ff
  c8 c8\< c8\fff
  c8 c4\mf c16 c16\<
  c4 c16 c16\ff c8
  \time 5/8
  c4.\fff c8 c8\>
  c4 c4.\mf
  \unHideNotes
         
       }
     >>
   }

harm6

Hallo kil,

schmeiß die Befehle \override Rest #'direction = ##f und \override MultiMeasureRest #'direction = ##f raus und ersetze sie durch \override Rest #'staff-position = #0 und \override MultiMeasureRest #'staff-position = #0, dadurch werden die Pausen an der mittleren Linie ausgerichtet.

Gruß,
  Harm

RobUr

Zitat von: kilgoreHat jemand ein Idee wie ich das am geschicksten mache?
Indem du Spacer benutzt:

\version "2.12.3"

voice = \relative c' {
\time 3/8
dis4.~ dis4.~
dis4 \breathe gis8:32~ gis4.:32~
\time 4/8
gis8:32 \breathe fis4.~
fis4. r8
\time 5/8
ais4.:32->~ \bar ":" ais!4:32~
ais4:32 \bar ":" r4.
}

dynamics = {
s4.\mf
s4\< s8\f
s8.\< s8.\ff
s8 s8\< s8\fff
s8 s4\mf s16 s16\<
s4 s16 s16\ff s8
s4.\fff s8 s8\>
s4 s4.\mf
}

\score {
\new Staff {
<< \dynamics \voice >>
}
}


Dein Problem trifft aber nicht den Kern der Frage. Für gemeinsame Pausen bei Zweistimmigkeit gibt es ein Snippet. Das wollte ich gerade verlinken, aber das LSR ist noch down. Hier aber meine lokale Kopie:

#(define (rest-score r)
  (let ((score 0)
(yoff (ly:grob-property-data r 'Y-offset))
(sp (ly:grob-property-data r 'staff-position)))
    (if (number? yoff)
(set! score (+ score 2))
(if (eq? yoff 'calculation-in-progress)
    (set! score (- score 3))))
    (and (number? sp)
(<= 0 2 sp)
(set! score (+ score 2))
(set! score (- score (abs (- 1 sp)))))
    score))


#(define (merge-rests-on-positioning grob)
  (let* ((can-merge #f)
(elts (ly:grob-object grob 'elements))
(num-elts (and (ly:grob-array? elts)
(ly:grob-array-length elts)))
(two-voice? (= num-elts 2)))
    (if two-voice?
(let* ((v1-grob (ly:grob-array-ref elts 0))
       (v2-grob (ly:grob-array-ref elts 1))
       (v1-rest (ly:grob-object v1-grob 'rest))
       (v2-rest (ly:grob-object v2-grob 'rest)))
  (and
   (ly:grob? v1-rest)
   (ly:grob? v2-rest)          
   (let* ((v1-duration-log (ly:grob-property v1-rest 'duration-log))
  (v2-duration-log (ly:grob-property v2-rest 'duration-log))
  (v1-dot (ly:grob-object v1-rest 'dot))
  (v2-dot (ly:grob-object v2-rest 'dot))
  (v1-dot-count (and (ly:grob? v1-dot)
     (ly:grob-property v1-dot 'dot-count -1)))
  (v2-dot-count (and (ly:grob? v2-dot)
     (ly:grob-property v2-dot 'dot-count -1))))
     (set! can-merge
   (and
    (number? v1-duration-log)
    (number? v2-duration-log)
    (= v1-duration-log v2-duration-log)
    (eq? v1-dot-count v2-dot-count)))
     (if can-merge
;; keep the rest that looks best:
(let* ((keep-v1? (>= (rest-score v1-rest)
      (rest-score v2-rest)))
(rest-to-keep (if keep-v1? v1-rest v2-rest))
(dot-to-kill (if keep-v1? v2-dot v1-dot)))
   ;; uncomment if you're curious of which rest was chosen:
   ;;(ly:grob-set-property! v1-rest 'color green)
   ;;(ly:grob-set-property! v2-rest 'color blue)
   (ly:grob-suicide! (if keep-v1? v2-rest v1-rest))
   (if (ly:grob? dot-to-kill)
       (ly:grob-suicide! dot-to-kill))
   (ly:grob-set-property! rest-to-keep 'direction 0)
   (ly:rest::y-offset-callback rest-to-keep)))))))
    (if can-merge
#t
(ly:rest-collision::calc-positioning-done grob))))


Aktiviert wird die Funktion im \layout-Block:

\layout {
  \context {
    \Staff
    \override RestCollision #'positioning-done = #merge-rests-on-positioning
  }
}


Viele Grüße, Robert

harm6

Nachtrag:

Der Befehl \override DynamicText #'staff-padding = #2 funktioniert bei mir nicht.
Ich benutze stattdessen \override DynamicLineSpanner #'Y-offset = #-6