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§
source§impl 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§
source§impl Div<Ratio> for Pitch
impl Div<Ratio> for Pitch
source§impl Mul<Ratio> for Pitch
impl Mul<Ratio> for Pitch
source§impl PartialEq for Pitch
impl PartialEq for Pitch
source§impl PartialOrd for Pitch
impl PartialOrd for Pitch
1.0.0 · source§fn 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 moreimpl 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§
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