[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: treble and bass clef simultaneously
From: |
Thomas Morley |
Subject: |
Re: treble and bass clef simultaneously |
Date: |
Fri, 29 Mar 2019 10:20:18 +0100 |
Am Do., 28. März 2019 um 23:52 Uhr schrieb Thomas Morley
<address@hidden>:
>
> Am Do., 28. März 2019 um 08:02 Uhr schrieb Werner LEMBERG <address@hidden>:
> >
> >
> > > here my factious approach: [...]
> >
> > Thanks a lot! Attached is the same sample code as with Aaron's
> > solution. Do you see a possibility to make leading skips work in the
> > second argument of \clefTst?
> >
> >
> > Werner
>
> Probably like below.
> Again: not tested beyond the given example!
>
> \version "2.19.82"
>
> \layout {
> \context {
> \Voice
> \name "ClefVoice"
> \alias "Voice"
> \consists "Clef_engraver"
> clefGlyph = #"clefs.F"
> middleCPosition = #6
> clefPosition = #-8
> explicitClefVisibility = ##(#f #t #t)
> \override Clef.full-size-change = ##t
> \override Clef.font-size = #-4
> \override Clef.space-alist.next-note = #'(fixed-space . 2)
> \override Clef.after-line-breaking =
> #(lambda (grob)
> (let ((col (ly:item-get-column grob)))
> (if (eqv? (ly:item-break-dir grob) 1)
> (ly:grob-translate-axis!
> grob
> (cdr (ly:grob-extent col col X))
> X))))
> }
> %% probably let ClefVoice be accepted by other contexts too
> \context {
> \Staff
> \accepts "ClefVoice"
> }
> }
>
>
> clefTst =
> #(define-music-function (m1 m2) (ly:music? ly:music?)
>
>
> (ly:music-set-property! m2 'elements
> (call-with-values
> (lambda ()
> (partition
> (lambda (m) (music-is-of-type? m 'skip-event))
> (ly:music-property m2 'elements)))
> (lambda (a b)
> (append
> a
> (list
> #{
> \context ClefVoice = "ClefVoice" {
> %% Mmmh, this is a Score-override, may cause problems ...
> \temporary \override Score.BreakAlignment.before-line-breaking =
> #(lambda (grob)
> (if (eqv? (ly:item-break-dir grob) 0)
> (ly:grob-set-property! grob 'break-align-orders
> (make-vector 3 '(span-bar
> breathing-sign
> staff-bar
> key-cancellation
> key-signature
> time-signature
> clef)))))
> \voiceTwo
> %\set forceClef = ##t
> #(make-sequential-music b)
> \revert Score.BreakAlignment.before-line-breaking
> }
> #})))))
>
> #{ << $m1 $m2 >> #})
>
>
> \new PianoStaff <<
> \new Staff = "right" {
> \repeat unfold 8 { c'8_[ b''' b''' c'] } |
> }
> \new Staff = "left" \relative c'' {
> c8 g'' a g,, \clefTst { <fis ais cis> g } { c,,,4 } a'''8 g |
> \clefTst { <fis ais cis>8 g } { s cis,,,8 } a'''8 g c g a g |
>
> \break
>
> \clefTst { <fis ais cis>8 g } { c,,,4 } a'''8 g c g a g |
> c8 g'' a g,, \clefTst { <fis ais cis> g } { s ces,,,8 } a'''8 g |
> }
> >>
>
> Cheers,
> Harm
More robust:
clefTst =
#(define-music-function (m1 m2) (ly:music? ly:music?)
(ly:music-set-property! m2 'elements
(let* ((m2-elts (ly:music-property m2 'elements))
(idx
(list-index
(lambda (m) (or (music-is-of-type? m 'note-event)
(music-is-of-type? m 'event-chord)))
m2-elts)))
(call-with-values
(lambda () (split-at m2-elts idx))
(lambda (a b)
(append
a
(list
#{
\context ClefVoice = "ClefVoice" {
%% Mmmh, this is a Score-override, may cause problems ...
\temporary
\override Score.BreakAlignment.before-line-breaking =
#(lambda (grob)
(if (eqv? (ly:item-break-dir grob) 0)
(ly:grob-set-property! grob 'break-align-orders
(make-vector 3 '(span-bar
breathing-sign
staff-bar
key-cancellation
key-signature
time-signature
clef)))))
\voiceTwo
%\set forceClef = ##t
#(make-sequential-music b)
\revert Score.BreakAlignment.before-line-breaking
}
#}))))))
#{ << $m1 $m2 >> #})
Cheers,
Harm
- Re: treble and bass clef simultaneously, (continued)
Re: treble and bass clef simultaneously, Andrew Bernard, 2019/03/27
Re: treble and bass clef simultaneously, Thomas Morley, 2019/03/27