Mercurial > hg > sonic-visualiser
diff audioio/PhaseVocoderTimeStretcher.cpp @ 26:d88d117e0c34
* Add mono timestretch toggle button; some more work on getting blocksize etc
parameters through to plugins
author | Chris Cannam |
---|---|
date | Mon, 18 Sep 2006 16:43:17 +0000 |
parents | e74f508db18c |
children | 37af203dbd15 |
line wrap: on
line diff
--- a/audioio/PhaseVocoderTimeStretcher.cpp Fri Sep 15 15:35:06 2006 +0000 +++ b/audioio/PhaseVocoderTimeStretcher.cpp Mon Sep 18 16:43:17 2006 +0000 @@ -39,11 +39,6 @@ { initialise(); - std::cerr << "PhaseVocoderTimeStretcher: channels = " << m_channels - << ", ratio = " << m_ratio - << ", n1 = " << m_n1 << ", n2 = " << m_n2 << ", wlen = " - << m_wlen << ", max = " << maxProcessInputBlockSize - << ", outbuflen = " << m_outbuf[0]->getSize() << std::endl; } PhaseVocoderTimeStretcher::~PhaseVocoderTimeStretcher() @@ -166,6 +161,17 @@ } m_transientThreshold = m_wlen / 4.5; + + m_totalCount = 0; + m_transientCount = 0; + m_n2sum = 0; + + + std::cerr << "PhaseVocoderTimeStretcher: channels = " << m_channels + << ", ratio = " << m_ratio + << ", n1 = " << m_n1 << ", n2 = " << m_n2 << ", wlen = " + << m_wlen << ", max = " << m_maxProcessInputBlockSize << std::endl; +// << ", outbuflen = " << m_outbuf[0]->getSize() << std::endl; } void @@ -516,10 +522,17 @@ bool isTransient = false; - if (count > m_transientThreshold && - count > m_prevTransientScore * 1.2) { +// if (count > m_transientThreshold && +// count > m_prevTransientScore * 1.2) { + if (count > m_prevTransientScore && + count > m_transientThreshold && + count - m_prevTransientScore > m_wlen / 20) { isTransient = true; - std::cerr << "isTransient (count = " << count << ", prev = " << m_prevTransientScore << ")" << std::endl; + + + std::cerr << "isTransient (count = " << count << ", prev = " << m_prevTransientScore << ", diff = " << count - m_prevTransientScore << ", ratio = " << (m_totalCount > 0 ? (float (m_n2sum) / float(m_totalCount * m_n1)) : 1.f) << ", ideal = " << m_ratio << ")" << std::endl; +// } else { +// std::cerr << " !transient (count = " << count << ", prev = " << m_prevTransientScore << ", diff = " << count - m_prevTransientScore << ")" << std::endl; } m_prevTransientScore = count;