pub struct Pitch { /* private fields */ }
Expand description
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
sourceimpl Pitch
impl Pitch
sourcepub fn of(pitched: impl Pitched) -> Pitch
pub fn of(pitched: impl Pitched) -> Pitch
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
pub fn as_hz(self) -> f64
Trait Implementations
sourceimpl Div<Ratio> for Pitch
impl Div<Ratio> for Pitch
sourceimpl Mul<Ratio> for Pitch
impl Mul<Ratio> for Pitch
sourceimpl PartialOrd<Pitch> for Pitch
impl PartialOrd<Pitch> for Pitch
sourcefn partial_cmp(&self, other: &Pitch) -> Option<Ordering>
fn partial_cmp(&self, other: &Pitch) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Copy for Pitch
impl StructuralPartialEq for Pitch
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more