|
From: | Saul Tobin |
Subject: | Re: New snippet: remove staff if another is alive (for wind divisi) |
Date: | Fri, 3 Aug 2018 14:33:13 -0700 |
On 8/3/2018 5:14 PM, Saul Tobin wrote:_______________________________________________
Hi all,
I just put together a snippet to make managing shared wind staves more automatic, particularly with triple winds that may be combined in different ways.
\version "2.19.82"
#(define remove-if-sibling(lambda (offsets)(lambda (grob)(let* (;; The parent of a VerticalAxisGroup is a VerticalAlignment(parent (ly:grob-parent grob 1));; Get the children VerticalAxisGroups of the parent(siblings (ly:grob-object parent 'elements))(siblings-list(if (ly:grob-array? siblings)(ly:grob-array->list siblings)'()));; Find the siblings above or below me by offsets(my-vindex (ly:grob-get-vertical-axis-group-index grob))(enemy-indices (map (lambda (offset) (+ offset my-vindex)) offsets))(enemy-vaxis? (lambda (v) (member (ly:grob-get-vertical-axis-group-index v)enemy-indices)))(enemy-vaxes(filter enemy-vaxis? siblings-list)));; Suicide if an enemy sibling is alive(map(lambda (enemy-vaxis)(ly:pointer-group-interface::add-grob grob 'make-dead-when enemy-vaxis))enemy-vaxes)))))
%% Two Staff Example
global = {s1\breaks1\breaks1*2}
I = {c'''1\context Staff = "1" { \set Staff.keepAliveInterfaces = #'() }c'''1c'''1\context Staff = "1" { \unset Staff.keepAliveInterfaces }c'''1}
II = {e''1e''1e''1e''1}
<<\new Staff = "1+2" \with {\override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(1))\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \partcombine \I \II >>\new Staff = "1" \with {\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \I >>\new Staff = "2" \with {\override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(-2))\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \II >>>>
%% Three Staff Example
global = {s1\breaks1\breaks1\breaks1*2}
I = {c'''1\context Staff = "1" { \set Staff.keepAliveInterfaces = #'() }c'''1c'''1c'''1\context Staff = "1" { \unset Staff.keepAliveInterfaces }c'''1}
II = {e''1e''1e''1e''1e''1}
III = {a'1a'1\context Staff = "3" { \set Staff.keepAliveInterfaces = #'() }a'1a'1a'1}
<<\new Staff = "1+2+3" \with {\override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(2 5))\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \I \II \III >>\new Staff = "1+2" \with {\override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(1 -1))\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \partcombine \I \II >>\new Staff = "1" \with {\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \I >>\new Staff = "2+3" \with {\override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(2 -3))\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \partcombine \II \III >>\new Staff = "2" \with {\override VerticalAxisGroup.before-line-breaking = #(remove-if-sibling '(-1 -3 -4))\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \II >>\new Staff = "3" \with {\override VerticalAxisGroup.remove-empty = ##t\override VerticalAxisGroup.remove-first = ##t} << \global \III >>>>
Hello,
Thanks for sharing this with us! One question...
When I just copy and paste your snippet into Frescobaldi as is, I get a few errors. ?
=============
Interpreting music...Interpreting music...
Interpreting music...
Interpreting music...
Interpreting music...
Preprocessing graphical objects...
Interpreting music...
Preprocessing graphical objects...
document.ly:103:3: warning: this Voice needs a \voiceXx or \shiftXx setting
e''1
document.ly:102:3: warning: this Voice needs a \voiceXx or \shiftXx setting
e''1
document.ly:101:3: warning: this Voice needs a \voiceXx or \shiftXx setting
e''1
document.ly:100:3: warning: this Voice needs a \voiceXx or \shiftXx setting
e''1
document.ly:99:3: warning: this Voice needs a \voiceXx or \shiftXx setting
e''1
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `./tmp-lilypond-BWUill'...
Converting to `document.pdf'...
Deleting `./tmp-lilypond-BWUill'...
Success: compilation successfully completed
Completed successfully in 1.0".
lilypond-user mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/lilypond-user
[Prev in Thread] | Current Thread | [Next in Thread] |