pub struct Pitch(/* private fields */);Expand description
A MIDI note number, 0 through 127. Middle C (o4 c) is 60 and A4 (440 Hz) is 69.
Implementations§
Source§impl Pitch
impl Pitch
pub const A4: Pitch
pub const C4: Pitch
pub fn new(midi: u8) -> Result<Self>
Sourcepub fn from_name(letter: char, accidental: i8, octave: i8) -> Result<Self>
pub fn from_name(letter: char, accidental: i8, octave: i8) -> Result<Self>
A note letter a..g, a number of semitones to raise (1 for sharp, -1
for flat) and an octave, where octave 4 starts at middle C.
pub fn midi(self) -> u8
Trait Implementations§
impl Copy for Pitch
impl Eq for Pitch
Source§impl Ord for Pitch
impl Ord for Pitch
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for Pitch
impl PartialOrd for Pitch
impl StructuralPartialEq for Pitch
Auto Trait Implementations§
impl Freeze for Pitch
impl RefUnwindSafe for Pitch
impl Send for Pitch
impl Sync for Pitch
impl Unpin for Pitch
impl UnsafeUnpin 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