[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: treble and bass clef simultaneously
From: |
Werner LEMBERG |
Subject: |
Re: treble and bass clef simultaneously |
Date: |
Thu, 28 Mar 2019 07:20:35 +0100 (CET) |
> When staves are part of a group (such as PianoStaff), then it is
> important to use staff-staff-padding, not
> default-staff-staff-padding. So I goofed there.
>
> As penance, try out the following: [...]
Very nice, thanks! Attached is my slightly modified version.
* It uses `alignBelowContext', since otherwise it can happen that
grobs sticking out vertically of the left-hand staff collide with
grobs from the right-hand staff. It has the drawback that
`staff-staff-spacing' must be set in the main staff also, but I can
live with that. As the attached image shows, there still can be
collisions, but in my music the system distances are sufficiently
large to avoid that.
* It also replaces `\once\override' with `\override ... \revert' so
that the second argument of \fakeBassClef can contain skips.
The last missing bit is the hard-coded offset of the fake bass clef
offset, which doesn't take any accidentals (and similar things left of
the note head) into account.
Werner
\version "2.19.83"
fakeBassClef = #(define-music-function (align-below treble bass)
((string? #f) ly:music? ly:music?)
(define (context-id? id)
(and (string? id)
(not (string-null? id))))
(define prefix-with-bass-clef
(grob-transformer 'stencil (lambda (grob orig)
(grob-interpret-markup grob #{
\markup \with-dimensions-from \stencil $orig {
\overlay {
\stencil $orig
\translate #`(-4 . 0)
\fontsize #-2 \musicglyph "clefs.F"
}
}
#} ))))
#{
% When alignBelowContext is unspecified, attempt to find it.
\applyContext #(lambda (context)
(if (not (context-id? align-below))
(let* ((staff (ly:context-find context 'Staff))
(id (and (ly:context? staff)
(ly:context-id staff))))
(if (context-id? id)
(set! align-below id)
(ly:warning "fakeBassClef: No named Staff found.")))))
<<
{ #treble }
\new Staff \with {
\remove "Time_signature_engraver"
\remove "Clef_engraver"
\omit StaffSymbol
#(ly:make-context-mod `((apply ,(lambda (c)
(if (context-id? align-below)
(set! (ly:context-property c 'alignBelowContext) align-below))))))
% Force overlap by using a very large negative padding.
\override VerticalAxisGroup.staff-staff-spacing =
#'((basic-distance . 0)
(minimum-distance . 0)
(padding . -100)
(stretchability . 0))
} {
\clef "bass" \voiceTwo
\override NoteHead.stencil = #prefix-with-bass-clef
#bass
\revert NoteHead.stencil
\oneVoice
}
>>
#} )
%%%%%
\new PianoStaff <<
\new Staff = "right" {
\repeat unfold 8 { c'8_[ b''' b''' c'] } |
}
\new Staff = "left" \with {
% necessary for \fakeBassClef
\override VerticalAxisGroup.staff-staff-spacing =
#'((basic-distance . 0)
(minimum-distance . 0)
(padding . -100)
(stretchability . 0))
} \relative c'' {
c8 g'' a g,, \fakeBassClef { <fis ais cis> g } { c,,,4 } a'''8 g |
\fakeBassClef { <fis ais cis>8 g } { s cis,,,8 } a'''8 g c g a g |
\break
\fakeBassClef { <fis ais cis>8 g } { c,,,4 } a'''8 g c g a g |
c8 g'' a g,, \fakeBassClef { <fis ais cis> g } { s ces,,,8 } a'''8 g |
}
>>
Re: treble and bass clef simultaneously, Andrew Bernard, 2019/03/27
Re: treble and bass clef simultaneously, Thomas Morley, 2019/03/27
- Re: treble and bass clef simultaneously, Werner LEMBERG, 2019/03/28
- Re: treble and bass clef simultaneously, Thomas Morley, 2019/03/28
- Re: treble and bass clef simultaneously, Thomas Morley, 2019/03/29
- Re: treble and bass clef simultaneously, Werner LEMBERG, 2019/03/30
- Re: treble and bass clef simultaneously, Thomas Morley, 2019/03/30
- Re: treble and bass clef simultaneously, Thomas Morley, 2019/03/30