lilypond-devel
[Top][All Lists]

Re: enharmonic problem with \transpose - should we modify it?

 From: Felipe Gonçalves Assis Subject: Re: enharmonic problem with \transpose - should we modify it? Date: Tue, 21 Jun 2011 16:25:03 -0300

```Hi,

>
> with an algebraic pitch representation the test and adjustment would
> look like as follows:
> two pitches are enharmonic iff their interval is in the subspace spanned
> by the enharmonic interval (default: diminished second) and the scale
> period (default: pure octave).  to make it a bit more difficult, the
> scale period coefficient must be integer, while the enharmonic interval
> coefficient may be rational.  the scale period coefficient also gives the
>

Enharmonicity is just an equivalence relation respecting the abelian
group structure of intervals/transpositions. You can represent it by a
quotient map or by its kernel.

Your approach is representing the kernel, via its generators. This
is complicated.

A much simpler idea is to represent the quotient map, which is a
particularly simple kind of function.

I am attaching a modified version of your code which expresses the
idea. I believe that the code can get even cleaner, but I am leaving
that work to you (or someone else), since I have a very low fluency
in Lisp.

Explaining the code:
{enharmonic-class} corresponds to the quotient map. {et12-class}
and {et31-class} are examples. The important thing is that these
procedures return the same value for enharmonic equivalent pitches
modulo octave.

{enharmonic-octaves} is used in the octave adjustment. It is supposed
to receive a pitch which is enharmonic to an integer number of octaves,
and return that number.

Note how {enharmonic} became trivial. This means that
{enharmonic-from} reduces to a dictionary look-up. I leave to someone
else to reimplement this in the best possible way.

Hope it helps.