Trait tune::tuning::Tuning [−][src]
Required methods
fn pitch_of(&self, key: K) -> Pitch
[src]
Returns the Pitch
of the given key or note K
in the current Tuning
.
Examples
use tune::tuning::Tuning; let standard_tuning = ConcertPitch::default(); let a5 = NoteLetter::A.in_octave(5); assert_approx_eq!(standard_tuning.pitch_of(a5).as_hz(), 880.0);
fn find_by_pitch(&self, pitch: Pitch) -> Approximation<K>
[src]
Finds a closest key or note Approximation
for the given Pitch
in the current Tuning
.
Examples
use tune::tuning::Tuning; let standard_tuning = ConcertPitch::default(); let a5 = NoteLetter::A.in_octave(5); let detuned_a5_pitch = Pitch::of(a5) * Ratio::from_cents(10.0); let approximation = standard_tuning.find_by_pitch(detuned_a5_pitch); assert_eq!(approximation.approx_value, a5); assert_approx_eq!(approximation.deviation.as_cents(), 10.0);
Provided methods
fn as_linear_mapping(self) -> LinearMapping<Self> where
Self: Sized,
[src]
Self: Sized,
Wraps self
in a type adapter s.t. it can be used in functions that are generic over KeyboardMapping<K>
.
Implementations on Foreign Types
impl<S: Borrow<Scl>, K: Borrow<KbmRoot>> Tuning<PianoKey> for (S, K)
[src]
fn pitch_of(&self, key: PianoKey) -> Pitch
[src]
fn find_by_pitch(&self, pitch: Pitch) -> Approximation<PianoKey>
[src]
impl<S: Borrow<Scl>, K: Borrow<KbmRoot>> Tuning<i32> for (S, K)
[src]
fn pitch_of(&self, degree: i32) -> Pitch
[src]
fn find_by_pitch(&self, pitch: Pitch) -> Approximation<i32>
[src]
impl<K, T: Tuning<K> + ?Sized> Tuning<K> for &T
[src]
impl
forwarding for references.
fn pitch_of(&self, key: K) -> Pitch
[src]
fn find_by_pitch(&self, pitch: Pitch) -> Approximation<K>
[src]
impl Tuning<Note> for ()
[src]
Convenience implementation enabling to write ()
instead of ConcertPitch::default()
.
Examples
use tune::pitch::Pitched; assert_eq!(Pitch::from_hz(880.0).find_in_tuning(()).approx_value, Note::from_midi_number(81));
fn pitch_of(&self, note: Note) -> Pitch
[src]
fn find_by_pitch(&self, pitch: Pitch) -> Approximation<Note>
[src]
Implementors
impl Tuning<Note> for ConcertPitch
[src]
A ConcertPitch
maps Note
s to Pitch
es 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);