2009/5/15 Marc Hohl <[email protected]>: > 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
\version "2.12.2"
\paper {
indent = 0
ragged-right = ##f
}
#(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)))
(if (and (= left-staff-position right-staff-position)
(< (ly:pitch-semitones right-pitch) (ly:pitch-semitones
left-pitch)))
-0.75
0.75)))
#(define (extra-dy-test-a 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)))
(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)))
#(define (extra-dy-test-b 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)))
;; apply extra-dy for all glissandos
(if
(< (ly:pitch-semitones right-pitch) (ly:pitch-semitones left-pitch))
-0.75
0.75)))
tabs = \relative c {
\set TabStaff.minimumFret = #2
c'4 \glissando d \glissando e, \glissando f
\bar "|."
}
\score {
<<
\new TabStaff {
\clef "tab"
\override Glissando #'extra-dy = #glissando::calc-tab-extra-dy
\tabs
}
\new TabStaff {
\clef "tab"
\override Glissando #'extra-dy = #extra-dy-test-a
\tabs
}
\new TabStaff {
\clef "tab"
\override Glissando #'extra-dy = #extra-dy-test-b
\tabs
}
>>
}
tabgliss.pdf
Description: Adobe PDF document
_______________________________________________ lilypond-user mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-user
