hp.ly and slurs on Staff

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

hp.ly and slurs on Staff

Federico Bruni
I have a question about the behaviour of hp.ly

I'm very satisfied with the way slurs are drawn in TabStaff. In fact,
as far as I can see, hammeron/pulloff in VoiceOne have the slur over
the numbers while in VoiceTwo are under. And that's exactly what I want.

But the slurs in Staff don't look nice, in particular VoiceOne.
Slurs connect stems instead of heads, so they don't look good (see
attached file).

In all the manuals I've checked slurs connect always note heads (not
stems).
There's a way to fix it?

Cheers,
Federico

--
Federico Bruni  |  http://www.gnurag.net/blog/

LibrePlanet Italia
http://groups.fsf.org/wiki/LibrePlanetItalia


\version "2.13.5"

#(set-global-staff-size 22.45)

% hp.ly
#(define-public (slur::draw-tab-slur grob)
  (let* ((staff-symbol (ly:grob-object grob 'staff-symbol))
         (staff-space (ly:grob-property staff-symbol 'staff-space))
         (control-points (ly:grob-property grob 'control-points))
         (new-control-points (map (lambda (p)
                                          (cons (car p) (- (cdr p)
                                                        (* staff-space
                                                           (ly:grob-property grob 'direction)
                                                           0.35))))
                                  control-points)))
        (ly:grob-set-property! grob 'control-points new-control-points)
        (ly:slur::print grob)))


\paper {
  indent= #0
  line-width= #180
}

upper=  \relative c' {
  \time 4/4
  \key e \major
  \set Staff.midiInstrument = #"acoustic guitar (steel)"
  \set fingeringOrientations = #'(left)
 
  \partial 4. <cis-1>8  e4
  < cis-1 g'-3 >2 s8 \grace a16 ( \glissando b8\3 )  d ( b ) |
  e\2 ( d b ) \grace ais16 ( \glissando  a8  g ) s4. |
  s4.  < d'\3 g\2 >8  < gis,\4  d'\3 fis\2 >2\arpeggio |
 
}

lower=  \relative c {
  \set fingeringOrientations = #'(left)
 
  \partial 4. s4. |
  s4  e,4  s2 |
  s2 s8 e'4. ~ |
  e8  b8 ( \glissando e4\5 )  e,2 |
}

\score {
  \new StaffGroup <<
    \new Staff = "guitar" <<
      \context Voice = "upper guitar" { \clef "G_8" \voiceOne  \upper }
      \context Voice = "lower guitar" { \clef "G_8" \voiceTwo  \lower }
    >>
    \new TabStaff = "tab" <<
      \context TabVoice = "upper tab" { \clef "moderntab" \voiceOne \upper }
      \context TabVoice = "lower tab" { \clef "moderntab" \voiceTwo \lower }
    >>
  >>
 
 \midi {
    \context {
      \Score tempoWholesPerMinute = #(ly:make-moment 120 4)
    }
  }
 
 \layout {
    \context {
    \Staff
    \override StringNumber #'transparent = ##t
    }
   
    \context {
    \TabStaff
    \revert Arpeggio #'stencil
    }
   
    \context {
    \TabVoice
    \override Stem #'length = #0
    \override Stem #'no-stem-extend = ##t
    \override Stem #'flag-style = #'no-flag
    \override Stem #'details = #'((lengths 0 0 0 0 0 0)
                                  (beamed-lengths 0 0 0)
                                  (beamed-minimum-free-lengths 0 0 0)
                                  (beamed-extreme-minimum-free-lengths 0 0)
                                  (stem-shorten 0 0))
    autoBeaming = ##f
    \override NoteColumn #'ignore-collision = ##t
    \override Slur #'stencil = #slur::draw-tab-slur
    }
  }

}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hp.ly and slurs on Staff

Marc Hohl
Federico Bruni schrieb:
> I have a question about the behaviour of hp.ly
>
> I'm very satisfied with the way slurs are drawn in TabStaff. In fact,
> as far as I can see, hammeron/pulloff in VoiceOne have the slur over
> the numbers while in VoiceTwo are under. And that's exactly what I want.
>
> But the slurs in Staff don't look nice, in particular VoiceOne.
> Slurs connect stems instead of heads, so they don't look good (see
> attached file).
I am not very familiar about the rules for slurs, so lilypond has surely
some reasons to behave like this.
When slurs and stems point in the same direction, this would look not
very pleasant, I think, so
the slurs are moved over the stems.
>
> In all the manuals I've checked slurs connect always note heads (not
> stems).
> There's a way to fix it?
You can insert \slurDown *after* \voiceOne in the normal staff, then
everything will be fine.

Marc
>
> Cheers,
> Federico
>



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: hp.ly and slurs on Staff

Federico Bruni
Marc Hohl wrote:

> Federico Bruni schrieb:
>> I have a question about the behaviour of hp.ly
>>
>> I'm very satisfied with the way slurs are drawn in TabStaff. In fact,
>> as far as I can see, hammeron/pulloff in VoiceOne have the slur over
>> the numbers while in VoiceTwo are under. And that's exactly what I want.
>>
>> But the slurs in Staff don't look nice, in particular VoiceOne.
>> Slurs connect stems instead of heads, so they don't look good (see
>> attached file).
> I am not very familiar about the rules for slurs, so lilypond has surely
> some reasons to behave like this.
I've made some tests and I guess the good reason is polyphonic music.

If you enter monophonic music, LilyPond will use stemDown-slurUp for
higher notes and stemUp-slurDown for lower notes.
This looks beautiful, because the slurs connect the heads in all of
these cases.

The problem comes with polyphonic music.
In this case, stem direction must change to avoid collisions.
So stemDown for voiceTwo, stemUp for voiceOne. This is perfect.

What about slurs?
slurUp for voiceOne, slurDown for voiceTwo

I like this in TabStaff, but I don't like in Staff *usually*.
The default behaviour in Staff is necessary when I have slurs
happening at the same time in the two voices.

So, if I don't have such a thing, I can put this in \score safely:
voiceOne \slurDown \upper
voiceTwo \slurUp \lower

[sorry for the confused explanation, read below and see attached images]

> When slurs and stems point in the same direction, this would look not
> very pleasant, I think, so
> the slurs are moved over the stems.

Mmmmh...
The attached images explain better what I'm trying to achieve:

normal.png is the default behaviour
slurdown.png is what I'd like generally (but you can see the problem
of multiple slurs on two voices in the last bar of Staff.. in this
case I should use other settings, I think I know which ones)


>>
>> In all the manuals I've checked slurs connect always note heads (not
>> stems).
>> There's a way to fix it?
> You can insert \slurDown *after* \voiceOne in the normal staff, then
> everything will be fine.
>

thanks, this works perfect
I should have remembered it... :-)

--
Federico Bruni  |  http://www.gnurag.net/blog/

LibrePlanet Italia
http://groups.fsf.org/wiki/LibrePlanetItalia


normal.png (28K) Download Attachment
slurdown.png (31K) Download Attachment
Loading...