From dfef60c4866aa8e161b7ab375f2a62eafd199d05 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Wed, 5 Apr 2023 11:51:26 +0100 Subject: [PATCH] Slacken some test expectations appropriately for non-builtin resampler, after reviewing the output --- src/test/TestStretcher.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/test/TestStretcher.cpp b/src/test/TestStretcher.cpp index 5b2352e..141e8a7 100644 --- a/src/test/TestStretcher.cpp +++ b/src/test/TestStretcher.cpp @@ -380,9 +380,11 @@ static void sinusoid_realtime(RubberBandStretcher::Options options, int slack = 0; if (options & RubberBandStretcher::OptionEngineFiner) { - if (options & RubberBandStretcher::OptionWindowShort) { + if (chunk == 19) { + slack = 5; + } else if (options & RubberBandStretcher::OptionWindowShort) { slack = 2; - } else if (chunk == 0 || chunk == 19 || highSpeedPitch) { + } else if (chunk == 0 || highSpeedPitch) { slack = 1; } } else { @@ -416,6 +418,8 @@ static void sinusoid_realtime(RubberBandStretcher::Options options, if (!(options & RubberBandStretcher::OptionEngineFiner) || (options & RubberBandStretcher::OptionWindowShort)) { maxUnder = 0.2; + } else if (chunk == 19) { + maxUnder = 0.15; } BOOST_TEST(rms - expected < maxOver); @@ -941,24 +945,24 @@ static void impulses_realtime(RubberBandStretcher::Options options, if (out[i] > max) { max = out[i]; peak2 = i; } } - // These limits aren't alarming, but it be worth tightening them - // and and taking a look at the waveforms + // These limits aren't alarming, but it may be worth tightening + // them and and taking a look at the waveforms BOOST_TEST(peak0 < int(ceil(200 * timeRatio))); BOOST_TEST(peak0 > int(ceil(50 * timeRatio))); BOOST_TEST(peak1 < int(ceil(5070 * timeRatio))); - BOOST_TEST(peak1 > int(ceil(4840 * timeRatio))); + BOOST_TEST(peak1 > int(ceil(4640 * timeRatio))); BOOST_TEST(peak2 < int(ceil(9970 * timeRatio))); BOOST_TEST(peak2 > int(ceil(9770 * timeRatio))); -/* - std::cout << "ms\tV" << std::endl; - for (int i = 0; i < n*2; ++i) { - std::cout << i << "\t" << out[i] << std::endl; + if (printDebug) { + std::cout << "#sample\tV" << std::endl; + for (int i = 0; i < n*2; ++i) { + std::cout << "#" << i << "\t" << out[i] << std::endl; + } } -*/ } BOOST_AUTO_TEST_CASE(impulses_slow_samepitch_realtime_finer)