pub struct EqualDivision { /* private fields */ }Expand description
An equal division of an arbitrary interval.
12edo is twelve equal divisions of the octave, 13edt thirteen of the
tritave. Nothing here assumes the period is an octave, so a degree past the
period simply carries on into the next one — which for Bohlen-Pierce means
the pitches never line up with an octave at all.
Implementations§
Source§impl EqualDivision
impl EqualDivision
Sourcepub fn new(
divisions: UnsignedIntegerType,
period_cents: FloatType,
) -> Result<Self>
pub fn new( divisions: UnsignedIntegerType, period_cents: FloatType, ) -> Result<Self>
Divides a period given in cents.
Errors on a period that is not a positive real number, or on no divisions at all.
Sourcepub fn of_ratio(
divisions: UnsignedIntegerType,
numerator: IntegerType,
denominator: IntegerType,
) -> Result<Self>
pub fn of_ratio( divisions: UnsignedIntegerType, numerator: IntegerType, denominator: IntegerType, ) -> Result<Self>
Divides the interval numerator/denominator.
The ratio is remembered, so the division names itself after it.
Sourcepub fn octave(divisions: UnsignedIntegerType) -> Result<Self>
pub fn octave(divisions: UnsignedIntegerType) -> Result<Self>
Divides the octave — an EDO, and what everyone means by default.
Sourcepub fn tritave(divisions: UnsignedIntegerType) -> Result<Self>
pub fn tritave(divisions: UnsignedIntegerType) -> Result<Self>
Divides the tritave, 3/1 — an EDT, which is Bohlen-Pierce’s period.
Sourcepub fn divisions(&self) -> UnsignedIntegerType
pub fn divisions(&self) -> UnsignedIntegerType
How many steps the period is divided into.
Sourcepub fn period_cents(&self) -> FloatType
pub fn period_cents(&self) -> FloatType
The period, in cents.
Sourcepub fn period_ratio(&self) -> Option<(IntegerType, IntegerType)>
pub fn period_ratio(&self) -> Option<(IntegerType, IntegerType)>
The ratio the period was given as, where it was given as one.
Sourcepub fn repeats_at_the_octave(&self) -> bool
pub fn repeats_at_the_octave(&self) -> bool
Whether the period is an octave, which is what makes this an ordinary EDO.
Sourcepub fn step_cents(&self) -> FloatType
pub fn step_cents(&self) -> FloatType
One step, in cents.
Sourcepub fn cents_at(&self, degree: IntegerType) -> FloatType
pub fn cents_at(&self, degree: IntegerType) -> FloatType
How far above the tonic degree steps sit, in cents.
A degree past the period carries on into the next one, and a negative degree goes below the tonic.
Sourcepub fn ratio_at(&self, degree: IntegerType) -> FloatType
pub fn ratio_at(&self, degree: IntegerType) -> FloatType
The frequency ratio of degree steps above the tonic.
Sourcepub fn degrees(&self) -> Vec<FloatType> ⓘ
pub fn degrees(&self) -> Vec<FloatType> ⓘ
Every degree of one period, in cents, from nought up to but not including the period.
Sourcepub fn nearest_degree(&self, cents: FloatType) -> IntegerType
pub fn nearest_degree(&self, cents: FloatType) -> IntegerType
The degree nearest cents above the tonic.
Sourcepub fn error_at_cents(&self, cents: FloatType) -> FloatType
pub fn error_at_cents(&self, cents: FloatType) -> FloatType
How far the nearest degree sits from cents; positive is sharp.
Sourcepub fn approximation_of(&self, interval: &Monzo) -> (IntegerType, FloatType)
pub fn approximation_of(&self, interval: &Monzo) -> (IntegerType, FloatType)
The degree nearest interval, and how far off it sounds in cents.
This is how well the division does a just interval, which for an EDO is the whole question of whether it is worth using.
Sourcepub fn patent_val(&self, limit: IntegerType) -> Result<Val>
pub fn patent_val(&self, limit: IntegerType) -> Result<Val>
The patent val of this division, read up to limit.
Each prime is mapped to the nearest whole number of steps, which for an octave division is the familiar patent val. For a period that is not an octave this is the generalized reading, and the octave itself then gets a mapping like any other prime rather than being the period. Errors for a limit that is not a prime the module carries.
Sourcepub fn mos(
&self,
steps: UnsignedIntegerType,
notes: UnsignedIntegerType,
) -> Result<MosScale>
pub fn mos( &self, steps: UnsignedIntegerType, notes: UnsignedIntegerType, ) -> Result<MosScale>
The scale of notes notes made by stacking steps of this division.
This is the wiki’s 3\22 — three steps of twenty-two — handed to the
moment-of-symmetry machinery.
Trait Implementations§
Source§impl Clone for EqualDivision
impl Clone for EqualDivision
Source§fn clone(&self) -> EqualDivision
fn clone(&self) -> EqualDivision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EqualDivision
Source§impl Debug for EqualDivision
impl Debug for EqualDivision
Source§impl<'de> Deserialize<'de> for EqualDivision
Available on crate feature serde only.
impl<'de> Deserialize<'de> for EqualDivision
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 EqualDivision
impl Display for EqualDivision
Source§impl FromStr for EqualDivision
impl FromStr for EqualDivision
Source§impl PartialEq for EqualDivision
impl PartialEq for EqualDivision
Source§impl Serialize for EqualDivision
Available on crate feature serde only.
impl Serialize for EqualDivision
serde only.impl StructuralPartialEq for EqualDivision
Auto Trait Implementations§
impl Freeze for EqualDivision
impl RefUnwindSafe for EqualDivision
impl Send for EqualDivision
impl Sync for EqualDivision
impl Unpin for EqualDivision
impl UnsafeUnpin for EqualDivision
impl UnwindSafe for EqualDivision
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