pub enum TuningSystem {
Show 26 variants
Equal(EqualDivision),
CarlosHarmonic,
CarlosHarmonic24,
PythagoreanTuning,
FiveLimit,
ElevenLimit,
FortyThreeTone,
Javanese,
Thai,
PtolemyIntenseDiatonic,
IndianAlt,
Indian22,
QuarterCommaMeantone,
WerckmeisterIII,
Rameau,
KirnbergerIII,
Vallotti,
YoungII,
ThirdCommaMeantone,
SixthCommaMeantone,
WerckmeisterIV,
WerckmeisterV,
KirnbergerI,
NeidhardtI,
Silbermann,
LehmanBach,
}Expand description
Supported tuning systems and ratio tables.
Every system repeats at a period, and a degree past the end of one is the same degree a period up. The ratio tables repeat at the octave; an equal division repeats wherever its period is, so Bohlen-Pierce climbs by tritaves.
Variants§
Equal(EqualDivision)
Equal steps of one period. 12edo is ordinary equal temperament,
6edo the whole-tone scale and 24edo quarter tones, and the period
need not be an octave: 13edt is Bohlen-Pierce.
CarlosHarmonic
Twelve-tone harmonic-series scale (Wendy Carlos’s Harmonic).
Not just intonation, despite its former name: the degrees are the
harmonic series 16:17:18:19:20:21:22:24:26:27:28:30, which reaches the
19-limit. TuningSystem::FiveLimit is the classical 12-tone JI scale.
CarlosHarmonic24
Twenty-four-tone harmonic-series scale.
PythagoreanTuning
Twelve-tone Pythagorean tuning table.
FiveLimit
Twelve-tone five-limit table.
ElevenLimit
Twenty-nine-tone eleven-limit table.
FortyThreeTone
Forty-three-tone ratio table.
Javanese
Five-tone Javanese equal-temperament approximation.
Thai
Seven-tone Thai equal-temperament approximation.
PtolemyIntenseDiatonic
Ptolemy’s intense diatonic, also Zarlino’s just major scale.
Greek and Renaissance European, despite once being filed here as an
Indian scale — the archive names it ptolemy.scl.
IndianAlt
Alternate seven-tone PtolemyIntenseDiatonic scale table.
Indian22
Twenty-two-tone PtolemyIntenseDiatonic scale table.
QuarterCommaMeantone
Twelve-tone quarter-comma meantone temperament (Aaron, 1523).
WerckmeisterIII
Twelve-tone Werckmeister III well temperament (1681).
Rameau
Twelve-tone Rameau modified meantone temperament (1725).
KirnbergerIII
Twelve-tone Kirnberger III well temperament (1744).
Vallotti
Twelve-tone Vallotti well temperament (c. 1754).
YoungII
Twelve-tone Thomas Young well temperament no. 2 (1799).
ThirdCommaMeantone
A twelve-tone third-comma meantone temperament (Salinas, 1577).
SixthCommaMeantone
A twelve-tone sixth-comma meantone temperament (Salinas, 1577).
WerckmeisterIV
A twelve-tone Werckmeister IV well temperament (1681).
WerckmeisterV
A twelve-tone Werckmeister V well temperament (1681).
KirnbergerI
A twelve-tone Kirnberger I well temperament (1766).
NeidhardtI
A twelve-tone Neidhardt I well temperament (1724).
Silbermann
A twelve-tone Gottfried Silbermann temperament no. 1 (c. 1730).
LehmanBach
A twelve-tone Lehman-Bach temperament (2005).
Implementations§
Source§impl TuningSystem
impl TuningSystem
Sourcepub const EQUAL_TEMPERAMENT: Self
pub const EQUAL_TEMPERAMENT: Self
Twelve-tone equal temperament, 12edo.
Sourcepub const WHOLE_TONE: Self
pub const WHOLE_TONE: Self
The whole-tone scale, six equal steps to the octave.
Sourcepub const QUARTER_TONE: Self
pub const QUARTER_TONE: Self
Quarter tones, twenty-four equal steps to the octave.
Sourcepub fn display_name(self) -> String
pub fn display_name(self) -> String
Returns a compact display name for this tuning system.
Sourcepub fn description(self) -> String
pub fn description(self) -> String
Returns a short description of this tuning system.
Sourcepub fn ratio(self, index: usize) -> FloatType
pub fn ratio(self, index: usize) -> FloatType
The frequency ratio of a degree above the system’s starting pitch.
Sourcepub fn ratio_at(self, index: FloatType) -> FloatType
pub fn ratio_at(self, index: FloatType) -> FloatType
The same for a fractional degree. A whole degree is the system’s own step exactly; between two, the pitch is interpolated as the equal division of the period with as many steps would place it.
Sourcepub fn exact_ratio(self, index: usize) -> Option<Ratio>
pub fn exact_ratio(self, index: usize) -> Option<Ratio>
The degree as an exact ratio, where it is one.
Every ratio table has one for each degree, and so does an equal
division of a whole-number period, as a root of it: a step of 13edt
is the thirteenth root of three. A division of an irrational period,
Carlos Alpha’s 78 cents, has none.
Sourcepub fn label(self, index: UnsignedIntegerType) -> String
pub fn label(self, index: UnsignedIntegerType) -> String
A name for a degree, counted from C-1.
A system of twelve degrees to the octave names each degree for its key,
C♯/D♭4, however it is tuned, and so does any other system on a degree
that lands on a key. Every other degree is the pitch it sounds, as
TuningSystem::pitch_at spells it, with its microtone: G0(+2c) is
the thirteenth step of Bohlen-Pierce. Ptolemy’s intense diatonic and
the Sa-grama are named in sargam, Re0.
Sourcepub fn period_of(self, index: UnsignedIntegerType) -> UnsignedIntegerType
pub fn period_of(self, index: UnsignedIntegerType) -> UnsignedIntegerType
Which period a degree falls in, counting from nought.
Sourcepub fn frequency(self, index: UnsignedIntegerType) -> FloatType
pub fn frequency(self, index: UnsignedIntegerType) -> FloatType
The frequency in hertz of a degree above C-1.
Sourcepub fn frequency_at(self, index: FloatType) -> FloatType
pub fn frequency_at(self, index: FloatType) -> FloatType
The frequency in hertz of a fractional degree above C-1.
Sourcepub fn nearest_degree(self, hertz: FloatType) -> Result<IntegerType>
pub fn nearest_degree(self, hertz: FloatType) -> Result<IntegerType>
The degree sounding nearest hertz, counted from C-1 as
TuningSystem::frequency counts, and measured in cents. Errors on a
frequency that is not a finite number above nought.
use music21_rs::tuningsystem::TuningSystem;
let nineteen = TuningSystem::edo(19);
// A4 at 440 Hz is nearest degree 5 of the fifth period above C-1.
assert_eq!(nineteen.nearest_degree(440.0)?, 5 * 19 + 14);Sourcepub fn pitch_at(self, index: IntegerType) -> Result<Pitch>
pub fn pitch_at(self, index: IntegerType) -> Result<Pitch>
The pitch a degree sounds, counted from C-1: spelled as the nearest
pitch-space value is spelled, with any remainder as a microtone.
use music21_rs::tuningsystem::TuningSystem;
// Degree 4 of the five-limit table is a just major third above C-1.
let e = TuningSystem::FiveLimit.pitch_at(64)?;
assert_eq!(e.name_with_octave(), "E4");
assert!((e.microtone().unwrap().cents() + 13.686).abs() < 1e-3);Sourcepub fn cents(self, index: UnsignedIntegerType) -> FloatType
pub fn cents(self, index: UnsignedIntegerType) -> FloatType
How far a degree lies from the same degree of the equal division of the same period into as many steps, in cents. Nought all the way up for an equal division, which is its own reference.
Sourcepub fn degrees_per_period(self) -> UnsignedIntegerType
pub fn degrees_per_period(self) -> UnsignedIntegerType
How many degrees the system has before it repeats: twelve for most of the tables, and the number of divisions for an equal one.
Sourcepub fn period_cents(self) -> FloatType
pub fn period_cents(self) -> FloatType
The interval the system repeats at, in cents: an octave for every table, and whatever an equal division divides.
Sourcepub fn repeats_at_the_octave(self) -> bool
pub fn repeats_at_the_octave(self) -> bool
Whether the system repeats at the octave.
Sourcepub fn is_keyboard(self) -> bool
pub fn is_keyboard(self) -> bool
Whether the system has twelve degrees to the octave, one for each key of a keyboard.
Sourcepub const fn edo(divisions: UnsignedIntegerType) -> Self
pub const fn edo(divisions: UnsignedIntegerType) -> Self
An equal division of the octave into a number of steps fixed where it
is written, for naming one in a constant. It is a compile error in a
constant, and a panic otherwise, to ask for no steps at all; a count
read at runtime goes through EqualDivision::octave, which is an
error instead.
Trait Implementations§
Source§impl Clone for TuningSystem
impl Clone for TuningSystem
impl Copy for TuningSystem
Source§impl Debug for TuningSystem
impl Debug for TuningSystem
Source§impl<'de> Deserialize<'de> for TuningSystem
Available on crate feature serde only.
impl<'de> Deserialize<'de> for TuningSystem
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TuningSystem
impl Display for TuningSystem
Source§impl From<TuningSystem> for AnyTuningSystem
impl From<TuningSystem> for AnyTuningSystem
Source§fn from(tuning_system: TuningSystem) -> Self
fn from(tuning_system: TuningSystem) -> Self
Source§impl FromStr for TuningSystem
impl FromStr for TuningSystem
Source§impl PartialEq for TuningSystem
impl PartialEq for TuningSystem
Source§impl Serialize for TuningSystem
Available on crate feature serde only.
impl Serialize for TuningSystem
serde only.impl StructuralPartialEq for TuningSystem
Auto Trait Implementations§
impl Freeze for TuningSystem
impl RefUnwindSafe for TuningSystem
impl Send for TuningSystem
impl Sync for TuningSystem
impl Unpin for TuningSystem
impl UnsafeUnpin for TuningSystem
impl UnwindSafe for TuningSystem
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more