[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Representation of pitches and scales
From: |
Han-Wen Nienhuys |
Subject: |
Re: Representation of pitches and scales |
Date: |
Mon, 4 Jun 2007 23:13:48 -0300 |
I also think that the Scale object should contain information about the
size of an alteration (that is, how many cents a quartertone takes).
We could add some nifty scheme functions to calculate a scale given a
fifth-size in cents, or a whole-tone-size in cents.
Music notation is idiosyncratic, so any representation will have its
sharp edges. I agree that representing 1/6th of octaves doesn't make
sense from a musical point of view; however, I think that rational
numbers are better than cents for representing microtones. The
microtonal support was requested by Turkish-music players, who use
1/9th tones as their unit. Such divisions can not be represented
exactly using cents. When we're using exact rationals, we might as
well drop the factor 100, which I assume to be an attempt to have a
more exact measure for pitch. Also, I think there is some logic to
representing a "half tone" as the number 1/2.
In any event, it should not be that hard to write a cent -> tone
conversion function.
I see that the diatonic scale is represented as
(ly:make-scale #(0 1 2 5/2 7/2 9/2 11/2)
thereby effectively hardcoding a semitone to be exactly half a whole
tone - which is rather inadequate because it makes it impossible to
distinguish e.g. cis from des.
No, this defines the scale. If anything, this defines a temperament;
alterations can have their own rational definitions.
function takes an int-vector as argument even though it takes a rational
vector. The vector is also named "semitones" even though it counts whole
tones (?!?!).
patches appreciated.
In tone_pitch it seems like it is hardcoded that an octave consists of
exactly 6 whole notes.
No, that's an oversight. It should use scale_->step_tones_.size()
Another question:
Pitch::rounded_semitone_pitch () const
{
return int (double (tone_pitch () * Rational (2)));
}
Converting a double to an int always rounds down. Isn't it wrong not to
call round() on the double before casting it to int?
sure, patch appreciated.
--
Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen