pub struct ConcertPitch { /* private fields */ }
Expand description

A ConcertPitch enables Notes to sound at a Pitch different to what would be expected in 440 Hz standard tuning.

To access the full potential of ConcertPitches have a look at the Tuning and PitchedNote traits.

Implementations

Creates a ConcertPitch with the given a4_pitch.

Creates a ConcertPitch from the given note and pitched value.

Examples
let c4 = NoteLetter::C.in_octave(4);
let fixed_c4_tuning = ConcertPitch::from_note_and_pitch(c4, Pitch::from_hz(260.0));
assert_approx_eq!(fixed_c4_tuning.a4_pitch().as_hz(), 437.266136);

Returns the Pitch of A4.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The default ConcertPitch is A4 sounding at 440 Hz.

Examples

assert_approx_eq!(ConcertPitch::default().a4_pitch().as_hz(), 440.0);

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

A ConcertPitch maps Notes to Pitches and is considered a Tuning.

Examples

use tune::tuning::Tuning;

let c4 = NoteLetter::C.in_octave(4);
let a4 = NoteLetter::A.in_octave(4);

let standard_tuning = ConcertPitch::default();
assert_approx_eq!(standard_tuning.pitch_of(c4).as_hz(), 261.625565);
assert_approx_eq!(standard_tuning.pitch_of(a4).as_hz(), 440.0);

let healing_tuning = ConcertPitch::from_a4_pitch(Pitch::from_hz(432.0));
assert_approx_eq!(healing_tuning.pitch_of(c4).as_hz(), 256.868737);
assert_approx_eq!(healing_tuning.pitch_of(a4).as_hz(), 432.0);

Returns the Pitch of the given key or note K in the current Tuning. Read more

Finds a closest key or note Approximation for the given Pitch in the current Tuning. Read more

Wraps self in a type adapter s.t. it can be used in functions that are generic over KeyboardMapping<K>.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.