|
Krotos Modules 3
|
A Sawtooth waveform inspired pitch estimator for speech and music. Paper: https://www.researchgate.net/publication/23558616_A_sawtooth_waveform_inspired_pitch_estimator_for_speech_and_music. More...
#include <SWIPE_PitchEstimation.h>
Public Member Functions | |
| SWIPE_PitchEstimation (const float sampleRate, const float timeStep, const float log2PitchStep, const float ERBStep, const float normOverlap, const float strenThresh) | |
| void | initVectors () |
| std::pair< Eigen::VectorXf, Eigen::VectorXf > | calculatePitchStrengthPairs (std::vector< float > &signal) |
| Eigen::VectorXf | getTimes () |
Private Member Functions | |
| Eigen::VectorXf | calculateLog2PitchCands (float log2PitchStep) |
| Eigen::VectorXf | calculatePitchCands (const Eigen::VectorXf &log2PitchCands) |
| std::pair< Eigen::VectorXf, Eigen::VectorXf > | selectCandidatesForWindowSize (size_t winSizeIDx) |
| Eigen::VectorXf | getERBsSubset (const Eigen::VectorXf &pitchCandsSubset) |
| Eigen::MatrixXf | pitchStrengthAllCandidates (const Eigen::VectorXf &ERBs, Eigen::MatrixXf &ERBsDistrValues, const Eigen::VectorXf &pitchCands) |
| Eigen::VectorXf | pitchStrengthOneCandidate (const Eigen::VectorXf &ERBS, const Eigen::MatrixXf &normERBsDistrValues, float pitchCand) |
| std::pair< Eigen::VectorXf, Eigen::VectorXf > | fineTunePitch (Eigen::MatrixXf globStrMatrix) |
| Eigen::VectorXi | primes (int n) |
| Eigen::MatrixXf | cumsum (const Eigen::MatrixXf &input) |
| Eigen::VectorXf | polyfit (const Eigen::VectorXf &x, const Eigen::VectorXf &y, int n) |
| Eigen::MatrixXf | computeN (const Eigen::MatrixXf &ERBsDistrValues) |
Private Attributes | |
| float | m_sampleRate {-1.0f} |
| float | m_timeStep {-1.0f} |
| float | m_log2PitchStep {-1.0f} |
| float | m_ERBStep {-1.0f} |
| float | m_normOverlap {-1.0f} |
| float | m_strenThresh {-1.0f} |
| Eigen::Vector2f | m_pitchLims |
| Eigen::VectorXf | m_times |
| Eigen::VectorXf | m_pitchCands |
| Eigen::VectorXf | m_winSizes |
| Eigen::VectorXf | m_log2DistWin1OptPitchAndPitchCands |
| Eigen::VectorXf | m_ERBs |
A Sawtooth waveform inspired pitch estimator for speech and music. Paper: https://www.researchgate.net/publication/23558616_A_sawtooth_waveform_inspired_pitch_estimator_for_speech_and_music.
Class representing the Harmonic Representation of an audio signal.
From the paper abstract: Sawtooth Waveform Inspired Pitch Estimator (SWIPE) has been developed for processing speech and music. SWIPE is shown to outperform existing algorithms on several publicly available speech/musical-instruments databases and a disordered speech database. SWIPE estimates the pitch as the fundamental frequency of the sawtooth waveform whose spectrum best matches the spectrum of the input signal. A decaying cosine kernel provides an extension to older frequency-based, sieve-type estimation algorithms by providing smooth peaks with decaying amplitudes to correlate with the harmonics of the signal. An improvement on the algorithm is achieved by using only the first and prime harmonics, which significantly reduces subharmonic errors commonly found in other pitch estimation algorithms.
TODO: REPLACE ALL VECTORS AND MATRIX AS WELL AS LINEAR ALGEBRA OPERATIONS WITH EIGEN!!!.
This class evaluates a spectrogram of the audio signal, estimates the fundamental pitches for all hop times, and optimizes and corrects the fundamental frequencies while evaluating the inharmonicity coefficient. This process yields the frequencies of the rest of the harmonic partials and all their amplitudes using the spectrogram.
| krotos::SWIPE_PitchEstimation::SWIPE_PitchEstimation | ( | const float | sampleRate, |
| const float | timeStep, | ||
| const float | log2PitchStep, | ||
| const float | ERBStep, | ||
| const float | normOverlap, | ||
| const float | strenThresh ) |
|
private |
Defines pitch candidates.
|
private |
| std::pair< Eigen::VectorXf, Eigen::VectorXf > krotos::SWIPE_PitchEstimation::calculatePitchStrengthPairs | ( | std::vector< float > & | signal | ) |
Estimates the pitch of the vector signal every timeStep seconds.
| signal | signal in time vector representation |
|
private |
|
private |
|
private |
The pitch is fine-tuned using parabolic interpolation with a resolution of 1 cent
|
private |
Used to compute loudness at ERBs uniformly-spaced frequencies.
|
inline |
Returns the vector of times at which the pitch was estimated.
| void krotos::SWIPE_PitchEstimation::initVectors | ( | ) |
Initialize vectors for intermediate calculations. Called in the constructor after initial parameters have been setup.
|
private |
|
private |
|
private |
Polynomial curve fitting.
| x | Query points.These correspond to the fitted function values contained in y |
| y | Fitted values at query points. The values in y correspond to the query points contained in x |
| n | Degree of polynomial fit |
|
private |
Vector/Linear algebra operations. TODO Move somewhere to be reused
|
private |
Select candidates that use a specific window size.
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
The pitch is searched within the range m_pitchLims(in Hertz)
|
private |
|
private |
|
private |
|
private |
|
private |