Further formant experiments
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user