* Avoid using STL map in process()!

* Exceptions in resampler
This commit is contained in:
Chris Cannam
2008-07-01 14:54:31 +00:00
parent c70480bb3c
commit 7e7e998ce5
4 changed files with 21 additions and 5 deletions

View File

@@ -839,16 +839,21 @@ RubberBandStretcher::Impl::formantShiftChunk(size_t channel)
const int sz = m_windowSize;
const int hs = m_windowSize/2;
const double denom = sz;
cd.fft->inverseCepstral(mag, dblbuf);
double denom = sz;
cd.fft->inverseCepstral(mag, dblbuf);
for (int i = 0; i < sz; ++i) {
dblbuf[i] /= denom;
}
//!!! calculate this value -- the divisor should be the highest fundamental frequency we expect to find, plus a bit
const int cutoff = m_sampleRate / 700;
// const int cutoff = 1000;
// const int cutoff = 20;
// cerr <<"cutoff = "<< cutoff << ", m_sampleRate/cutoff = " << m_sampleRate/cutoff << ", m_sampleRate/700 = " << m_sampleRate/700 << endl;
dblbuf[0] /= 2;
dblbuf[cutoff-1] /= 2;
@@ -859,6 +864,7 @@ RubberBandStretcher::Impl::formantShiftChunk(size_t channel)
cd.fft->forward(dblbuf, envelope, 0);
for (int i = 0; i <= hs; ++i) {
envelope[i] = exp(envelope[i]);
}
@@ -887,6 +893,7 @@ RubberBandStretcher::Impl::formantShiftChunk(size_t channel)
for (int i = 0; i <= hs; ++i) {
mag[i] *= envelope[i];
// mag[i] = envelope[i];
}
cd.unchanged = false;