lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

partcombine - whole note : slash on grace note


From: MING TSANG
Subject: partcombine - whole note : slash on grace note
Date: Tue, 3 Apr 2012 20:50:32 -0700 (PDT)

Two questions:
(1) how can I have partcombine works on whole note - refer to bar #6 of png file?
(2) how can I have slash on the grace notes beam - refer to piano RH - bar #4?

Appreciate the help.

<><><><>snippet
\version "2.14.2"
\include "english.ly"
#(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))))
global = {\key c\major \time 4/4 \tempo 4 = 63}
TTj = \relative c {
%{TT61-62%} ef2 r8. bf16 ef8 ef8 | ef4( c4 d8) d16 d16 b8 b8 |
%{TT63 %} c2~ c2 |
}
BBj = \relative c {
%{BB61-62%} bf2 r8. g16 g8 g8 | af2( g8) g16 g16 g8 g8 |
%{BB63 %} c2( c2) |
}
%------------------------------------------------------------------------------
TBk = \relative c {
%{TB64 %} r2 r4 ef8 d16 ef(~ |
%{TB65-66%} ef4~ ef16 f16) g8 f4. af8 | g1~ | g1
}
PianoRH = \relative c' { \global
%{rh61 %} <ef g bf>4~ q8 <g bf ef g>16 <af ef' af>16 <bf ef bf'>8. ef16 <ef g bf ef>8 <d g bf d>8
%{rh62 %} <c ef af c>4 c,16 g16 af16 c16 <f, a c d>4 <d' f d'>8 <d g d'>8
%{rh63 %} <<{ <g c ef>4~ q4 <af ef'>2 }\\{ ef4~ ef8 ef16 r8 af,8 <c~ g'>8 <c f>8 }>>
%{rh64 %} <<{ r8 bf''16 af16 ef16 df16 bf16 af16 ef8[ \grace{ bf16[ ef16] } bf8] <ef, af ef'>4 }\\{ <f bf ef>2. s4 }>>
%{rh65 %} <g bf ef>2\stemUp <af c f>2
%{rh66 %} <g bf ef g>2 <c ef f af>2 r1
}
%------------------------------------------------------------------------------
PianoLH = \relative c { \global \clef bass
%{lh61 %} <<{ r16 bf16 ef16 f16 s2 r16 ef16 bf'8 }\\{ ef,,4 g'8 <ef bf' ef>16 <f f'>16 <g bf ef g>4 g,4 }>>
%{lh62 %} <<{ s4 <af, af'>4 <g g'>4 s4 }\\{ <af' ef' c'>4\arpeggio s2 <g d' b'>4\arpeggio }>>
%{lh63 %} <<{ r16 g16 c16 d16 ef16 g16 c8 <f, c'>2 }\\{c,2 r4 c'4 }>>
%{lh64 %} <df, af'>2. <cf gf'>4_-
%{lh65 %} <<{ bf'2 bf2 }\\{ bf,4 bf4 bf4 bf4 }>>
%{lh66 %} <<{ bf'2 bf2 }\\{ bf,4 bf4 bf4 bf4 }>> r1
}
%%%%%%%%%%%%%%%%% SA_TB seperate + piano staff
% {
\score {
\new GrandStaff = "GrandStaff_score" <<
\new ChoirStaff <<
\new Staff \with { \override RestCollision #'positioning-done = #merge-rests-on-positioning
}<<
\clef "bass"
\global \partcombine
\new Voice = "Tenor" {
\voiceOne { \TTj \TBk }}
\new Voice = "Bass" {
\voiceTwo { \BBj \TBk }}
>>
>>
\new PianoStaff <<
\set PianoStaff.connectArpeggios = ##t
\new Staff = "RH" { \global \PianoRH }
\new Staff = "LH" { \global \clef bass \PianoLH }
>>
>>
\layout { indent = #'0
\context { \RemoveEmptyStaffContext }
\context {
\Staff
\override TimeSignature #'style = #'()
}
}
\midi {
\context { }
\context { \Staff \remove "Dynamic_performer" }
}
}

<><><>end
 
Blessing in+,
Ming.

Attachment: 2012-04-03_234234.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]