pub enum NoteTable {
Equal,
ScopeTui,
}Expand description
Which pitches NoteTable::hz gives a note.
use rich_ext::dsp::NoteTable;
// E2: 82.41 Hz in equal temperament; scope-tui's octave-0 E, 20.60 Hz,
// doubled twice: 82.4 Hz (as an f32).
assert!((NoteTable::Equal.hz("E2").unwrap() - 82.407).abs() < 0.001);
assert_eq!(NoteTable::ScopeTui.hz("E2"), Some(f64::from(82.4f32)));
// Without an octave: 4 in equal temperament, 0 in scope-tui's table.
assert_eq!(NoteTable::Equal.hz("A"), Some(440.0));
assert_eq!(NoteTable::ScopeTui.hz("A"), Some(27.5));Variants§
Equal
Equal temperament, A4 at 440 Hz, octave 4 by default: exact
(note_hz).
ScopeTui
scope-tui’s table (music.rs, 0.3.5): the twelve pitches of octave
0 rounded to the hundredth of a hertz (C0 16.35, …, B0 30.87),
doubled once an octave in f32, octave 0 by default and no octave
below it. A clone that divides a sample rate by these pitches picks
the buffer sizes scope-tui’s --tune does, sample for sample
(about one note in ten is a sample off equal temperament’s).
Implementations§
Trait Implementations§
impl Copy for NoteTable
impl Eq for NoteTable
impl StructuralPartialEq for NoteTable
Auto Trait Implementations§
impl Freeze for NoteTable
impl RefUnwindSafe for NoteTable
impl Send for NoteTable
impl Sync for NoteTable
impl Unpin for NoteTable
impl UnsafeUnpin for NoteTable
impl UnwindSafe for NoteTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.