diff --git a/.github/workflows/harmony-fast-dsp.yml b/.github/workflows/harmony-fast-dsp.yml index cf4324086..a0c4e1168 100644 --- a/.github/workflows/harmony-fast-dsp.yml +++ b/.github/workflows/harmony-fast-dsp.yml @@ -5,6 +5,7 @@ on: paths: - 'engine/builtin_fx/Harmony*.h' - 'tests/harmony*.cpp' + - 'tools/harmony_offline_ab.cpp' - 'CMakeLists.txt' - '.github/workflows/harmony-fast-dsp.yml' permissions: diff --git a/tools/harmony_offline_ab.cpp b/tools/harmony_offline_ab.cpp index 1f987fd0b..74adc7daf 100644 --- a/tools/harmony_offline_ab.cpp +++ b/tools/harmony_offline_ab.cpp @@ -115,6 +115,28 @@ static Wave subtract(const Wave& x,const Wave& y){ } return z; } +// Auditable isolated BACKING roles from the *same* live native PCM DSP. +// Rebuild an independent engine for each role, using one five/singer planner +// and the identical dry lead, then set only that role's prepared output gains +// to zero for every other singer. No browser masks or in-place muting. +static Wave roleStem(const Wave& input,Settings settings, + int singerIndex,const Wave& dry){ + if(singerIndex<0||singerIndex>=Engine::maxVoices) + throw std::runtime_error("invalid solo Harmony role"); + auto e=std::make_unique(); + Engine::PreparedSettings prepared{}; + if(!e->prepare(input.rate)||!Engine::prepareSettings(settings,prepared)) + throw std::runtime_error("cannot prepare singer solo"); + for(int i=0;iapplyPreparedSettings(prepared)) + throw std::runtime_error("cannot apply singer solo"); + Wave out=input; + for(std::size_t pos=0;posprocess(out.left.data()+pos,out.right.data()+pos, + static_cast(std::min(std::size_t(127),out.left.size()-pos))); + return subtract(out,dry); +} static bool same(const Wave& x,const Wave& y){ if(x.left.size()!=y.left.size())return false; for(std::size_t i=0;i0.01&&rms(after)>0.01))return 2; + // Isolated LOW/MID/HIGH renders must recombine with the + // simultaneously rendered (unclipped) full wet backing, with + // only bounded float rounding in the shared linear room. + Settings dryVoiceSettings=s; + dryVoiceSettings.wet=0.f; + const auto dryRole=process(v,dryVoiceSettings,true); + const auto full=process(v,s,true); + const auto lowRole=roleStem(v,s,0,dryRole); + const auto midRole=roleStem(v,s,1,dryRole); + const auto highRole=roleStem(v,s,2,dryRole); + double parts=0.; + for(std::size_t i=0;i2.e-4f|| + std::abs(r-wholeR)>2.e-4f)return 6; + parts+=std::abs(highRole.left[i])+std::abs(highRole.right[i]); + } + if(!(parts>10.))return 7; s.wet=1.f;s.space=.6f;s.voices=4; const auto baseline=process(v,s,true,127,true,true,false); const auto boosted=process(v,s,true,127,true,true,true);