Constrain to +/- 2 octaves (+ semitones) as it's less demanding of block size; minor tidying

This commit is contained in:
Chris Cannam
2021-05-14 14:26:52 +01:00
parent a3aff961e4
commit a218ad42fa
4 changed files with 42 additions and 26 deletions

View File

@@ -64,7 +64,7 @@ const size_t
RubberBandStretcher::Impl::m_defaultFftSize = 2048;
int
RubberBandStretcher::Impl::m_defaultDebugLevel = 0;
RubberBandStretcher::Impl::m_defaultDebugLevel = 2;
static bool _initialised = false;
@@ -544,8 +544,8 @@ RubberBandStretcher::Impl::calculateSizes()
// ratio) for any chunk.
if (m_debugLevel > 0) {
cerr << "configure: time ratio = " << m_timeRatio << ", pitch scale = " << m_pitchScale << ", effective ratio = " << getEffectiveRatio() << endl;
cerr << "configure: analysis window size = " << m_aWindowSize << ", synthesis window size = " << m_sWindowSize << ", fft size = " << m_fftSize << ", increment = " << m_increment << " (approx output increment = " << int(lrint(m_increment * getEffectiveRatio())) << ")" << endl;
cerr << "calculateSizes: time ratio = " << m_timeRatio << ", pitch scale = " << m_pitchScale << ", effective ratio = " << getEffectiveRatio() << endl;
cerr << "calculateSizes: analysis window size = " << m_aWindowSize << ", synthesis window size = " << m_sWindowSize << ", fft size = " << m_fftSize << ", increment = " << m_increment << " (approx output increment = " << int(lrint(m_increment * getEffectiveRatio())) << ")" << endl;
}
if (std::max(m_aWindowSize, m_sWindowSize) > m_maxProcessSize) {
@@ -575,15 +575,17 @@ RubberBandStretcher::Impl::calculateSizes()
}
if (m_debugLevel > 0) {
cerr << "configure: outbuf size = " << m_outbufSize << endl;
cerr << "calculateSizes: outbuf size = " << m_outbufSize << endl;
}
}
void
RubberBandStretcher::Impl::configure()
{
// std::cerr << "configure[" << this << "]: realtime = " << m_realtime << ", pitch scale = "
// << m_pitchScale << ", channels = " << m_channels << std::endl;
if (m_debugLevel > 0) {
std::cerr << "configure[" << this << "]: realtime = " << m_realtime << ", pitch scale = "
<< m_pitchScale << ", channels = " << m_channels << std::endl;
}
size_t prevFftSize = m_fftSize;
size_t prevAWindowSize = m_aWindowSize;
@@ -745,7 +747,7 @@ RubberBandStretcher::Impl::configure()
// if (!m_realtime) {
if (m_debugLevel > 1) {
cerr << "Not real time mode: prefilling" << endl;
cerr << "Not real time mode: prefilling with " << m_aWindowSize/2 << " samples" << endl;
}
for (size_t c = 0; c < m_channels; ++c) {
m_channelData[c]->reset();
@@ -1373,12 +1375,12 @@ RubberBandStretcher::Impl::process(const float *const *input, size_t samples, bo
}
#endif
if (m_debugLevel > 2) {
if (m_debugLevel > 1) {
if (!allConsumed) cerr << "process looping" << endl;
}
}
if (m_debugLevel > 2) {
if (m_debugLevel > 1) {
cerr << "process returning" << endl;
}

View File

@@ -284,7 +284,7 @@ RubberBandStretcher::Impl::processChunks(size_t c, bool &any, bool &last)
while (!last) {
if (!testInbufReadSpace(c)) {
if (m_debugLevel > 2) {
if (m_debugLevel > 1) {
cerr << "processChunks: out of input" << endl;
}
break;
@@ -349,7 +349,7 @@ RubberBandStretcher::Impl::processOneChunk()
for (size_t c = 0; c < m_channels; ++c) {
if (!testInbufReadSpace(c)) {
if (m_debugLevel > 2) {
if (m_debugLevel > 1) {
cerr << "processOneChunk: out of input" << endl;
}
return false;
@@ -404,7 +404,7 @@ RubberBandStretcher::Impl::testInbufReadSpace(size_t c)
if (!m_threaded) {
#endif
if (m_debugLevel > 1) {
cerr << "WARNING: RubberBandStretcher: read space < chunk size ("
cerr << "Note: RubberBandStretcher: read space < chunk size ("
<< inbuf.getReadSpace() << " < " << m_aWindowSize
<< ") when not all input written, on processChunks for channel " << c << endl;
}