GrandStaff vertical distance

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|

GrandStaff vertical distance

foxfanfare
Hi all,

I'm trying to configure a template for my orchestral works but I have a
problem with the GrandStaff vertical distance. You can take the template
proposed in the manual to see the problem:
http://lilypond.org/doc/v2.19/Documentation/learning/orchestra-choir-and-piano

You can see in the string section, between Violin II and Viola, an extra
space is added due to the use of the brace of the GrandStaff. (Same problem
with the Alti group in the choir).

I have made some ressearch in scores and also in Gould's book, this is verry
unconventional. A space is added between the StaffGroups, but should not
appear within the same family.

How could you properly change that? I tried with:
\override GrandStaff.StaffGrouper.staffgroup-staff-spacing = #'(
        (basic-distance . 9)
        (minimum-distance . 7)
        (padding . 1)
        (stretchability . 5))

But this will move above AND bellow the GrandStaff. Here is in my score the
illustration of the problem:
distance.png <http://lilypond.1069038.n5.nabble.com/file/t5604/distance.png>  



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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Aaron Hill
On 2018-10-09 7:15 am, foxfanfare wrote:

> Hi all,
>
> I'm trying to configure a template for my orchestral works but I have a
> problem with the GrandStaff vertical distance. You can take the
> template
> proposed in the manual to see the problem:
> http://lilypond.org/doc/v2.19/Documentation/learning/orchestra-choir-and-piano
>
> You can see in the string section, between Violin II and Viola, an
> extra
> space is added due to the use of the brace of the GrandStaff. (Same
> problem
> with the Alti group in the choir).
>
> I have made some ressearch in scores and also in Gould's book, this is
> verry
> unconventional. A space is added between the StaffGroups, but should
> not
> appear within the same family.
>
> How could you properly change that? I tried with:
> \override GrandStaff.StaffGrouper.staffgroup-staff-spacing = #'(
>         (basic-distance . 9)
>         (minimum-distance . 7)
>         (padding . 1)
>         (stretchability . 5))
>
> But this will move above AND bellow the GrandStaff. Here is in my score
> the
> illustration of the problem:
> distance.png
> <http://lilypond.1069038.n5.nabble.com/file/t5604/distance.png>

I can see the same behavior given the default settings; but if you are
explicit about your spacing parameters, then it seems the spacing can be
forced to be even.  Consider the following contrived example:

%%%%
\version "2.19.82"

notes = { <c' b' a''>1 }
\score {
   <<
     \new Staff \notes
     \new Staff \notes
     \new StaffGroup <<
       \new Staff \notes
       \new Staff \notes
       \new GrandStaff <<
         \new Staff \notes
         \new Staff \notes
       >>
       \new Staff \notes
       \new Staff \notes
     >>
     \new Staff \notes
     \new Staff \notes
   >>
   \layout {
     \context { \Score
       \override StaffGrouper.staffgroup-staff-spacing.basic-distance =
#9
     }
   }
}
%%%%

The default basic-distance for staff groups seems to be roughly 11, but
staves normally prefer a basic-distance around 9.  That override above
seems to be enough to make my contrived example show (nearly) consistent
spacing.

Another thing that worked was setting the staff-staff-spacing at the
\Staff level:

%%%%
   \layout {
     \context { \Staff
       \override VerticalAxisGroup.staff-staff-spacing.basic-distance =
#9
     }
   }
%%%%

However, this doesn't really make sense to me.  Maybe someone with a
better understanding of the internals could determine whether this is
expected behavior.  But it seems that the staff-staff-spacing override
trumps staffgroup-staff-spacing, which means one loses a degree of
freedom if you do want to adjust those independently.  Then again, all
the staves are in the same system, so perhaps staff-staff-spacing really
should apply regardless of whether or not the staves belong to staff
groups.


-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

foxfanfare
Aaron Hill wrote

> On 2018-10-09 7:15 am, foxfanfare wrote:
>> Hi all,
>>
>> I'm trying to configure a template for my orchestral works but I have a
>> problem with the GrandStaff vertical distance. You can take the
>> template
>> proposed in the manual to see the problem:
>> http://lilypond.org/doc/v2.19/Documentation/learning/orchestra-choir-and-piano
>>
>> You can see in the string section, between Violin II and Viola, an
>> extra
>> space is added due to the use of the brace of the GrandStaff. (Same
>> problem
>> with the Alti group in the choir).
>>
>> I have made some ressearch in scores and also in Gould's book, this is
>> verry
>> unconventional. A space is added between the StaffGroups, but should
>> not
>> appear within the same family.
>>
>> How could you properly change that? I tried with:
>> \override GrandStaff.StaffGrouper.staffgroup-staff-spacing = #'(
>>         (basic-distance . 9)
>>         (minimum-distance . 7)
>>         (padding . 1)
>>         (stretchability . 5))
>>
>> But this will move above AND bellow the GrandStaff. Here is in my score
>> the
>> illustration of the problem:
>> distance.png
>> &lt;http://lilypond.1069038.n5.nabble.com/file/t5604/distance.png&gt;
>
> I can see the same behavior given the default settings; but if you are
> explicit about your spacing parameters, then it seems the spacing can be
> forced to be even.  Consider the following contrived example:
>
> %%%%
> \version "2.19.82"
>
> notes = { &lt;c' b' a''&gt;1 }
> \score {
>    <<
>      \new Staff \notes
>      \new Staff \notes
>      \new StaffGroup <<
>        \new Staff \notes
>        \new Staff \notes
>        \new GrandStaff <<
>          \new Staff \notes
>          \new Staff \notes
>        >>
>        \new Staff \notes
>        \new Staff \notes
>      >>
>      \new Staff \notes
>      \new Staff \notes
>    >>
>    \layout {
>      \context { \Score
>        \override StaffGrouper.staffgroup-staff-spacing.basic-distance =
> #9
>      }
>    }
> }
> %%%%
>
> The default basic-distance for staff groups seems to be roughly 11, but
> staves normally prefer a basic-distance around 9.  That override above
> seems to be enough to make my contrived example show (nearly) consistent
> spacing.
>
> Another thing that worked was setting the staff-staff-spacing at the
> \Staff level:
>
> %%%%
>    \layout {
>      \context { \Staff
>        \override VerticalAxisGroup.staff-staff-spacing.basic-distance =
> #9
>      }
>    }
> %%%%
>
> However, this doesn't really make sense to me.  Maybe someone with a
> better understanding of the internals could determine whether this is
> expected behavior.  But it seems that the staff-staff-spacing override
> trumps staffgroup-staff-spacing, which means one loses a degree of
> freedom if you do want to adjust those independently.  Then again, all
> the staves are in the same system, so perhaps staff-staff-spacing really
> should apply regardless of whether or not the staves belong to staff
> groups.
>
>
> -- Aaron Hill
>
> _______________________________________________
> lilypond-user mailing list

> lilypond-user@

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

Hi Aaron, thanks for your reply. I tried your solution but again, it moves
either all the staves, or above and below a grand staff. This isn't the
ideal behaviour.

In the meantime, I found another solution for this, but this doesn't appear
to be the easiest way to do it! I used systemStartDelimiterHierarchy instead
which doesn't add any space within a family group. Again, with the LilyPond
exemple, this will give:

%---
fluteMusic = \relative c' { \key g \major g'1 b }
% Pitches as written on a manuscript for Clarinet in A
% are transposed to concert pitch.
clarinetMusic = \transpose c' a
  \relative c'' { \key bes \major bes1 d }
trumpetMusic = \relative c { \key g \major g''1 b }

% Key signature is often omitted for horns
hornMusic = \transpose c' f
  \relative c { d'1 fis }
percussionMusic = \relative c { \key g \major g1 b }
pianoRHMusic = \relative c { \key g \major g''1 b }
pianoLHMusic = \relative c { \clef bass \key g \major g1 b }
violinIMusic = \relative c' { \key g \major g'1 b }
violinIIMusic = \relative c' { \key g \major g'1 b }
violaMusic = \relative c { \clef alto \key g \major g'1 b }
celloMusic = \relative c { \clef bass \key g \major g1 b }
bassMusic = \relative c { \clef "bass_8" \key g \major g,1 b }

\score {
  <<
    \new StaffGroup = "StaffGroup_woodwinds" <<
      \new Staff = "Staff_flute" \with { instrumentName = #"Flute" }
      \fluteMusic
      \new Staff = "Staff_clarinet" \with {
        instrumentName = \markup { \concat { "Clarinet in B" \flat } }
      }
      % Declare that written Middle C in the music
      % to follow sounds a concert B flat, for
      % output using sounded pitches such as MIDI.
      %\transposition bes

      % Print music for a B-flat clarinet
      \transpose bes c' \clarinetMusic
    >>
    \new StaffGroup = "StaffGroup_brass" <<
      \new Staff = "Staff_hornI" \with { instrumentName = #"Horn in F" }
       % \transposition f
        \transpose f c' \hornMusic
      \new Staff = "Staff_trumpet" \with { instrumentName = #"Trumpet in  C"
}
      \trumpetMusic
    >>
    \new RhythmicStaff = "RhythmicStaff_percussion"
    \with { instrumentName = #"Percussion" }
    <<
      \percussionMusic
    >>
    \new PianoStaff \with { instrumentName = #"Piano" }
    <<
      \new Staff { \pianoRHMusic }
      \new Staff { \pianoLHMusic }
    >>    

    \new StaffGroup <<
      \set StaffGroup.systemStartDelimiterHierarchy =
        #'(SystemStartBracket (SystemStartBrace (SystemStartBracket a) b) c)  
        \new Staff = "Staff_violinI" \with { instrumentName = #"Violin I" }
        \violinIMusic
        \new Staff = "Staff_violinII" \with { instrumentName = #"Violin II"
}
        \violinIIMusic
      \new Staff = "Staff_viola" \with { instrumentName = #"Viola" }
      \violaMusic
      \new Staff = "Staff_cello" \with { instrumentName = #"Cello" }
      \celloMusic
      \new Staff = "Staff_bass" \with { instrumentName = #"Double Bass" }
      \bassMusic
    >>
  >>
  \layout { }
}

%---

I would be interested if someone find another way to do this... But at
least, this seems to work!



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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

SoundsFromSound
On 10/9/2018 5:01 PM, foxfanfare wrote:
Aaron Hill wrote
On 2018-10-09 7:15 am, foxfanfare wrote:
Hi all,

I'm trying to configure a template for my orchestral works but I have a
problem with the GrandStaff vertical distance. You can take the 
template
proposed in the manual to see the problem:
http://lilypond.org/doc/v2.19/Documentation/learning/orchestra-choir-and-piano

You can see in the string section, between Violin II and Viola, an 
extra
space is added due to the use of the brace of the GrandStaff. (Same 
problem
with the Alti group in the choir).

I have made some ressearch in scores and also in Gould's book, this is 
verry
unconventional. A space is added between the StaffGroups, but should 
not
appear within the same family.

How could you properly change that? I tried with:
\override GrandStaff.StaffGrouper.staffgroup-staff-spacing = #'(
        (basic-distance . 9)
        (minimum-distance . 7)
        (padding . 1)
        (stretchability . 5))

But this will move above AND bellow the GrandStaff. Here is in my score 
the
illustration of the problem:
distance.png 
&lt;http://lilypond.1069038.n5.nabble.com/file/t5604/distance.png&gt;
I can see the same behavior given the default settings; but if you are 
explicit about your spacing parameters, then it seems the spacing can be 
forced to be even.  Consider the following contrived example:

%%%%
\version "2.19.82"

notes = { &lt;c' b' a''&gt;1 }
\score {
   <<
     \new Staff \notes
     \new Staff \notes
     \new StaffGroup <<
       \new Staff \notes
       \new Staff \notes
       \new GrandStaff <<
         \new Staff \notes
         \new Staff \notes
       >>
       \new Staff \notes
       \new Staff \notes
     >>
     \new Staff \notes
     \new Staff \notes
   >>
   \layout {
     \context { \Score
       \override StaffGrouper.staffgroup-staff-spacing.basic-distance = 
#9
     }
   }
}
%%%%

The default basic-distance for staff groups seems to be roughly 11, but 
staves normally prefer a basic-distance around 9.  That override above 
seems to be enough to make my contrived example show (nearly) consistent 
spacing.

Another thing that worked was setting the staff-staff-spacing at the 
\Staff level:

%%%%
   \layout {
     \context { \Staff
       \override VerticalAxisGroup.staff-staff-spacing.basic-distance = 
#9
     }
   }
%%%%

However, this doesn't really make sense to me.  Maybe someone with a 
better understanding of the internals could determine whether this is 
expected behavior.  But it seems that the staff-staff-spacing override 
trumps staffgroup-staff-spacing, which means one loses a degree of 
freedom if you do want to adjust those independently.  Then again, all 
the staves are in the same system, so perhaps staff-staff-spacing really 
should apply regardless of whether or not the staves belong to staff 
groups.


-- Aaron Hill

_______________________________________________
lilypond-user mailing list


Hi Fox,

I use this override when I need to change vertical space in my PianoStaff / GrandStaff situations but they don't move anything else like you're talking about - unless I'm missing something. Does this code help you?

\version "2.19.82"
\language "english"

\new GrandStaff
\with {
  \override StaffGrouper.staff-staff-spacing.basic-distance = #22
}
    
{
  <<
    \new Staff = "RH" \relative c' { \clef treble c1 c c c }
    \new Staff = "LH" \relative c { \clef bass c c c c  }
  >>
 
}

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
composer | sound designer | asmr artist
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

foxfanfare
Thanks for your reply SoundsFromSound, unfortunately, this doesn't solve my
problem. I may have been unclear of what the problem is.

I tried to understand how it was possible to configure in LP a full score
layout. I searched for some templates and read how family groups works
(http://lilypond.org/doc/v2.19/Documentation/notation/displaying-staves#grouping-staves).

But I noticed a problem when you use a combination of two groups. LP seems
to add spaces on top and below a new group, even if this group was already
in another group. Let's take this example:
https://www.henle.de/en/detail/?Title=Piano+Concerto+no.+2+B+flat+major+op.+83_7231

You can notice (page 17) that the four horns, violins I-II and Cello-Double
Bass are grouped with a brace. I made a copy of this example :
Piano_Concerto_Template.ly
<http://lilypond.1069038.n5.nabble.com/file/t5604/Piano_Concerto_Template.ly>  

The first page illustrate the use of the GrandStaff to achieve this (as
proposed in the documentation:
http://lilypond.org/doc/v2.19/Documentation/learning/orchestra-choir-and-piano).
You can notice that the staves aren't disposed properly by default with this
solution.

This means that one should avoid the use of "GrandStaff" for this purpose in
order to avoid any new space. I used in the second page of my exemple the
property systemStartDelimiterHierarchy. This works better for most of the
cases, but in this example, I was unable to group the celli and double bass
staves...

What I was trying to achieve, is to make the template look harmonious by
default, without having to adjust manually those extra undesirables spaces.

I hope my explanation of the problem is now clear!

staff-spaces.JPG
<http://lilypond.1069038.n5.nabble.com/file/t5604/staff-spaces.JPG>  



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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

foxfanfare
foxfanfare wrote
> This works better for most of the
> cases, but in this example, I was unable to group the celli and double
> bass
> staves...

Answering my own problem here. I don't know how I got it, but after some
experimentations, I found:
\set StaffGroup.systemStartDelimiterHierarchy =
      #'((SystemStartBrace a b) SystemStartL (SystemStartBrace a b))

Piano_Concerto_Template.ly
<http://lilypond.1069038.n5.nabble.com/file/t5604/Piano_Concerto_Template.ly>  

So, it appears it is possible to make everything work properly with
systemStartDelimiterHierarchy. It appears to me as a non-sense then to use
GrandStaff for this purpose. What do you guys think about this? Would it be
useful to update the template in the documentation with this solution?
Because in my opinion, the default output proposed there is
unconventional...



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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Lukas-Fabian Moser
In reply to this post by foxfanfare
Hi,

> In the meantime, I found another solution for this, but this doesn't appear
> to be the easiest way to do it! I used systemStartDelimiterHierarchy instead
> which doesn't add any space within a family group. Again, with the LilyPond
> exemple, this will give:
[...]
> I would be interested if someone find another way to do this... But at
> least, this seems to work!
I daresay this might be the best and even the semantically "correct"
solution. Note that the brace connecting Violin 1 and Violin 2 does not
yield an "instrument" that is used to being held together by a brace
(like a piano), but is a mere notational convention. What we really want
is, I think, 4-5 staves of strings with equal rights, the first two of
which happen to be connected by an additional brace.

But I think your usage of systemStartDelimiterHierarchy is not yet
optimal. It can be simplified to
\set StaffGroup.systemStartDelimiterHierarchy = #'((SystemStartBrace a b))

Also, I would not do this via \set, but in a \with block. If you then
also put this into a variable, it gets very easy to use:

\version "2.19.80"

firstTwoBraced = \with {
   systemStartDelimiterHierarchy = #'((SystemStartBrace a a))
}

\new StaffGroup \with \firstTwoBraced <<
   \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_bass" \with { instrumentName = #"Double Bass" } { a }
 >>

With a little bit of scheme, it should even be easy to make this into a
function accepting to parameters, indicating that k staves starting with
the n'th staff should be braced.

Best
Lukas




_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

David Kastrup
In reply to this post by foxfanfare
foxfanfare <[hidden email]> writes:

> foxfanfare wrote
>> This works better for most of the
>> cases, but in this example, I was unable to group the celli and double
>> bass
>> staves...
>
> Answering my own problem here. I don't know how I got it, but after some
> experimentations, I found:
> \set StaffGroup.systemStartDelimiterHierarchy =
>       #'((SystemStartBrace a b) SystemStartL (SystemStartBrace a b))
>
> Piano_Concerto_Template.ly
> <http://lilypond.1069038.n5.nabble.com/file/t5604/Piano_Concerto_Template.ly>  
>
> So, it appears it is possible to make everything work properly with
> systemStartDelimiterHierarchy. It appears to me as a non-sense then to use
> GrandStaff for this purpose. What do you guys think about this? Would it be
> useful to update the template in the documentation with this solution?
> Because in my opinion, the default output proposed there is
> unconventional...

Ugh.  That does not really look like much of a user-level interface.
But I suppose that a bracing structure that does not simultaneously
imply context hierarchies and causes spacing differences will definitely
be enough user-desirable feature that documenting the current way to
mess with it would be a good idea.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Lukas-Fabian Moser
In reply to this post by Lukas-Fabian Moser

> With a little bit of scheme, it should even be easy to make this into
> a function accepting to parameters, indicating that k staves starting
> with the n'th staff should be braced.

Here is an implementation of that. Unfortunately I do not know if/how it
is possible to define the function (which issues a \set) in such a way
that it might be called in a \with block, which would be neater imho.
But it seems to work anyway...

\version "2.19.80"

\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 or noBrace
    ; number is the number of staves connected by a brace/no brace
    (apply append (map (lambda (group-pair)
                         (if (equal? (car group-pair) 'brace)
                             (list (cons 'SystemStartBrace
(make-n-copies 'staff (cdr group-pair))))
                             (make-n-copies 'some-staff (cdr group-pair))))
                    group-list)))

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



\new StaffGroup  <<
   \setBraces #'((brace . 2) (noBrace . 2) (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_dbass" \with { instrumentName = #"Double Bass" }
{ a }
   \new Staff = "Staff_tbass" \with { instrumentName = #"Triple Bass" }
{ a }
   \new Staff = "Staff_qbass" \with { instrumentName = #"Quadruple Bass"
} { a }
 >>


Best
Lukas

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

David Kastrup
Lukas-Fabian Moser <[hidden email]> writes:

>> With a little bit of scheme, it should even be easy to make this
>> into a function accepting to parameters, indicating that k staves
>> starting with the n'th staff should be braced.
>
> Here is an implementation of that. Unfortunately I do not know if/how
> it is possible to define the function (which issues a \set) in such a
> way that it might be called in a \with block, which would be neater
> imho.

Have you tried just calling it in a \with block?  Stuff like \set is
automatically converted into context modification there.  Of course, you
can also define a scheme function _returning_ a \with block and use
that, but that has the disadvantage of not working as music as well.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Lukas-Fabian Moser
Hi David,

>> Here is an implementation of that. Unfortunately I do not know if/how
>> it is possible to define the function (which issues a \set) in such a
>> way that it might be called in a \with block, which would be neater
>> imho.
> Have you tried just calling it in a \with block?  Stuff like \set is
> automatically converted into context modification there.  Of course, you
> can also define a scheme function _returning_ a \with block and use
> that, but that has the disadvantage of not working as music as well.
>
Amazing!

\new Staff \with {
   \set ...
}

throws an error, but a music function which issues \set ... is accepted.
Wonderful, I would not have dreamed of it. So my example just becomes:

\new StaffGroup \with {
     \setBraces #'((brace . 2) (noBrace . 2) (brace . 3))
} <<
...
 >>

Do I understand it correctly that while a music function can't return a
\with block, a scheme function can?

Best
Lukas

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

David Kastrup
Lukas-Fabian Moser <[hidden email]> writes:

> Hi David,
>
>>> Here is an implementation of that. Unfortunately I do not know if/how
>>> it is possible to define the function (which issues a \set) in such a
>>> way that it might be called in a \with block, which would be neater
>>> imho.
>> Have you tried just calling it in a \with block?  Stuff like \set is
>> automatically converted into context modification there.  Of course, you
>> can also define a scheme function _returning_ a \with block and use
>> that, but that has the disadvantage of not working as music as well.
>>
> Amazing!
>
> \new Staff \with {
>   \set ...
> }
>
> throws an error, but a music function which issues \set ... is
> accepted. Wonderful, I would not have dreamed of it. So my example
> just becomes:
>
> \new StaffGroup \with {
>     \setBraces #'((brace . 2) (noBrace . 2) (brace . 3))
> } <<
> ...
>>>
>
> Do I understand it correctly that while a music function can't return
> a \with block, a scheme function can?

Yes.

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

David Kastrup
In reply to this post by Lukas-Fabian Moser
Lukas-Fabian Moser <[hidden email]> writes:

> Hi David,
>
>>> Here is an implementation of that. Unfortunately I do not know if/how
>>> it is possible to define the function (which issues a \set) in such a
>>> way that it might be called in a \with block, which would be neater
>>> imho.
>> Have you tried just calling it in a \with block?  Stuff like \set is
>> automatically converted into context modification there.  Of course, you
>> can also define a scheme function _returning_ a \with block and use
>> that, but that has the disadvantage of not working as music as well.
>>
> Amazing!
>
> \new Staff \with {
>   \set ...
> }
>
> throws an error,

Well, music functions and music variables I should have said.  General
music expressions don't make sense there, and the assignment and
override syntax in \with blocks is subtly different, so explicit
\set/\override are not allowed there either (but if they are part of a
music variable/function, they are just converted).

--
David Kastrup

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

foxfanfare
In reply to this post by Lukas-Fabian Moser
Lukas-Fabian Moser wrote

>> With a little bit of scheme, it should even be easy to make this into
>> a function accepting to parameters, indicating that k staves starting
>> with the n'th staff should be braced.
>
> Here is an implementation of that. Unfortunately I do not know if/how it
> is possible to define the function (which issues a \set) in such a way
> that it might be called in a \with block, which would be neater imho.
> But it seems to work anyway...
>
> \version "2.19.80"
>
> \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 or noBrace
>     ; number is the number of staves connected by a brace/no brace
>     (apply append (map (lambda (group-pair)
>                          (if (equal? (car group-pair) 'brace)
>                              (list (cons 'SystemStartBrace
> (make-n-copies 'staff (cdr group-pair))))
>                              (make-n-copies 'some-staff (cdr
> group-pair))))
>                     group-list)))
>
> setBraces = #(define-music-function (group-list) (list?) #{
>    \set StaffGroup.systemStartDelimiterHierarchy =
> #(make-delimiter-hierarchy group-list)
>                 #})
>
>
>
> \new StaffGroup  <<
>    \setBraces #'((brace . 2) (noBrace . 2) (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_dbass" \with { instrumentName = #"Double Bass" }
> { a }
>    \new Staff = "Staff_tbass" \with { instrumentName = #"Triple Bass" }
> { a }
>    \new Staff = "Staff_qbass" \with { instrumentName = #"Quadruple Bass"
> } { a }
>  >>
>
>
> Best
> Lukas
>
> _______________________________________________
> lilypond-user mailing list

> lilypond-user@

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

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.

As suggested by David, it would be then enough "user-level" and complete to
be documented, don't you think?





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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Lukas-Fabian Moser
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
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

foxfanfare
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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Lukas-Fabian Moser
Hi,

> The StartDelimiterHierarchy gives the possibility to change the first
> bracket by anything you want, for instance:
[...]
> It would be interesting if your function can manage also that!
I guess this is what happens when you start coding before agreeing on a
desirable user interface ;-).

Here we go:

\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 (symbol-or-list? x) (or (list? x) (symbol? x)))

#(define easy-delimiter-alist '((brace . SystemStartBrace)
                                 (bracket . SystemStartBracket)
                                 (square . SystemStartSquare)
                                 (barlineOnly . SystemStartBar)
                                 (barline . SystemStartBar)
                                 ))

#(define (make-delimiter-hierarchy magic-list)
    ; expects
    ; - either a symbol (brace, bracket, square, barline[Only])
    ; - or a list,
    ;   the first entry of which is such a symbol (may be missing, then
taken to be 'bracket)
    ;     defining the delimiter for the whole staffGroup,
    ;   followed by
    ;   - pairs of the form (symbol . number of staves), and/or
    ;   - placeholder symbols [which should never be an easy-delimiter
magic word, so preferably 'staff or 'void)
    ;     designating single skipped staves.

    (if (list? magic-list)
        (let* ((total-delimiter (assq-ref easy-delimiter-alist (car
magic-list)))
               (actual-total-delimiter (if (eq? total-delimiter #f)
'SystemStartBracket total-delimiter))
               (sub-delimiter-magic-list (if (eq? total-delimiter #f)
magic-list (cdr magic-list))))
          (cons actual-total-delimiter
            (apply append (map (lambda (entry)
                                 (if (pair? entry)
                                     (let ((delim (assq-ref
easy-delimiter-alist (car entry))))
                                       (if (eq? delim #f)
                                           (make-n-copies 'some-staff
(cdr entry))
                                           (list (cons delim
(make-n-copies 'void (cdr entry))))))
                                     '(void)))
                            sub-delimiter-magic-list))))
        (list (assq-ref easy-delimiter-alist magic-list))))


setDelimiters =
#(define-music-function (magic-list) (symbol-or-list?)
    #{
      \set StaffGroup.systemStartDelimiterHierarchy =
#(make-delimiter-hierarchy magic-list)
    #})

\new StaffGroup \with {
   \setDelimiters #'barlineOnly
   % ALSO TRY THE FOLLOWING:
   % \setDelimiters #'(barlineOnly)
   % \setDelimiters #'(barlineOnly skip (brace . 2))
   % \setDelimiters #'(skip (brace . 2))
   % \setDelimiters #'(bracket skip (brace . 2))
   % \setDelimiters #'(skip (brace . 2) (skip . 2) (brace . 2))

   % Single-staff braces/brackets are not supported at the moment.

} <<
   \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 }
 >>


Best
Lukas

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Aaron Hill
On 2018-10-12 9:12 am, Lukas-Fabian Moser wrote:
>   \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 }

Are we getting into sub-harmonics with the last one?  ;-)

-- Aaron Hill

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

foxfanfare
In reply to this post by Lukas-Fabian Moser
Lukas-Fabian Moser wrote
> Hi,
>
>> The StartDelimiterHierarchy gives the possibility to change the first
>> bracket by anything you want, for instance:
> [...]
>> It would be interesting if your function can manage also that!
> I guess this is what happens when you start coding before agreeing on a
> desirable user interface ;-).

Awesome! Thank you very much Lukas for this handy solution. I wonder why you
have added two occurences for the barline (barlineOnly & barline)  ?

I also don't know how something like this could be pushed in the snippets
directory. At the risk of repeating myself, LP default tools and behaviour
doesn't follow the standard engraving rules for an orchestral layout. I
think this should be somehow referenced or that Lukas solution might be
pointed out.



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

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
Reply | Threaded
Open this post in threaded view
|

Re: GrandStaff vertical distance

Lukas-Fabian Moser
Hi,
> Awesome! Thank you very much Lukas for this handy solution. I wonder why you
> have added two occurences for the barline (barlineOnly & barline)  ?
I thought it might be convenient: Since brace, bracket and square
_imply_ that a barline is printed, it seemed more logical to me if you
can write barlineOnly if you want just that, _only_ a barline. But since
standard LP offers the alternatives "brace, bracket, square, barline",
it seemed stupid not to support this as well.

> I also don't know how something like this could be pushed in the snippets
> directory. At the risk of repeating myself, LP default tools and behaviour
> doesn't follow the standard engraving rules for an orchestral layout. I
> think this should be somehow referenced or that Lukas solution might be
> pointed out.
I disagree that LP does not follow the standard engraving rules. It just
seems to me that \new GrandStaff etc. imply a certain semantics which is
perfectly alright for, e.g., an orchestral Piano part, but just does not
apply for the braces connecting Violin 1 and 2. - I do not own Gould's
book, but I would expect that this is discussed there.

But I'll try and see what I can find out about registering snippets (but
then I should polish the code a bit more).

Best
Lukas

_______________________________________________
lilypond-user mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/lilypond-user
12