pub struct Scale<T = f32> {
pub root: Frequency<T>,
}Expand description
The Scale implementation uses the defined root or anchor frequency as the basis for
classfifications and other related computations.
Fields§
§root: Frequency<T>Implementations§
Source§impl<T> Scale<T>
impl<T> Scale<T>
pub const fn new(root: T) -> Self
Sourcepub const fn from_freq(root: Frequency<T>) -> Self
pub const fn from_freq(root: Frequency<T>) -> Self
creates a new Scale from the given root frequency
Sourcepub const fn root_mut(&mut self) -> &mut Frequency<T>
pub const fn root_mut(&mut self) -> &mut Frequency<T>
returns a mutable reference to the base frequency
Sourcepub fn classify(&self, Frequency: Frequency<T>) -> Option<isize>
pub fn classify(&self, Frequency: Frequency<T>) -> Option<isize>
classifies the given frequency as a pitch class n, using the formula:
n=\text{round}\Bigg(12\cdot\log_{2}\bigg(\frac{F}{\beta}\bigg)\Bigg)Sourcepub fn get_freq_of_class(&self, n: isize) -> Frequency<T>
pub fn get_freq_of_class(&self, n: isize) -> Frequency<T>
returns the frequency [Hz] of the given pitch class n, using the formula:
F= \beta \cdot 2^{\frac{n}{12}}Trait Implementations§
Source§impl<T: Ord> Ord for Scale<T>
impl<T: Ord> Ord for Scale<T>
Source§impl<T: PartialOrd> PartialOrd for Scale<T>
impl<T: PartialOrd> PartialOrd for Scale<T>
impl<T: Copy> Copy for Scale<T>
impl<T: Eq> Eq for Scale<T>
impl<T> StructuralPartialEq for Scale<T>
Auto Trait Implementations§
impl<T> Freeze for Scale<T>where
T: Freeze,
impl<T> RefUnwindSafe for Scale<T>where
T: RefUnwindSafe,
impl<T> Send for Scale<T>where
T: Send,
impl<T> Sync for Scale<T>where
T: Sync,
impl<T> Unpin for Scale<T>where
T: Unpin,
impl<T> UnwindSafe for Scale<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more