Struct klib::core::note::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§

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 to identify the notes in the audio data using ML.

Trait Implementations§

source§

impl Add<Interval> for Note

§

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 copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
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 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§

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 · source§

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

Compares and returns the maximum of two values. Read more
1.21.0 · source§

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

Compares and returns the minimum of two values. Read more
1.50.0 · source§

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

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
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 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method 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 Sub<Interval> for Note

§

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 Sub for Note

§

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 ToUniversal for Note

source§

fn to_universal(self) -> Note

Converts this note to a universal pitch.
source§

impl Copy for Note

source§

impl Eq for Note

source§

impl StructuralEq for Note

source§

impl StructuralPartialEq for Note

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§

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
§

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

§

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

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

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.

§

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

§

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.
§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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
§

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

§

fn to_sample_(self) -> U

source§

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

source§

default 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>,

§

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>,

§

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.
§

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

§

fn vzip(self) -> V

source§

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

§

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

source§

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