lilypond-user
[Top][All Lists]
Advanced

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

Re: GrandStaff vertical distance


From: foxfanfare
Subject: Re: GrandStaff vertical distance
Date: Fri, 12 Oct 2018 01:40:20 -0700 (MST)

Lukas-Fabian Moser wrote
> 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
> 
> _______________________________________________
> lilypond-user mailing list

> lilypond-user@

> https://lists.gnu.org/mailman/listinfo/lilypond-user

Hi,

I've added to the list the square:

\version "2.19.81"

\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)))))
                              ((equal? (car entry) 'square)
                               (list (cons 'SystemStartSquare
(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 #'((square . 2) skip (extraBracket . 2) (brace . 2))
} <<
   \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 }
 >> 

***

The StartDelimiterHierarchy gives the possibility to change the first
bracket by anything you want, for instance:

\new StaffGroup
\relative c'' <<
  \set StaffGroup.systemStartDelimiterHierarchy
    = #'(SystemStartBar (SystemStartBrace a b))
  \new Staff { c1 }
  \new Staff { c1 }
  \new Staff { c1 }
  \new Staff { c1 }
  \new Staff { c1 }
>>

\new StaffGroup
\relative c'' <<
  \set StaffGroup.systemStartDelimiterHierarchy
    = #'(SystemStartBrace (SystemStartBracket a b c))
  \new Staff { c1 }
  \new Staff { c1 }
  \new Staff { c1 }
  \new Staff { c1 }
  \new Staff { c1 }
>>

It would be interesting if your function can manage also that!



--
Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html



reply via email to

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