Struct Notefinder

Source
pub struct Notefinder { /* private fields */ }

Implementations§

Source§

impl Notefinder

Source

pub fn new(samplerate: i32) -> Notefinder

Create a new instance of the Notefinder with the desired samplerate.

Samplerate can only be set during creation.

Source

pub fn run(&mut self, data: &[f32])

Run the notefinder over the provided buffer

Source

pub fn get_notes(&self) -> Vec<Note>

Get the discovered notes

Source

pub fn get_folded<'a>(&'a self) -> &'a [f32]

Source

pub fn set_dft_algorithm(&mut self, algo: DFTAlgorithm)

Use this to change the Discrete Fourier transform algorithm.

Options defined in DFTAlgorithm

Source

pub fn set_octaves( &self, octaves: i32, ) -> Result<(), NoteFinderValidationError<i32>>

Sets the span of octaves Defaults to 8

Source

pub fn set_frequency_bins( &self, frequency_bins: i32, ) -> Result<(), NoteFinderValidationError<i32>>

Defines the number of frequency bins Defaults to 24

Source

pub fn set_base_hz( &self, base_hz: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Set the base Hz for the notefinder to start at Defaults to 0

Source

pub fn set_filter_strength( &self, filter_strength: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Controls the strength of the filter Defaults to 0.5

Source

pub fn set_filter_iterations( &self, filter_iterations: i32, ) -> Result<(), NoteFinderValidationError<i32>>

Set filter iterations, the higher the better but does cost CPU Defaults to 1.

Source

pub fn set_decompose_iterations( &self, decompose_iterations: i32, ) -> Result<(), NoteFinderValidationError<i32>>

Set decompose iterations, defaults to 1000

Source

pub fn set_amplification( &self, amplification: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Amplify input across the board

Source

pub fn set_compress_exponent( &self, compress_exponent: f32, ) -> Result<(), NoteFinderValidationError<f32>>

How much to compress the sound by before putting it into the compressor.

Source

pub fn set_compress_coefficient( &self, compress_coefficient: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Exponent of the compressor lower = make more uniform.

Source

pub fn set_dft_speedup( &self, dft_speedup: f32, ) -> Result<(), NoteFinderValidationError<f32>>

At 300, there is still some minimal aliasing at higher frequencies. Increase this for less low-end distortion Defaults to 300

Source

pub fn set_dft_q( &self, dft_q: f32, ) -> Result<(), NoteFinderValidationError<f32>>

The “tightness” of the curve, or how many samples back to look? Defaults to 16

Source

pub fn set_default_sigma( &self, default_sigma: f32, ) -> Result<(), NoteFinderValidationError<f32>>

This controls the expected shape of the normal distributions. Defaults to 1.4

Author of Colorchord notes “I am not sure how to calculate this from samplerate, Q and bins.”

Source

pub fn set_note_jumpability( &self, note_jumpability: f32, ) -> Result<(), NoteFinderValidationError<f32>>

How far established notes are allowed to “jump” in order to attach themselves to a new “peak” Default 0.5

Source

pub fn set_note_combine_distance( &self, note_combine_distance: f32, ) -> Result<(), NoteFinderValidationError<f32>>

How close established notes need to be to each other before they can be “combined” into a single note. Defaults to 0.5

Source

pub fn set_slope( &self, slope: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Source

pub fn set_note_attach_freq_iir( &self, note_attach_freq_iir: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Source

pub fn set_note_attach_amp_iir( &self, note_attach_amp_iir: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Source

pub fn set_note_attach_amp_iir2( &self, note_attach_amp_iir2: f32, ) -> Result<(), NoteFinderValidationError<f32>>

Source

pub fn set_note_minimum_new_distribution_value( &self, note_minimum_new_distribution_value: f32, ) -> Result<(), NoteFinderValidationError<f32>>

A distribution must be /this/ big otherwise, it will be discarded. Defaults to 0.02

Source

pub fn set_note_out_chop( &self, note_out_chop: f32, ) -> Result<(), NoteFinderValidationError<f32>>

How much to decimate the output notes to reduce spurious noise

Source

pub fn set_dft_iir( &self, dft_iir: f32, ) -> Result<(), NoteFinderValidationError<f32>>

IIR (infinite impulse response) to impose the output of the IIR.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
where T: FloatComponent, Swp: WhitePoint, Dwp: WhitePoint, D: AdaptFrom<S, Swp, Dwp, T>,

Source§

fn adapt_into_using<M>(self, method: M) -> D
where M: TransformMatrix<Swp, Dwp, T>,

Convert the source color to the destination color using the specified method
Source§

fn adapt_into(self) -> D

Convert the source color to the destination color using the bradford method by default
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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T, U> IntoColor<U> for T
where U: FromColor<T>,

Source§

fn into_color(self) -> U

Convert into T with values clamped to the color defined bounds Read more
Source§

impl<T, U> IntoColorUnclamped<U> for T
where U: FromColorUnclamped<T>,

Source§

fn into_color_unclamped(self) -> U

Convert into T. The resulting color might be invalid in its color space 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<T, U> TryIntoColor<U> for T
where U: TryFromColor<T>,

Source§

fn try_into_color(self) -> Result<U, OutOfBounds<U>>

Convert into T, returning ok if the color is inside of its defined range, otherwise an OutOfBounds error is returned which contains the unclamped color. Read more