Struct tune::pitch::Pitch [−][src]
Struct representing the frequency of a pitch.
You can retrieve the absolute frequency of a Pitch
in Hz via Pitch::as_hz
.
Alternatively, Pitch
es can interact with Ratio
s using Ratio::between_pitches
or the Mul
/Div
operators.
Implementations
impl Pitch
[src]
pub fn of(pitched: impl Pitched) -> Pitch
[src]
A more intuitive replacement for Pitched::pitch
.
Examples
use tune::pitch::Pitched; let note = NoteLetter::C.in_octave(4); assert_approx_eq!(Pitch::of(note).as_hz(), note.pitch().as_hz());
pub fn from_hz(hz: f64) -> Pitch
[src]
pub fn as_hz(self) -> f64
[src]
Trait Implementations
impl Clone for Pitch
[src]
impl Copy for Pitch
[src]
impl Debug for Pitch
[src]
impl Div<Ratio> for Pitch
[src]
Lower a Pitch
by a given Ratio
.
Examples
assert_approx_eq!((Pitch::from_hz(330.0) / Ratio::from_float(1.5)).as_hz(), 220.0);
type Output = Pitch
The resulting type after applying the /
operator.
fn div(self, rhs: Ratio) -> Self::Output
[src]
impl FromStr for Pitch
[src]
type Err = String
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
impl Mul<Ratio> for Pitch
[src]
Raise a Pitch
by a given Ratio
.
Examples
assert_approx_eq!((Pitch::from_hz(220.0) * Ratio::from_float(1.5)).as_hz(), 330.0);
type Output = Pitch
The resulting type after applying the *
operator.
fn mul(self, rhs: Ratio) -> Self::Output
[src]
impl PartialEq<Pitch> for Pitch
[src]
impl PartialOrd<Pitch> for Pitch
[src]
fn partial_cmp(&self, other: &Pitch) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Pitched for Pitch
[src]
fn pitch(&self) -> Pitch
[src]
fn find_in_tuning<K, T: Tuning<K>>(&self, tuning: T) -> Approximation<K>
[src]
impl StructuralPartialEq for Pitch
[src]
Auto Trait Implementations
impl RefUnwindSafe for Pitch
impl Send for Pitch
impl Sync for Pitch
impl Unpin for Pitch
impl UnwindSafe for Pitch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,