lilypond-user
[Top][All Lists]
Advanced

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

Re: missing glissando features (bugs?)


From: Neil Puttock
Subject: Re: missing glissando features (bugs?)
Date: Fri, 15 May 2009 21:39:52 +0100

2009/5/15 Marc Hohl <address@hidden>:

> I still don't get it - when I use extra-dy = 0, I get glissando lines
> parallel to the staff lines,
> so a value of zero can't be right. I have attached the pdf output, the
> upmost tab lie is the
> standard behaviour, the middle line is extra-dy = 0, and the lowest line is
> the one with my
> calculated value for extra-dy.

Hmm, I don't seem to be doing a very good job of explaining it. :)

> As I can see, a value of 0 is definitely wrong here, so it seems that a
> normal score and a tab score
> handle extra-dy differently.

Exactly: as I mentioned earlier in the thread, in engraver-init.ly
there's a setting for 'extra-dy in the context definition for
TabVoice, whereas there's no setting for normal glissandos.  If you
have a look at line-spanner.cc you'll find the code which reads
'extra-dy: it uses robust_scm2double () to ensure a sane value is
returned (0 in this case) if the property isn't set.

To recap, the current behaviour for glissandos is as follows:

1. If a glissando is in a Voice context other than TabVoice, 'extra-dy
= #0 unless overridden by the user.

2. In a TabVoice, 'extra-dy = #0.75 for all glissandos, even if
they're between notes at different staff-positions.

For a TabVoice glissando, we want 'extra-dy to be 0.75/-0.75 for notes
at the same staff-position, depending on the change in pitch;
otherwise 'extra-dy should be 0, since we don't need to add any extra
slope to glissandos between notes at different staff-positions (or do
we... see below ;)

>     (if (and (= left-staff-position right-staff-position)
>              (< (ly:pitch-semitones right-pitch) (ly:pitch-semitones
> left-pitch)))
>         -0.75
>          0.75  )))

This code can't distinguish between (equal staff-positions &
right-pitch > left-pitch) and (different staff-positions), so will
return 0.75 for both situations.

Here's a version of the callback which will only apply 'extra-dy if
the staff-positions are equal:

#(define (glissando::calc-tab-extra-dy grob)
   (let* ((original (ly:grob-original grob))
          (left-bound (ly:spanner-bound original LEFT))
          (right-bound (ly:spanner-bound original RIGHT))
          (left-pitch (ly:event-property (event-cause left-bound) 'pitch))
          (right-pitch (ly:event-property (event-cause right-bound) 'pitch))
          (left-staff-position (ly:grob-property left-bound 'staff-position))
          (right-staff-position (ly:grob-property right-bound 'staff-position))
          (extra-dy (if (= left-staff-position right-staff-position)
                        (if (< (ly:pitch-semitones right-pitch) 
(ly:pitch-semitones left-pitch))
                            -0.75
                            0.75)

                        ;; not on same staff-position -> no extra-dy
                        0)))
     extra-dy))

Of course, you might prefer to apply 'extra-dy in all cases, since the
above places the glissando start and end points on staff-lines (see
attached image). :)

Regards,
Neil

Attachment: tabgliss.ly
Description: Text document

Attachment: tabgliss.pdf
Description: Adobe PDF document


reply via email to

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