So, first question

1. How should we represent alterations?

It is clear to me that the most general representation would be as
a list of integers of arbitrary length (see sections 1 and 2 of the
attachment).

However, a fixed length list might be more realistic. In my patch,
I opted for a pair of integers, which is enough to solve 1278.

The enhancement request mentions "many other microtonal
notations beyond arrow notation for quarter-tones". Advice from
anyone acquainted with microtonal notations is needed here.

Then we come to

1.1. How do we implement the mapping from alterations to tones?

A simple idea is to replace the list of integers by a list of rationals,
corresponding to the value of the alteration in tones. This is the
current approach, except for the fact that the list has length 1.

In this case, the alteration of cesih would be described as (-1/2 . +1/4).

One advantage is that this just extends the current version, allowing
existing code (both from the software and from users) to be supported
without modification (just make some arguments optional).

Alternatively, we can separate the Tuning System from the alteration
algebra, and realize this map as a function in the program, preferentially
configurable.

This is what I tried in my patch, using class Scale for that, which works
fine, and makes some sense, but I am completely open to suggestions here.

The advantage of this approach over the previous one is that it makes
the group structure of alterations more evident, and the operations cheaper.
On the other hand, some people might dislike the fact that the default-scale
has to be redefined in, e.g., ly/makam.ly.

I look forward to hearing from you.

Kind regards,
Felipe
General thoughts on pitch representation.


1. Some vocabulary

So, first I would like to introduce two simple concepts, the interplay
of which is of relevance to what will be discussed: that of a Physical
Pitch, and that of an Algebraic Pitch (as I name them).

A Physical Pitch is what you sing, and it is perfectly modelled by a
real number of tones, or by a frequency in Hertz.

An Algebraic Pitch is what you write. It has a name, and corresponds
to a specific symbol in the staff. Its representation is one of the
central questions here.

Transposition makes sense for both of these. (As mathematicians would
say, these are both abelian groups)

Algebraic Pitches might be realized as Physical Pitches by means of
what I will call a Tuning System.

Being LilyPond a music engraving program, it is primarily concerned
with Algebraic Pitches. Physical Pitches, however, come at play for
things like midi output and ambitus, and so some kind of Tuning System
needs to be implemented.

As things are now, I would describe class Pitch as representing an
Algebraic Pitch with an embedded Tuning System, available via the
method Pitch::tone_pitch () and its siblings. The Tuning System is
partly in class Scale and partly in the fact that an alteration is
represented by its value in tones.

I am ok with embedding the Tuning System in Pitch objects, as long as
that is not hard-coded. But I do not like to bind such algebraic
creatures as alterations to a specific value in tones.


2. The algebras of pitches

Let us analyse some musical systems, and try to come up with a good
mathematical description of Algebraic Pitches in each of them, with an
eye on transposition.

2.1 Traditional

In common music notation, we work at the level of semitones. But there
are two kinds of semitones: chromatic and diatonic. This reflects at
notation. A pitch can be perfectly described as a combination of tones
(T), chromatic semitones (C) and diatonic ones (D). Actually, any two
of these will do, since they are related by T=C+D.

I suggest we pick tones and chromatic semitones. The unaltered notes
in the diatonic staff would then be

0, T, 2T, 3T-C, 4T-C, 5T-C, 6T-C, 7T-2C, 8T-2C, ...

In general, a note in the n-th position of the staff would be
represented as

nT + f(n)C,

where f is a simple function.

Altered notes are obtained just adding a C for every sharp and
subtracting for every flat. So, a gisis' is just

(4T + f(4)C) + 2C = 4T+C.

Reciprocally, suppose we want to find the LilyPond name for pitch
5T-3C. From the coefficient of the T we get the basic note name, that
is, a'. A natural a' would be 5T-C, so we have to add an alteration of
-2C, getting aeses'.

In general, the alteration of pitch aT+bC is b-f(a).

Transposition is just addition. For example, transposition from c' to
des' (T-c) takes e' (2T) to f' (3T-c).

(Note: Hans Aberg used tones and diatonic semitones, which he called
major and minor seconds, and denoted by M and m, respectively. He
called the position of a note in the staff its degree.)

(Note: In my patch, the main purpose of class Scale is to implement
function f. It is also used to define a simple Tuning System.)


2.2 Turkish classical music

(Warning: Everything I know about this comes from the NR)

In
http://lilypond.org/doc/v2.13/Documentation/notation/turkish-classical-music
we find some explanations about a microtonal notation system. It can
be modelled in exactly the same way that we did for traditional
notation. Just reinterpreting C as half a koma, and substituting f for
the proper function (which is just 9f, by the way). The algebra is the
same, just the Tuning System is different.

This microtonal system is an example of what motivated LilyPond to
switch the representation of alterations from an integer number of
(chromatic) semitones to a rational number of tones.

The pitch representation did not need to be generalized to support
this notation. The Tuning System had to.


2.3 Quarter-tones arrow notation

This system is very similar to the traditional one, but requires one
new entity, which I will call a "chromatic" quarter-tone, and denote
by Q. Alterations now consist not only of sharps and flats, but also
of up and down arrows. For each up-arrow, you add a Q, for each
down-arrow, you subtract one.

This generalizes the former systems.


2.4 Just intonation

To make a short story shorter, in just intonation you may have an
infinite number of levels of alterations, but all the rest remains the
same. This generalizes the former systems even further.


2.5 Dodecaphonic/Chromatic

In a chromatic staff, there is no such thing as chromatic and diatonic
semitones, just semitones. The number of semitones in a pitch
corresponds to its position in the staff. Semitones here play the role
that tones play in a traditional staff.

Some times one or more levels of alterations are used for
quarter-tones, eighth-tones, etc. Function f is trivial.


2.6 Math is cool

It can actually be demonstrated that

Theorem: Every finitely generated torsion-free abelian group is free
abelian.

In simple terms:

. abelian group: "something for which transposition makes sense".
. torsion-free: "if you apply the same transposition over and over, you
                 will never come back to where you started".
. finitely generated: "There exists a finite set of elementary
                       transpositions from which you can construct all
                       the others by composition."
. free abelian: "It is just like the examples above, and is perfectly
                 modelled by a tuple of integer."

This suggests that the ultimate representation for Algebraic Pitches
is as a subgroup of Z^(inf), that is, a finite sequence of integers of
arbitrary length.

(By the way, the current representation is algebraically poor because
every finitely generated non-trivial subgroup of Q is isomorphic to Z.
See comments on 2.2.)

Now the punchline: According to the Fundamental Theorem of Arithmetic,
Z^(inf) is actually isomorphic to Q*!


3. Normalisation

Normalisation is a projection from the set of all pitches described by
a group onto some subset of it, and that attempts to preserve as much as
possible from its musical properties.

There are at least two important kinds of normalisation:

N1) When the musical system uses a Pitch group that is a quotient of
the group used for notation.

e.g. Suppose we want to notate dodecaphonic/chromatic music in a
traditional staff. We do not want to use different symbols for what we
understand to be the same pitches (enharmonics), so we forbid every
flat, and only allow for single sharps on notes different from e and
b. (That is, we pick up just one member from each equivalence class)

Now, the same transposition that takes c to cis must take e to f. We
can still work with traditional pitches as usual, even for
transpositions, but the projection has to be applied before engraving.

(Also check snippet
transposing-pitches-with-minimum-accidentals-smart-transpose.ly)

N2) To overcome typesetting limitations.

e.g. In LilyPond, we might well ask to transpose a musical expression
from ceses to cisis. Suppose that the music expression contains a c.
Where should it go if we do not support cisisisis? disis? e? fes?
Nowhere? I see no obvious answer, although most would agree on
printing a warning.

In any case, I do not think this should be class Pitch's trouble.
_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to