lilypond-devel
[Top][All Lists]
Advanced

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

Re: Lilypond's internal pitch representation and microtonal notation


From: Hans Aberg
Subject: Re: Lilypond's internal pitch representation and microtonal notation
Date: Mon, 20 Sep 2010 15:41:17 +0200

On 20 Sep 2010, at 14:48, Joseph Wakeling wrote:

I saw the post but was not sure quite how to interpret it.

I expected someone to ask for details. In the past, I discussed part of it with Graham Breed, who did some LilyPond microtonal implementation,
but perhaps he is not working on it anymore.

I get the feeling activity is rather focused right now on getting 2.14
released ... :-)

So the problem is finding someone willing to have a look at it from the LilyPond side.

I also discussed microtonal stuff with Graham Breed a while back, but we
weren't really able to bring anything to a satisfactory conclusion.

Graham's code is within LilyPond's current model. We discussed a bit this extension, but at that time, I had not made a full generalization.

If you want, I can explain it - the algorithm itself is very simple.
Writing up it in math style will probably not make it more accessible.

It would make it clearer to me, surely. What I'd like to see is for it
to be written up in a structured way along the lines of

Sure, just get back if you want more details or examples.

(i) this is the
problem that needs solving,

The staff can be an arbitrary scale (see below), and one has music in another. The problem is to compute, for any note, the accidental to use, and the key signature. The latter follows from the former, though.

The scales of the staff and the music choose their pitches as integer linear combinations from an abstract set of seconds. In the traditional typesetting, one has a minor second m and a major second M, so it is all combinations p m + q M, where p, q are integers, which can be identified with all pairs (p, q). Mathematically, I am looking the free abelian group generated by the intervals one wants to use.

The traditional staff scale is the minor scale: 0, M, m+M, ..., corresponding to a, b, c, .... This can be extended to other types of accidentals by adding neutral seconds n_1, ... For Persian, Arab, Turkish music, and Just Intonation relative Pythagorean, in each, just one neutral suffices, but it has different values when giving it a value.

(ii) this is the approach the algorithm
takes to solve the problem,

One needs an order between the seconds, which is a choice of preference by the one typesetting the music.

(iii) this is the algorithm.

Call the sum of the coefficients of a linear combination the degree of the note. A requirement is that the staff provides a note for every degree (also having that degree) one wants to typeset a note for.

In order to typeset a note, first compute its degree, and then subtract the staff note of that degree. The result is a note of degree zero, which should be typeset using an accidental. An accidental is represented by a linear combination with positive coefficients of pairs of distinct seconds.

Compute its accidental by successively reducing the first (relative the order of the seconds) positive and negative coefficients until it stops (the note is 0).

As you can see, there are really no requirements of what scales to use. So it pushes the staff notation to its utmost capabilities.

I did wonder if the fact it was Haskell code was part of the reason for the lack of response. I have a lot of admiration for Haskell but I can see there being problems extending Lilypond with yet another language.
,
It should not be difficult to translate into Scheme - no specific
Haskell features are used, only better syntax and type system to help
structuring the code. It is just a page.

The difficulty is to figure out to put it into LilyPond.

Indeed, it sounds like a pretty fundamental
major-version-number-changing kind of modification.

It might be. But it is a generalization, that is, one builds an interface on top which expresses the current LilyPond model. Then the rest can be changed when one has time.

As a related issue, have you considered how (different kinds of)
transposition would be handled in your pitch scheme?


This is much simpler: the linear combinations are vectors that you just add. For example, if a, b, c, ... are represented by 0, M, m +M, ..., and you want to transpose from b to c, just add m. A sharp is M-m and a flat m-M. If you want transpose from a note x to a note y, just add y - x.




reply via email to

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