[tablatures] Re: bends: pre-implementation issues

[ Thread Index | Date Index | More lilynet.net/tablatures Archives ]


Han-Wen Nienhuys schrieb:
On Mon, Jan 4, 2010 at 10:38 AM, Marc Hohl <marc@xxxxxxxxxx> wrote:
[...]

As bends are musically and technically some sort of slurs, I think the
best way to implement them is mainly to copy the slur engraver code and to
adapt it properly. Internally, slurs cannot be created via

slur = (make-music 'SlurEvent)

so with bends, I have to add the commands to the parser. Is this correct?

Initially, you can define the appropriate events in
define-music-types.scm, and use an identifier to access them; see

  ly/declarations-init.ly

for examples on how to instantiate them.
Ok, thanks for the hint!
You should focus on building the backend formatting before worrying
about the syntax.  It is ok to launch the feature with an experimental
syntax for one release or so, so don't worry about getting the syntax
right, as experimenting with syntax is the easy part.

You are worrying about the engravers, but in reality engravers are
simple classes which just connect grobs together, and the real
difficulty is in writing the formatting code that manipulates the
grobs.
To be honest: I do not worry about the engravers alone, I am
frighened by the whole task, but I need bends, so ...
Do not use the slur code for creating the bends.  Slurs have many
graphic peculiarities, and you will spend needless energy in switching
off the slur behavior.  The real question you need to resolve first is
item vs. spanner, i.e. if you have  a bend like this:

 <<
      { c4\bend d4\release }

      { f8 g8  a8 b8 }
 >>

will the bend traverse the 8th note to reach up to the following 4th
note (the D)?  Or is its shape more or less fixed?
Sorry for not having an example attached. As I said, bends are
just a special case for slurs, and I defined a scheme function which uses
the control points for the bezier curve (let's call them z1, z2, z3 and z4),
computes the point in the middle between z2 and z3 (z23) and draws a line
from z1 to z23 and from z23 to z4. The slur routine takes care of all stems,
accidentals and stuff, so it seemed natural to me to use this code as a base. Please look at the attached pdf, especially pointed slurs in the normal staves.

(At first, I tried to implement bends only with scheme, but there are problems arising when a bend is followed by a "real" slur, so I decided to do it in a cleaner way.)

By the way: what is the difference between a spanner and an item? I strongly
feel bends *must* be spanners, but honestly, I don't know the reason.

But to answer your question: there are situations where two strings are plucked
together, the lower one being bent, while the other one sounds unchanged for
the whole duration.
[...]
As said, the engravers are just for setting up grobs, and engravers
receive information in time-order, ie. when receiving the event for
the first bend, the engraver does not know about the 2nd bend.  Of
couse, you can alter the 1st bend on receiving the 2nd bend, but the
administration involved may be tricky, as it needs to work correctly
in polyphonic situations too, like the example I quoted above.
Hm. Another possibility would be to leave it to the user to draw.
consecutive bends etc. by overriding some properties. Then,
it would be cleaner to use different commands for bend and
release bend.

Thanks

Marc



Attachment: bendtest.pdf
Description: Adobe PDF document



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/