Skip to main content

Note

Struct Note 

Source
pub struct Note { /* private fields */ }
Expand description

A note type.

This is a named pitch with an octave. This type allows for correctly attributing octave changes across an interval from one Note to another.

Implementations§

Source§

impl Note

Source

pub fn new(pitch: NamedPitch, octave: Octave) -> Self

Creates a new Note from the given NamedPitch and Octave.

Source

pub fn try_from_midi(midi: u8) -> Res<Self>

Attempts to create a Note from a MIDI note number.

Source§

impl Note

Source

pub async fn try_from_mic(length_in_seconds: u8) -> Res<Vec<Note>>

Attempts to use the default microphone to listen to audio for the specified time to identify the notes in the recorded audio.

Currently, this does not work with WASM.

Source

pub fn try_from_audio(data: &[f32], length_in_seconds: u8) -> Res<Vec<Note>>

Attempts to use the provided to identify the notes in the audio data.

Source

pub async fn try_from_mic_ml(length_in_seconds: u8) -> Res<Vec<Self>>

Attempts to use the default microphone to listen to audio for the specified time to identify the notes in the recorded audio using ML.

Currently, this does not work with WASM.

Source

pub fn try_from_audio_ml(data: &[f32], length_in_seconds: u8) -> Res<Vec<Self>>

Attempts to use the provided audio data to identify the notes using ML.

Trait Implementations§

Source§

impl Add<Interval> for Note

Source§

type Output = Note

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Interval) -> Self::Output

Performs the + operation. Read more
Source§

impl AddAssign<Interval> for Note

Source§

fn add_assign(&mut self, rhs: Interval)

Performs the += operation. Read more
Source§

impl Clone for Note

Source§

fn clone(&self) -> Note

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Note

Source§

impl Debug for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Note

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for Note

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Note

Source§

impl HasFrequency for Note

Source§

fn frequency(&self) -> f32

Returns the frequency of the type (usually a [Note]).
Source§

fn frequency_range(&self) -> (f32, f32)

Returns the frequency range of the type (usually a [Note]). Essentially, mid way between the frequency and the next frequency on either side.
Source§

fn tight_frequency_range(&self) -> (f32, f32)

Returns the tight frequency range of the type (usually a [Note]). Essentially, 1/8 the way between the frequency and the next frequency on either side.
Source§

impl HasName for Note

Source§

fn name(&self) -> String

Returns the computed name of the type.
Source§

fn name_ascii(&self) -> String

Returns the computed name of the type in ASCII.
Source§

impl HasNamedPitch for Note

Source§

fn named_pitch(&self) -> NamedPitch

Returns the named pitch of the type.
Source§

impl HasNoteId for Note

Source§

fn id(self) -> u128

Returns the ID of the note.
Source§

fn id_index(self) -> u8

Returns the position of the 1 for the ID of the note.
Source§

fn from_id(id: u128) -> Res<Self>

Returns the note from the given ID.
Source§

fn id_mask(notes: &[Self]) -> u128
where Self: Sized,

Returns the ID mask for the given notes.
Source§

fn from_id_mask(id_mask: u128) -> Res<Vec<Self>>
where Self: Sized,

Returns the notes from the given ID mask.
Source§

impl HasOctave for Note

Source§

fn octave(&self) -> Octave

Returns the octave of the type.
Source§

impl HasPitch for Note

Source§

fn pitch(&self) -> Pitch

Returns the pitch of the type (usually a [Note]).
Source§

impl HasPrimaryHarmonicSeries for Note

Source§

fn primary_harmonic_series(self) -> Vec<Self>

Returns the primary harmonic series of the note.
Source§

impl HasStaticName for Note

Source§

fn static_name(&self) -> &'static str

Returns the static name of the type.
Source§

impl Hash for Note

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoChord for Note

Source§

fn into_chord(self) -> Chord

Converts this type into a Chord (usually a Note).
Source§

impl NoteRecreator for Note

Source§

fn with_named_pitch(self, named_pitch: NamedPitch) -> Self

Recreates this Note with the given NamedPitch.
Source§

fn with_octave(self, octave: Octave) -> Self

Recreates this Note with the given Octave.
Source§

impl Ord for Note

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl Parsable for Note

Source§

fn parse(input: &str) -> Res<Self>
where Self: Sized,

Parses the type from a string.
Source§

impl PartialEq for Note

Source§

fn eq(&self, other: &Note) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl PartialOrd for Note

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for Note

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Note

Source§

impl Sub for Note

Source§

type Output = Interval

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<Interval> for Note

Source§

type Output = Note

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Interval) -> Self::Output

Performs the - operation. Read more
Source§

impl ToUniversal for Note

Source§

fn to_universal(self) -> Note

Converts this note to a universal pitch.

Auto Trait Implementations§

§

impl Freeze for Note

§

impl RefUnwindSafe for Note

§

impl Send for Note

§

impl Sync for Note

§

impl Unpin for Note

§

impl UnsafeUnpin for Note

§

impl UnwindSafe for Note

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> Playable for T
where T: HasFrequency,

Source§

fn play( &self, delay: Duration, length: Duration, fade_in: Duration, ) -> Result<PlaybackHandle, Error>

Plays the Playable.
Source§

impl<T> RuleType for T
where T: Copy + Debug + Eq + Hash + Ord,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V