Enum wmidi::Note [−][src]
#[repr(u8)] pub enum Note {}Show variants
CMinus1, DbMinus1, DMinus1, EbMinus1, EMinus1, FMinus1, GbMinus1, GMinus1, AbMinus1, AMinus1, BbMinus1, BMinus1, C0, Db0, D0, Eb0, E0, F0, Gb0, G0, Ab0, A0, Bb0, B0, C1, Db1, D1, Eb1, E1, F1, Gb1, G1, Ab1, A1, Bb1, B1, C2, Db2, D2, Eb2, E2, F2, Gb2, G2, Ab2, A2, Bb2, B2, C3, Db3, D3, Eb3, E3, F3, Gb3, G3, Ab3, A3, Bb3, B3, C4, Db4, D4, Eb4, E4, F4, Gb4, G4, Ab4, A4, Bb4, B4, C5, Db5, D5, Eb5, E5, F5, Gb5, G5, Ab5, A5, Bb5, B5, C6, Db6, D6, Eb6, E6, F6, Gb6, G6, Ab6, A6, Bb6, B6, C7, Db7, D7, Eb7, E7, F7, Gb7, G7, Ab7, A7, Bb7, B7, C8, Db8, D8, Eb8, E8, F8, Gb8, G8, Ab8, A8, Bb8, B8, C9, Db9, D9, Eb9, E9, F9, Gb9, G9,
Expand description
A midi note.
The format for the enum is $NOTE
$MODIFIER?
$OCTAVE
. Note can be a note from A
to G
.
Modifier can be b
for flat or Sharp
for sharp. Octave is the number. The octave -1
is
represented as Minus1
.
Example
use wmidi::Note; let ab7_chord = [Note::AbMinus1, Note::C4, Note::Gb4]; // We omit the 5th for a jazzier sound let dmaj_chord = [Note::D2, Note::FSharp3, Note::A3]; assert_eq!(u8::from(Note::C3), 48u8); assert_eq!(Note::from_u8_lossy(48), Note::C3);
Variants
Expand description
Middle C.
Expand description
A440.
Implementations
impl Note
[src]
impl Note
[src]pub const CSharpMinus1: Note
[src]
pub const DSharpMinus1: Note
[src]
pub const FSharpMinus1: Note
[src]
pub const GSharpMinus1: Note
[src]
pub const ASharpMinus1: Note
[src]
pub const CSharp0: Note
[src]
pub const DSharp0: Note
[src]
pub const FSharp0: Note
[src]
pub const GSharp0: Note
[src]
pub const ASharp0: Note
[src]
pub const CSharp1: Note
[src]
pub const DSharp1: Note
[src]
pub const FSharp1: Note
[src]
pub const GSharp1: Note
[src]
pub const ASharp1: Note
[src]
pub const CSharp2: Note
[src]
pub const DSharp2: Note
[src]
pub const FSharp2: Note
[src]
pub const GSharp2: Note
[src]
pub const ASharp2: Note
[src]
pub const CSharp3: Note
[src]
pub const DSharp3: Note
[src]
pub const FSharp3: Note
[src]
pub const GSharp3: Note
[src]
pub const ASharp3: Note
[src]
pub const CSharp4: Note
[src]
pub const DSharp4: Note
[src]
pub const FSharp4: Note
[src]
pub const GSharp4: Note
[src]
pub const ASharp4: Note
[src]
pub const CSharp5: Note
[src]
pub const DSharp5: Note
[src]
pub const FSharp5: Note
[src]
pub const GSharp5: Note
[src]
pub const ASharp5: Note
[src]
pub const CSharp6: Note
[src]
pub const DSharp6: Note
[src]
pub const FSharp6: Note
[src]
pub const GSharp6: Note
[src]
pub const ASharp6: Note
[src]
pub const CSharp7: Note
[src]
pub const DSharp7: Note
[src]
pub const FSharp7: Note
[src]
pub const GSharp7: Note
[src]
pub const ASharp7: Note
[src]
pub const CSharp8: Note
[src]
pub const DSharp8: Note
[src]
pub const FSharp8: Note
[src]
pub const GSharp8: Note
[src]
pub const ASharp8: Note
[src]
pub const CSharp9: Note
[src]
pub const DSharp9: Note
[src]
pub const FSharp9: Note
[src]
pub const LOWEST_NOTE: Note
[src]
pub const LOWEST_NOTE: Note
[src]The lowest representable note.
pub const HIGHEST_NOTE: Note
[src]
pub const HIGHEST_NOTE: Note
[src]The highest representable note.
pub unsafe fn from_u8_unchecked(note: u8) -> Note
[src]
pub unsafe fn from_u8_unchecked(note: u8) -> Note
[src]pub fn from_u8_lossy(note: u8) -> Note
[src]
pub fn from_u8_lossy(note: u8) -> Note
[src]Create a note from a u8
. Only the 7 least significant bits of note
are used.
pub fn to_freq_f32(self) -> f32
[src]
pub fn to_freq_f32(self) -> f32
[src]The frequency using the standard 440Hz tuning.
Example
let note = wmidi::Note::A3; sing(note.to_freq_f32());
pub fn to_freq_f64(self) -> f64
[src]
pub fn to_freq_f64(self) -> f64
[src]The frequency using the standard 440Hz tuning.
Example
let note = wmidi::Note::A3; sing(note.to_freq_f64());
Trait Implementations
impl Ord for Note
[src]
impl Ord for Note
[src]impl PartialOrd<Note> for Note
[src]
impl PartialOrd<Note> for Note
[src]fn partial_cmp(&self, other: &Note) -> Option<Ordering>
[src]
fn partial_cmp(&self, other: &Note) -> Option<Ordering>
[src]This method returns an ordering between self
and other
values if one exists. Read more
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than (for self
and other
) and is used by the <
operator. Read more
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl TryFrom<u8> for Note
[src]
impl TryFrom<u8> for Note
[src]Convert from a u8
to a Note
. The u8
must be in the range [0, 127] inclusive.
fn try_from(note: u8) -> Result<Note, Error>
[src]
fn try_from(note: u8) -> Result<Note, Error>
[src]Creates a note from a u8
. note
must be between [0, 127] inclusive to create a valid
note.
Example
use std::convert::TryFrom; fn decode_note(number: u8) -> Result<wmidi::Note, wmidi::Error> { let parsed_note = 60; let note = wmidi::Note::try_from(parsed_note)?; Ok(note) }
impl Copy for Note
[src]
impl Eq for Note
[src]
impl StructuralEq for Note
[src]
impl StructuralPartialEq for Note
[src]
Auto Trait Implementations
impl RefUnwindSafe for Note
impl Send for Note
impl Sync for Note
impl Unpin for Note
impl UnwindSafe for Note
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more