lilypond-devel
[Top][All Lists]

## Re: Towards a new pitch representation

 From: Felipe Gonçalves Assis Subject: Re: Towards a new pitch representation Date: Fri, 31 Dec 2010 05:59:21 -0300

```On 31 December 2010 04:43, David Kastrup <address@hidden> wrote:
>
>> If we are going to move to a list for alterations, the list should probably
>> be rationals, rather than integers, in order to be most general.  Thus it
>> should most likely be (1/2 -1/4), rather than (1 -1).
>
> In that case, it would appear that "alteration" as a separate concept
> could be eliminated, and instead of pitch x with alteration (y z ...),
> we could just write (x y z ...).

That is a very fine idea! By the way, I look forwards to hearing more
advice on how to implement and organize things in Scheme, since
I am a beginner in that.

>
> It is just a pity that x is not (logarithmically) equispaced in physical
> pitch.
>

Hey, do not regret that yet! There is a simple procedure f such that
pitch (x y z ...) means exactly

x tones, (+ y (f x)) semitones, z whatever, etc.

This is what is actually implemented by class Scale. This does not change
much with the use of rational numbers.

You may enjoy checking function Pitch::transpose in lily/pitch.cc:142,
as well as the call to ly:set-default-scale in scm/lily.scm:387.

Cheers,
Felipe

```