diff --git a/tests/harmony_cpu_profile_test.cpp b/tests/harmony_cpu_profile_test.cpp index 3c700510b..caae5eacc 100644 --- a/tests/harmony_cpu_profile_test.cpp +++ b/tests/harmony_cpu_profile_test.cpp @@ -16,11 +16,15 @@ namespace { using Clock=std::chrono::steady_clock; constexpr int warmup=256; constexpr int measured=512; -void profile(double rate,int block,int voices,bool musicGuide=false){ +void profile(double rate,int block,int voices,bool musicGuide=false, + bool busyHighVibrato=false){ auto engine=std::make_unique(); if(!engine->prepare(rate)){std::cerr<<"Harmony prepare failed\n";std::exit(2);} armix::harmony::Settings settings; - settings.voices=voices;settings.wet=0.55f;settings.correction=true; + settings.voices=voices;settings.wet=0.75f; + // Compare former maximal lead-correction mode and real operator default + // (Pitch Tune OFF) on high harmonic-heavy backing. + settings.correction=!busyHighVibrato; settings.guideMode=musicGuide?1:0; settings.guideChannelId=musicGuide?770:0; armix::harmony::MusicKeyDetector guide; @@ -33,13 +37,28 @@ void profile(double rate,int block,int voices,bool musicGuide=false){ double phase=0.; // 35 cents sharp so the enabled lead shifter actually runs. const double step=6.283185307179586*220.*std::exp2(35./1200.)/rate; + constexpr double tau=6.283185307179586; for(int blockIndex=0;blockIndex(0.16*std::sin(phase)+ - 0.04*std::sin(2.*phase)); + const int absoluteSample=blockIndex*block+i; + const double t=static_cast(absoluteSample)/rate; + const double cents=72.*std::sin(tau*5.2*t); + const double highHz=880.*std::exp2(cents/1200.); + const float chorus=busyHighVibrato? + static_cast(std::clamp((t-.25)*12.,0.,1.)):0.f; + const float noisy=(busyHighVibrato && + absoluteSample%(static_cast(rate*.21))< + static_cast(rate*.014))? + .045f*static_cast((absoluteSample*829+41)%257-128)/128.f:0.f; + const float x=busyHighVibrato?static_cast( + (.18+.09*chorus)*(std::sin(phase)+.28*std::sin(2.*phase+.19)+ + .21*std::sin(3.*phase+.34)+ + .12*std::sin(4.*phase+.43))+noisy): + static_cast(.16*std::sin(phase)+.04*std::sin(2.*phase)); l[static_cast(i)]=x; - r[static_cast(i)]=x; + r[static_cast(i)]=busyHighVibrato? + x*.89f+static_cast(.017*std::sin(phase+.31)):x; if(musicGuide){ // Different ChannelId source; no music PCM mixed into vocal. // Exclude guide-tone fixture synthesis from timed callback. @@ -50,7 +69,7 @@ void profile(double rate,int block,int voices,bool musicGuide=false){ std::sin(6.283185307179586*329.627557*t)+ std::sin(6.283185307179586*391.995436*t))); } - phase+=step; + phase+=busyHighVibrato?tau*highHz/rate:step; if(phase>=6.283185307179586)phase-=6.283185307179586; } const auto started=Clock::now(); @@ -78,6 +97,9 @@ void profile(double rate,int block,int voices,bool musicGuide=false){ <<"Harmony synthetic ENGINE ONLY rate="<