Christian Mondrup wrote
> Andre Van Ryckeghem wrote:
> > but if you replace the flats by sharps and put the most left
> one to the right, it will collaps with
> > the upper one
> >
> I've been trying to pmx typeset an example on what I refer to in Gardner
> Read's book. But I experience that it is almost impossible to control the
> position of the flat at the lower g:
>
> g4f ze zdfA<.4 zcfA<.2 za zgfA>1.075 ze r2
>
> with the above given offset argument the flat do-to-speak leaps
> _far_ away
> kilometers to the left while the value decreased to 1.074 makes the flat
> almost cling to the note. Strange?

I've discovered more problem cases myself, so there are still some lurking
bugs that keep the algorithm from working as I intend.

As to whether its the right algorithm or not, I have no access to nor have I
ever even seen the Read book. I can't really point to any specific authority
for the algorithm I intend PMX to use, but I do remember a discussion on the
mailing list prior to my last major revision of accidental placement. I came
away from that with the impression that the algorithm I've tried to
implement represented the consensus of the "experts". The rule is to always
take accidentals from the top down, and to place each succeeding accidental
as far to the right as possible. Sounds simple, but it's a bitch to program,
and obviously I still don't have it quite right.  In the example I sent out,
on the last 2 quarters the flats do cascade downward and to the left. The
very last one will not quite fit in underneath (to the right) of the
cascade. But if the lowest two notes in the chord are moved one step lower,
things change; try it.

If someone can clearly state another rule, I could probably figure out a way
to implement it. But I don't even understand the comment about columns of
accidentals, let alone understand what the algorithm would be. I need either
a step-by-step rule (like the one I just explained), or a mathematical
quantity that must be minimized over all possible arrangements of the
accidentals, then I can probably program it. When I first started working on
this problem, I began with a different rule, one of the second type:
minimize the average left-shift over all possible arrangements of
accidentals. In order to do that, I took a brute strength approach. I listed
all the possible permutations of (1,2,...,naccid) and tried every one. Each
try consisted in taking the accidentals in the order specified by the
permutation being tried, and sliding each one in from the left in turn until
it banged into something. It led to some rather strange arrangements, and
then we had the hazily remembered discussion on the list, and then I went
over to the current rule.

In fact I still cycle through all the permutations, but reject any which
lead to any accidental's position being set by an accidental on a *lower*
note. Among the ones that aren't rejected, I select the one with the minimum
average shift. I'm pretty sure this leads uniquely to the arrangement that
would arise from the step-by-step rule as I described above.

--Don Simons

_______________________________________________
TeX-music mailing list
[EMAIL PROTECTED]
http://sunsite.dk/mailman/listinfo/tex-music

Reply via email to