pub struct PYINExecutor<A>where
A: Float + FloatConst + FftNum + Add + Sub + Mul + MulAssign + DivAssign + NumAssign + ScalarOperand + MaybeNan + AbsDiffEq<Epsilon = A>,
<A as MaybeNan>::NotNan: Ord,{ /* private fields */ }Expand description
Implementations§
Source§impl<A> PYINExecutor<A>
impl<A> PYINExecutor<A>
Sourcepub fn set_boltzmann_parameter(&mut self, val: f64) -> &mut Self
pub fn set_boltzmann_parameter(&mut self, val: f64) -> &mut Self
shape parameter for the Boltzmann distribution prior over troughs. Larger values will assign more mass to smaller periods. (default: 2.0)
Sourcepub fn set_no_trough_prob(&mut self, val: A) -> &mut Self
pub fn set_no_trough_prob(&mut self, val: A) -> &mut Self
maximum probability to add to global minimum if no trough is below threshold. (default: 0.01)
Source§impl<A> PYINExecutor<A>
impl<A> PYINExecutor<A>
Sourcepub fn n_thresholds(&self) -> usize
pub fn n_thresholds(&self) -> usize
number of thresholds for peak estimation. (always returns 100)
Sourcepub fn beta_parameters(&self) -> (f64, f64)
pub fn beta_parameters(&self) -> (f64, f64)
shape parameters for the beta distribution prior over thresholds. (always returns (2.0, 18.0))
Sourcepub fn boltzmann_parameter(&self) -> f64
pub fn boltzmann_parameter(&self) -> f64
shape parameter for the Boltzmann distribution prior over troughs. Larger values will assign more mass to smaller periods. (default: 2.0)
Sourcepub fn max_transition_rate(&self) -> f64
pub fn max_transition_rate(&self) -> f64
maximum pitch transition rate in octaves per second. (always returns 35.92)
Sourcepub fn switch_prob(&self) -> A
pub fn switch_prob(&self) -> A
probability of switching from voiced to unvoiced or vice versa. (always returns 0.01)
Sourcepub fn no_trough_prob(&self) -> A
pub fn no_trough_prob(&self) -> A
maximum probability to add to global minimum if no trough is below threshold. (default: 0.01)
Source§impl<A> PYINExecutor<A>
impl<A> PYINExecutor<A>
Sourcepub fn new(
fmin: f64,
fmax: f64,
sr: u32,
frame_length: usize,
win_length: Option<usize>,
hop_length: Option<usize>,
resolution: Option<f64>,
) -> Self
pub fn new( fmin: f64, fmax: f64, sr: u32, frame_length: usize, win_length: Option<usize>, hop_length: Option<usize>, resolution: Option<f64>, ) -> Self
Create a new PYIN executor instance.
§Arguments
fmin- minimum frequency in Hzfmax- maximum frequency in Hzsr- sampling rate in Hzframe_length- frame length in sampleswin_length- length of the window for calculating autocorrelation in samples. (IfNone, defaults toframe_length/2)hop_length- number of audio samples between adjacent pYIN predictions. (IfNone, defaults toframe_length/4)resolution- Resolution of the pitch bins. should be0<resolution<1.0.01corresponds to cents.(IfNone, defaults to0.1)
Sourcepub fn pyin(
&mut self,
wav: &[A],
fill_unvoiced: A,
framing: Framing<A>,
) -> (Vec<f64>, Vec<A>, Vec<bool>, Vec<A>)
pub fn pyin( &mut self, wav: &[A], fill_unvoiced: A, framing: Framing<A>, ) -> (Vec<f64>, Vec<A>, Vec<bool>, Vec<A>)
Execute pYIN algorithm.
§Arguments
wav- audio signalfill_unvoiced- value to fill unvoiced frames. Typically, it is0.0or<A as Float>::nan().framing- where the first frame starts. Refer to Framing
§Returns
(timestamp: Array1<f64>, f0: Array1<A>, voiced_flag: Array1<bool>, voiced_prob: Array1<A>)
timestamp- contains the timestamp (in seconds) of each framesf0- contains estimated pitch in Hz. (If unvoiced, it isfill_unvoiced.)voiced_flag- contains whether each frame is voiced or unvoiced.voiced_prob- contains probability of each frame being voiced.
pub fn frame_to_sec(&self, i_frame: usize) -> f64
Trait Implementations§
Source§impl<A> Clone for PYINExecutor<A>
impl<A> Clone for PYINExecutor<A>
Source§fn clone(&self) -> PYINExecutor<A>
fn clone(&self) -> PYINExecutor<A>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl<A> Freeze for PYINExecutor<A>where
A: Freeze,
impl<A> !RefUnwindSafe for PYINExecutor<A>
impl<A> Send for PYINExecutor<A>
impl<A> Sync for PYINExecutor<A>
impl<A> Unpin for PYINExecutor<A>where
A: Unpin,
impl<A> !UnwindSafe for PYINExecutor<A>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.