Struct tune::pitch::Pitch[][src]

pub struct Pitch { /* fields omitted */ }

Struct representing the frequency of a pitch.

You can retrieve the absolute frequency of a Pitch in Hz via Pitch::as_hz. Alternatively, Pitches can interact with Ratios 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.

impl FromStr for Pitch[src]

type Err = String

The associated error which can be returned from parsing.

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.

impl PartialEq<Pitch> for Pitch[src]

impl PartialOrd<Pitch> for Pitch[src]

impl Pitched for Pitch[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]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.