[gsharp-devel] ties

Robert STRANDH strandh at labri.fr
Tue Mar 23 05:46:28 UTC 2004


Christophe Rhodes writes:

 > Attached is a partial implementation of ties.  As seems to be usual,
 > it comes with a bundle of various FIXMEs and caveats.

Wow, lot of work!  I'll try it as soon as I can. 

 > The major problem I had here is with the read-only nature of notes.
 > Why is this?  Is it to ensure that there are always new objects for
 > the GUI layer?  

I don't think there is a terribly profound reason for this.  

 > In any case, it makes the work quite tricky, as each
 > tie contains two temporally separated notes.  I've implemented ties
 > here as properties of notes themselves, rather than a more global
 > approach, for constant-time performance reasons; 

I suspect that is the right thing to do. 

 > however, given that
 > ties contain notes themselves, each destructive operation on a score
 > (e.g. adding or removing an accidental) will have to update or destroy
 > all ties with which the original note was associated.  

Yes, I see. 

 > At present, I
 > have done this with the toggle tie command itself, but it needs to be
 > factored out so that com-up, com-down, com-sharper et al. can use it.
 > (Unless someone can think of a better representation).

A simpler solution would be to do what the beaming commands do.  For
ties, each note would indicate whether it ties to the right and/or
left.  I tie would be drawn only if the left note of a pair is tied to
the right and the right note of the same pair is tied to the left.  It
would then be up to the user to add and remove individual ties.  

 > Caveat the second is that my drawing skills are not very good.  The
 > output can be seen at
 > <http://www-jcsu.jesus.cam.ac.uk/~csr21/ties.png> (the opening few
 > bars of the top part in Janequin's _Les Cris de Paris_, if anyone's
 > interested :-) and it's ugly.  The ties, I think, need to be thicker
 > in the middle (particularly when it's clashing with a staff-line, as
 > in the Gs), thinner at the ends, and anti-aliased; oh, and posssibly a
 > curve, rather than two straight lines.

Certainly, some anti-aliasing would not hurt.  I am not sure how to do
that, though.  I wonder whether it would be possible to have some
fixed-size ends and a variable-sized middle part.  I'll give some
thought to drawing ties. 

 > I haven't tested loading or saving, but I have implemented a
 > print-object method and read macro, so maybe it works.  MIDI
 > performance of ties works, at least for logically consistent ties.  No
 > sanity checking is currently done -- ties can be made over logically
 > non-adjacent notes -- so MIDI performance of this pathological case
 > may or may not be optimal.  Apart from all this, it's perfect.  

 > Oh yes, one last thing: the semibreve (whole note) rest appears to
 > hang down from the wrong line by default; the normal position for that
 > rest is to hang from the second line from the top of the staff.

Funny!  Ross says it hangs beneath the third staff line (which is also
what I remember from 5th grade), but then in all his examples it is
places as you say.  

Robert Strandh

Greenspun's Tenth Rule of Programming: any sufficiently complicated C
or Fortran program contains an ad hoc informally-specified bug-ridden
slow implementation of half of Common Lisp.

More information about the gsharp-devel mailing list