Further formant experiments

This commit is contained in:
Chris Cannam
2022-06-06 12:08:52 +01:00
parent c33582a8c4
commit baab6ae66e
2 changed files with 43 additions and 13 deletions

View File

@@ -223,15 +223,26 @@ protected:
struct FormantData {
bool enabled;
int fftSize;
FixedVector<double> cepstra;
FixedVector<double> envelope;
FixedVector<double> shifted;
FormantData(int _fftSize) :
enabled(false),
fftSize(_fftSize),
cepstra(_fftSize, 0.0),
envelope(_fftSize, 0.0),
shifted(_fftSize, 0.0) { }
double envelopeAt(double bin) const {
int b0 = int(floor(bin)), b1 = int(ceil(bin));
if (b1 == b0) return envelope.at(b0);
else {
double diff = bin - double(b0);
return envelope.at(b0) * (1.0 - diff) + envelope.at(b1) * diff;
}
}
};
Parameters m_parameters;