Pitches and Frequencies
The Pitch object provides a generalised mechanism for expressing and
converting between various pitch and frequency formats. The formats
supported are as follows:
value Hz (cycles per second, analogous to Csound's cps notation);
octave.semitone (analogous to Csound's pch notation);
octave.decimal (analogous to Csound's oct notation);
- note name notation (the pitch is represented as a character string).
In the last case the pitch names C-G can be used followed by an
optional b for flat or # for sharp. The basic pitch
name of the note is then followed by an octave number (whose value
has the same meaning as the integer parts of the pch and
oct notations).
Finally an optional microtonal adjustment may be added in the form of a
fraction +<x>/<y> or -<x>/<y>
which adds/subtracts a fraction of a semitone to/from the pitch given.
Some practical examples are given below:
Pitch p1 = 110.5 Hz;
Pitch p2 = C#5+1/2;
Pitch p3 = 8.05 pch;
Pitch p4 = 6.1764 oct;
Pitch methods include:
- asPitch()
-
returns a number representing the pitch converted to pch notation;
- asOctave()
-
returns a number representing the pitch converted to oct notation;
- asFrequency()
-
returns a number representing the pitch converted to a frequency;
- asName()
-
returns a character string representing the name of the pitch.
|