lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Benkő Pál
Subject: Re: enharmonic problem with \transpose - should we modify it?
Date: Mon, 20 Jun 2011 09:29:02 +0200

hi Janek,

> look at scm/modal-transforms.scm.  there's a scale parameter to some
> functions; those are called from ly/music-functions-init.ly from functions
> (e.g. modalTranspose) that still take scale as parameter.  there are
> examples in NR 1.1.2 Modal transformations.  the scale is a set;
> you would iterate through the music and replace each note for which
> you find an enharmonic equivalent in the scale.
>
> now as I write this, it feels easier than I thought, maybe I'll find time
> enough this weekend to do it.

well, it was nastier than I thought because of the current pitch representation,
so I haven't done it as a patch but a standalone hack; there's also a
non-standard (E31) example.

the idea is the following: enharmonizeMusic is just a LilyPond wrapper
around the scheme function enharmonize; it's a music-map to change
all occurring pitches by enharmonize-pitch; this is a wrapper around
enharmonic-from that behaves as identity for non-pitch objects.

problems begin here.  enharmonic-from searches the scale for an
enharmonic variant of pitch, and replaces pitch by the first hit, but
it has to adjust the octave (more generally a scale period should
be used but I didn't even try that with the current pitch representation).
I didn't find an easy way to handle an interval and its reverse together
(inversion of (ly:make-pitch 0 1 -1) is (ly:make-pitch -1 6 1/2)),
so there are separate code branches for the two.

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
necessary adjustment.

p

Attachment: enharmonize-test.ly
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]