Re: Distance between staffs

2021-07-22 Thread Aaron Hill

On 2021-07-22 7:12 am, Silvain Dupertuis wrote:

Hello,
I found a nice way to do it, using Lilypond 20, by specifying
staff-staff-spacing.padding with a negative value

\new PianoStaff \with {
  % midiInstrument = "tenor sax"
  \override StaffGrouper.staff-staff-spacing = #'(
(basic-distance . 0)
(padding . 0)) % s0 for first exemple ;
second example : (padding . -3.09)
}

The result was this

 with padding=0
 with the negative adjustment (padding = -3.06)

Unfortunately, this adjustment no longer works in LilyPond 22
It looks like the property was broken, or no longer function this way?
Whatever the value, the distance is not affected.


Negative padding still works, but you failed to set minimum-distance.  
Seems there was a change of behavior around the assumed defaults.


That said, you should be relying solely on 
basic-distance/minimum-distance to separate the staves properly.  You 
then just need a suitably large negative padding to handle the 
overlapping ink.  Negative infinity should be large enough for most 
situations:



\version "2.22.0"

\new PianoStaff
\with {
  \override StaffGrouper.staff-staff-spacing =
  #'((basic-distance . 6) (minimum-distance . 6)
 (padding . -inf.0) (stretchability . 0))
}
<< \new Staff { g,4 g g' g'' | s1 }
   \new Staff { \clef "bass" s1 | g,4 g g' g'' } >>



-- Aaron Hill

Re: Distance between staffs

2021-07-22 Thread Thomas Morley
Am Do., 22. Juli 2021 um 16:13 Uhr schrieb Silvain Dupertuis <
silvain-dupert...@bluewin.ch>:

> Hello,
>
> I made a chord version of the first Praeludium of the *Wohltemperierte
> Klavier*
> (in which the chords were programmaticall reconstructed from the liste of
> notes)
>
> As the chords extend on 2 and a half octaves,
> I wanted to get them on a normal piano staff
> and adjust the distance of staffs so that the would be like one staff with
> one space for an A3 note.
>
> Then the chords can be placed on the upper staff with notes automatically
> appearing at they right place on the lower staff.
>
> I found a nice way to do it, using Lilypond 20, by specifying
> *staff-staff-spacing.padding* with a negative value
>
> \new PianoStaff \with {
>
>   % midiInstrument = "tenor sax"
>
>   \override StaffGrouper.staff-staff-spacing = #'(
>
> (basic-distance . 0)  
>
> (padding . 0)) % s0 for first exemple ; second 
> example : (padding . -3.09)
>
> }
>
> The result was this
>
> with padding=0
> with the negative adjustment (padding = -3.06)
>
> Unfortunately, this adjustment no longer works in LilyPond 22
> It looks like the property was broken, or no longer function this way?
> Whatever the value, the distance is not affected.
>
> You can see the complete LilyPond and PDF files in this NextCloud folder
> 
>
> Thank you in advance if you can sort this problem out.
>
> Sincerely
>
> Silvain
>
>
> --
> Silvain Dupertuis
> Route de Lausanne 335
> 1293 Bellevue (Switzerland)
> tél. +41-(0)22-774.20.67
> portable +41-(0)79-604.87.52
> web: silvain-dupertuis.org 
>

Hi,

for the distance, I'd fo for alignment-distances of
NonMusicalPaperColumn.line-break-system-details.
I added some *experimental* code for autosplitting chords.

#(define (make-autosplit-chord chord . ref-pitch)
  "Return a pair of lists, containing the pitches of @var{chord}, splitted
at
a reference pitch.  The reference pitch is derived from @var{ref-pitch}.
If @var{ref-pitch} is empty, @code{c'} is regarded as reference.
  "
  (define ref-pitch-steps
(if (and (pair? ref-pitch) (car ref-pitch))
(ly:pitch-steps (car ref-pitch))
0))

  (call-with-values
(lambda ()
  (partition
(lambda (note)
  (> (ly:pitch-steps (ly:music-property note 'pitch))
 ref-pitch-steps))
(event-chord-notes chord)))
cons))

autoSplitChord =
#(define-music-function (stem-dir staff-names pitch chord)
  ((ly:dir? 0) (pair? '("up" . "down")) (ly:pitch?) ly:music?)
  (_i "Split @var{chord} at optional @var{pitch}.  The default of
@var{pitch} is
@code{#f}, which is interpreted by the called procedure
@code{make-autosplit-chord} as @code{c'}.

The splitted chords are distributed to named staves, relying on optional
@var{staff-names}.

The optional @var{stem-dir}, determines the direction of the stems and
whether
the chords may be connected by a cross-staff stem.
The default results in unconnected chords.
If the @code{Span_stem_engraver} is consisted, the chords may be connected
by a
cross-staff stem.")
  (if (music-is-of-type? chord 'event-chord)
  (let* ((skip (make-duration-of-length (ly:music-length chord)))
 (devided-pitches (make-autosplit-chord chord pitch))
 (upper-chord
   (if (pair? (car devided-pitches))
   (make-event-chord (car devided-pitches))
   (make-skip-music skip)))
 (lower-chord
   (if (pair? (cdr devided-pitches))
   (make-event-chord (cdr devided-pitches))
   (make-skip-music skip
#{
  <<
\context Staff = #(car staff-names)
  \context Voice {
$(if (negative? stem-dir)
  #{
 \once \override Stem.cross-staff = #cross-staff-connect
 \once \override Flag.style = #'no-flag
 <>\noBeam
  #})
$(if (not (zero? stem-dir))
  #{ \once \override Stem.direction = #stem-dir #})
#upper-chord
  }

\context Staff = #(cdr staff-names)
  \context Voice {
$(if (positive? stem-dir)
  #{
 \once \override Stem.cross-staff = #cross-staff-connect
 \once \override Flag.style = #'no-flag
 <>\noBeam
  #})
$(if (not (zero? stem-dir))
  #{ \once \override Stem.direction = #stem-dir #})
#lower-chord
  }
  >>
#})
  #{ \context Staff $chord #}))

autoSplitChordsInMusic =
#(define-music-function (mus) (ly:music?)
  (map-some-music
(lambda (m)
  (and (music-is-of-type? m 

Re: Distance between staffs

2021-07-22 Thread Lukas-Fabian Moser

Hi Silvain,

Am 22.07.21 um 16:12 schrieb Silvain Dupertuis:


I made a chord version of the first Praeludium of the /Wohltemperierte 
Klavier/
(in which the chords were programmaticall reconstructed from the liste 
of notes)_

_

As the chords extend on 2 and a half octaves,
I wanted to get them on a normal piano staff
and adjust the distance of staffs so that the would be like one staff 
with one space for an A3 note.


I'm not sure if I understand you correctly - shouldn't the space between 
bass and treble staff be a c' note?


Anyway: I had the idea of "faking" a piano staff by actually creating 
only one staff that has 10 lines and manually duplicating clefs etc. (Of 
course, this might imply followup problems in case you want to switch 
clefs in one staff etc.)


Proof of concept:

\version "2.22.1"

rightHand = \relative {
  r8 g'16 c e g, c e
}

leftHand = \relative {
  c'16 e r8 r4
}

\new Staff {
  \override Staff.StaffSymbol.line-positions =
  #(append (iota 5 -4 2) (iota 5 -16 2))
  \override Staff.Clef.stencil = #ly:text-interface::print
  \override Staff.Clef.text =
  \markup \combine
  \musicglyph "clefs.G"
  \raise #-4 \musicglyph "clefs.F"
  \override Staff.TimeSignature.stencil =
  #(grob-transformer
    'stencil
    (lambda (grob default)
  (ly:stencil-add
   default
   (ly:stencil-translate-axis default -6 Y
  <<
    {
  \override Rest.Y-offset = 0
  \rightHand
    }
    \\
    {
  \override Rest.Y-offset = -6
  \leftHand
    }
  >>

}

Of course, one might make everything more natural by letting the 
"hidden" c' line be at position 0 (so we would have to adjust 
Staff.middleCposition etc.)


Lukas




Distance between staffs

2021-07-22 Thread Silvain Dupertuis

Hello,

I made a chord version of the first Praeludium of the /Wohltemperierte Klavier/
(in which the chords were programmaticall reconstructed from the liste of 
notes)_
_

As the chords extend on 2 and a half octaves,
I wanted to get them on a normal piano staff
and adjust the distance of staffs so that the would be like one staff with one space for 
an A3 note.


Then the chords can be placed on the upper staff with notes automatically appearing at 
they right place on the lower staff.


I found a nice way to do it, using Lilypond 20, by specifying 
*staff-staff-spacing.padding* with a negative value


    \new PianoStaff \with {

  % midiInstrument = "tenor sax"

  \override StaffGrouper.staff-staff-spacing = #'(

    (basic-distance . 0)

    (padding . 0)) % s0 for first exemple ; second example : 
(padding . -3.09)


    }

The result was this

with padding=0
with the negative adjustment (padding = -3.06)


Unfortunately, this adjustment no longer works in LilyPond 22
It looks like the property was broken, or no longer function this way?
Whatever the value, the distance is not affected.

You can see the complete LilyPond and PDF files in this NextCloud folder 



Thank you in advance if you can sort this problem out.

Sincerely

Silvain


//

--
Silvain Dupertuis
Route de Lausanne 335
1293 Bellevue (Switzerland)
tél. +41-(0)22-774.20.67
portable +41-(0)79-604.87.52
web: silvain-dupertuis.org