[gsharp-devel] ties

Christophe Rhodes csr21 at cam.ac.uk
Fri Mar 26 08:52:13 UTC 2004


Robert STRANDH <strandh at labri.fr> writes:

> As you may have noticed, I am working on functionality for drawing
> pretty ties to be used with your latest stuff.  

Yes, I saw... one day I shall learn to speak MetaFont.  It looks cool,
though.

> Here is the plan (let me know what you think) :

[some snippage]

>   * write a function draw-tie (or something like that) or perhaps a
>     pair of functions draw-tie-up draw-tie-down, which would take a
>     staff step and two x positions corresponding to notehead centers.
>
>   * the function will check the distance between the centers of the
>     noteheads in terms of multiples of the staff line distance.  If
>     that distance is sufficiently small (say less than 4.5 times the
>     staff line distance) a SMALL tie is used.  Such a tie is
>     characterized by the fact that it is entirely contained between
>     two staff lines.  The smallest small tie that I added to the font
>     is roughly 2/3 the staff line distance, so if the center of the
>     noteheads are closer than 2.2 staff line distances, they will
>     overlap with the tie (but 2.2 is pretty tight).  When the distance
>     is greater than 4.5 (or perhaps even less), the small tie is no
>     longer pretty, so a LARGE tie should be used.
>
>   * the LARGE tie (not yet added) traverses one staff line.  I am
>     planning to make two different shapes of large ties, one to be
>     used for noteheads ON a staff line, and another for noteheads
>     BETWEEN two staff lines (because they do not end in the same y
>     position).  The draw-tie function(s) must then use a different
>     glyph for the two possible y-positions of the noteheads. There
>     will be a bunch of large ties to be used from distances of around
>     3 or so, to perhaps 9 or 10.
>
>   * when the distance is even larger than 9 or 10, we must draw two
>     glyphs representing the beginning and the end of the ties, and a
>     rectangle for the middle.  I have made all the glyphs so that the
>     center falls on exact pixel boundaries which means that the center
>     can be invisibly extended by an ordinary black rectangle.

All of this sounds sensible.  I need to look at an example, I fear,
but here are two immediate edge cases:

  * trivially: all of this works only when the two notes in question
    are on the same line of the score; however, it will happen that
    the last note on one line is tied to a note on the next.  What I
    think happens here is that the first note gets a tie more-or-less
    to the barline, and the second a (very small) tie from after the
    key-signature.  My guess is that traditionally this second tie
    doesn't affect the spacing calculations, but I don't see any firm
    aesthetic reason why it shouldn't.

  * more controversially: consider a sequence such that there are
    several ties in a row, but one of them is a small tie.  I suspect
    that it would be more aesthetically pleasing to have all of the
    extenders of the ties line up horizontally... but maybe this just
    isn't possible.

These are just minor niggles; the basic plan sounds good.

> Currently I am working on the glyphs.  I may or may not have time to
> write the draw-tie function any time soon, so if anyone else wants to
> work on that, let me know.  It would be cute to get your example to
> draw with the new glyphs.  

It would indeed.  I also need to refactor and fix what we currently
have, ideally so that tie manipulation and note manipulation become as
transparent as possible (with fewer nasty interactions between the
two).  Sadly, this weekend is booked up, but I can try to work on some
code next week.

Cheers,

Christophe
-- 
http://www-jcsu.jesus.cam.ac.uk/~csr21/       +44 1223 510 299/+44 7729 383 757
(set-pprint-dispatch 'number (lambda (s o) (declare (special b)) (format s b)))
(defvar b "~&Just another Lisp hacker~%")    (pprint #36rJesusCollegeCambridge)




More information about the gsharp-devel mailing list