Thanks a lot Victor,
I'm working with your method 2. Really nice, to be included in docs.
I was thinking. Premise: I know nothing of lily's internals and about
scheme.
But:
As all the trick is to exactly calculate the offset of the noteheads,
wouldn't be possible to add such a calculation as a a sort of macro
so to implement \startgliss \stopgliss?
Best
-a-
On 31 Mar 2007, at 00:11, Trevor Bača wrote:
On 3/30/07, v!ctor [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello Trevor, Andrea, all,
Back when I suggested the inclusion of this feature in Lilypond
Han-Wen gave
me a brief explanation of why this was complicated to implement.
Didn't
fully understand, but in general this seems to require a major
rewrite of
the way glissandi (and probably line spanners in general) operate,
which is
not trivial and would be expensive.
Since then I've found that this feature is not really necessary
if you are
willing to do some Lilypond bending. First of all, what's wrong with
Lilypond's glissandi? Why add this as a new feature?
Lilypond's requires you to beak a long glissando into short ones,
which is
not a problem per se. The problem is that, since notes fall on a
quantized
grid of lines and spaces, the long glissando line looks crooked or
jagged.
No mortal sin, but it's *very* annoying. See attached figure
bad_gliss.png
There are 2 ways of doing straight lined glissandi.
Method 1 involves using two voices. It looks great on page, but if
you do it
this way you will find unpleasant Lilypond behavior, in addition
to constant
warnings (no harm) of clashing note columns. One of the main
problems is
that using this method you are bound to have long glissandi that
extend
beyond the system and Lilypond (at least till version 2.9.x)
didn't know how
to handle these automatically). So you are forced to break the
glissando at
least at system breaks anyway.
The second method I've found to be much more elegant. It uses
less code and
stick to the current Lilypond assumption of always connecting
contiguous
notes. In addition, the stem always ends exactly at the glissando
line. Its
only drawback is that you need to do some calculation of where
exactly in
the Y axis the inner headless notes should fall. To do this you
simply
interpolate between the extreme notes of the glissando and find
the correct
Y values for the inner notes, then change NoteHead #'Y-offset for
these
inner notes. Remember that this Y-offset is relative to the center
line of
the staff, so you need to add or subtract the distance between the
innermost
note and the staff's center line from your calculation. Of course
you also
have to hide the heads.
See attachment good_gliss.png for example of both methods.
Here's the code for the two methods:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\version "2.11.20"
\layout{
ragged-last = ##t
\context{\Score
\override Glissando #'bound-details #'right #'padding
= #0.0
\override Glissando #'bound-details #'left #'padding
= #0.0
}
}
%
---------------------------------------------------------------------
--------
% normal Lilypond glissando
\new Staff="staff0"{
\new Voice="one"{
c'8[\glissando
\once \override Voice.NoteHead #'transparent =##t
f'8\glissando a'8]
}
}
%
---------------------------------------------------------------------
--------
% method 1: use two voices. one for note heads and durations, the
other for
glissando line.
% with this method you will get -- waring: ignoring too many
clashing note
columns.
\new Staff="staff1"{
<<
\new Voice="one"{
c'8[
\once \override Voice.NoteHead #'transparent =##t
f'8 a'8]
}
\new Voice="two"{
%\override Voice.Beam #'transparent =##t
\override Voice.Stem #'transparent =##t
\override Voice.Dots #'transparent =##t
\override Voice.NoteHead #'transparent =##t
%\override LedgerLineSpanner #'transparent = ##t
c'8*2[\glissando a'8]
}
>>
}
%
---------------------------------------------------------------------
--------
% method 2: use only one voice. simply hide the head of the inner
note(s)
and shift Y position to the exact place.
% a) Distance form c' to a' in staff lines is a'-c' = 2.5.
% b) Since f' is exactly between c' and a', f' = 2.5/2 = 1.25
above c'.
% c) Since a' is 0.5 lines away from the staff's center line, f'
should be
Y-offset by 1.25+0.5 down. i.e. -1.75
% This gives exact placement of f'.
\new Staff="staff2"{
\new Voice="one"{
c'8[\glissando
\once \override Voice.NoteHead #'transparent =##t
\once \override Voice.NoteHead #'Y-offset =#-1.75
f'8\glissando a'8]
}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Hi Víctor,
You can get rid of the clashing note column warnings with ...
\override NoteColumn #'ignore-collision = ##t
... which exists specifically to allow us to use complex "layered"
notations in multiple voices this way.
Very neat examples!
--
Trevor Bača
[EMAIL PROTECTED]
--------------------------------------------------
Andrea Valle
--------------------------------------------------
CIRMA - DAMS
Università degli Studi di Torino
--> http://www.cirma.unito.it/andrea/
--> [EMAIL PROTECTED]
--------------------------------------------------
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user