lilypond-user
[Top][All Lists]
Advanced

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

Re: GrandStaff vertical distance


From: Lukas-Fabian Moser
Subject: Re: GrandStaff vertical distance
Date: Thu, 11 Oct 2018 23:19:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

Hi,

Thank you for this little function Lukas! It is very good and useful. Would
it be possible to add to the list the choice for "square" or "bracket"? Some
editions are using squares for grouping Violins 1-2.

Ah, do you mean an extra bracket? No problem. I also added the possibility to skip single staffs without having to issue a pair, e.g.
#'((extraBracket . 2) skip skip (brace . 3))
would mean: connect the first 2 staves with an extra bracket, then skip 2 staves, then join the next 3 staves with a brace:

\version "2.19.82"

\layout {
  indent = 35
}

#(define (make-n-copies x n)
   (if (> n 0)
       (cons x (make-n-copies x (- n 1)))
       '()))

#(define (make-delimiter-hierarchy group-list)
   ; expects a list of pairs of the form (symbol . number) where
   ; symbol is either brace, noBrace or extraBracket
   ; number is the number of staves connected by a brace/extra bracket/nothing
   ; an arbitrary non-pair entry is interpreted as a single staff
   (apply append (map (lambda (entry)
                        (if (pair? entry)
                            (cond
                             ((equal? (car entry) 'brace)
                              (list (cons 'SystemStartBrace (make-n-copies 'staff (cdr entry)))))
                             ((equal? (car entry) 'extraBracket)
                              (list (cons 'SystemStartBracket (make-n-copies 'staff (cdr entry)))))
                             (else
                              (make-n-copies 'some-staff (cdr entry))))
                            '(some-staff)))
                   group-list)))



setBraces = #(define-music-function (group-list) (list?) #{
  \set StaffGroup.systemStartDelimiterHierarchy = #(make-delimiter-hierarchy group-list)
               #})

\new StaffGroup \with {
  \setBraces #'((extraBracket . 2) skip skip (brace . 3))
} <<
  \new Staff = "Staff_violinI" \with { instrumentName = #"Violin I" } { a }
  \new Staff = "Staff_violinII" \with { instrumentName = #"Violin II" } { a }
  \new Staff = "Staff_viola" \with { instrumentName = #"Viola" } { a }
  \new Staff = "Staff_cello" \with { instrumentName = #"Cello" } { a }
  \new Staff = "Staff_bassd" \with { instrumentName = #"Double Bass" } { a }   \new Staff = "Staff_basst" \with { instrumentName = #"Triple Bass" } { a }   \new Staff = "Staff_bassq" \with { instrumentName = #"Quadruple Bass" } { a }
>>

As suggested by David, it would be then enough "user-level" and complete to
be documented, don't you think?
I'm afraid the threshold for additions to the set of "stock" functions shipped with Lilypond is quite high (regarding quality of code, bug-freeness, robustness, universality etc.). Maybe one could turn this into a snippet, but I've never done this.

Best
Lukas



reply via email to

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