From 448f2d469252c94b0ec3893c73a7d919855f4f4b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:54:22 +0700 Subject: [PATCH 01/15] dsp(sonku P8): keep original stereo LF pressure while highband remains measured directional HRTF; restore stereo room inputs --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 93 +++++++++++++++++++--- 1 file changed, 80 insertions(+), 13 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 010693f74..2925f22ad 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -99,6 +99,14 @@ class SonKuSpatialCore final { // realtime callback. Headphone low shelf ~180 Hz; no added latency. distanceSlew_=static_cast(1.-std::exp(-1./(rate*0.030))); bassSlew_=static_cast(1.-std::exp(-2.*3.14159265358979323846*180./rate)); +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + // P8 research: coherent LF pressure stays on its original stereo + // channel. Complementary first-order HP spatial field is derived + // from exactly the same sample-synchronous one-pole LP topology. + // No lookahead, latency, FFT or callback coefficient computation. + bassCrossoverAlpha_=static_cast( + 1.-std::exp(-2.*3.14159265358979323846*220./rate)); +#endif limiterRelease_=static_cast(1./(rate*0.080)); #if defined(SONKU_P71_DIRECT_XYZ_RESEARCH) && SONKU_P71_DIRECT_XYZ_RESEARCH // The special elevation control is not serialized or published to @@ -138,6 +146,11 @@ class SonKuSpatialCore final { smoothedErPresence_=1.f; smoothedTailPresence_=1.f; earBass_.fill(0.f); +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + originalBass_.fill(0.f); + binauralBass_.fill(0.f); + sideBass_=0.f; +#endif limiterGain_=1.f; write_=0; remaining_=0; @@ -269,6 +282,12 @@ class SonKuSpatialCore final { const float distanceGain=room_.relativeDistanceGain(); const bool nativeSpace=nativeSpaceEverUsed_; const bool roomEnabled=settings_.spacePreset!=0; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + const bool transparentBass= + room_.preparedProfile()==SonKuReflectionProfile::SixSurfaceKemarResearch; +#else + constexpr bool transparentBass=false; +#endif #if defined(SONKU_P75_MUSIC_SAFE_RESEARCH) && SONKU_P75_MUSIC_SAFE_RESEARCH // Field-failure quarantine, opt-in ONLY: spatialize the MUSIC MID // through one real measured center HRTF, keep stereo SIDE separated. @@ -318,9 +337,24 @@ class SonKuSpatialCore final { // 0° => 0.5x; 60° => 1x; >=90° => 1.25x (bounded). const float musicSideWidth=musicSafe? std::min(1.25f,.5f+settings_.stereoSpreadDegrees/120.f):1.f; - const float sideRescue=musicSafe? + float sideRescue=musicSafe? smoothedMix_*smoothedTrim_*musicSideWidth*preservedSide: .65f*smoothedMix_*smoothedTrim_*preservedSide; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + float originalLowL=0.f,originalLowR=0.f; + if(transparentBass){ + originalBass_[0]+=bassCrossoverAlpha_*(x0-originalBass_[0]); + originalBass_[1]+=bassCrossoverAlpha_*(x1-originalBass_[1]); + originalLowL=originalBass_[0]; + originalLowR=originalBass_[1]; + // P7.5's full-band SIDE return caused LF to be counted + // twice once the original bass is restored. Only the + // spatialized ABOVE-crossover SIDE may use the width bed. + sideBass_+=bassCrossoverAlpha_*(preservedSide-sideBass_); + sideRescue=smoothedMix_*smoothedTrim_*musicSideWidth* + (preservedSide-sideBass_); + } +#endif history_[0][write_]=x0; history_[1][write_]=x1; float ears[2]{0.f,0.f}; @@ -352,11 +386,14 @@ class SonKuSpatialCore final { } } const auto reflection=room_.active() - ?room_.process(musicSafe?inputMid:x0,musicSafe?inputMid:x1, - degrees_,musicSafe?0.f:settings_.stereoSpreadDegrees) + ?room_.process(transparentBass?x0:(musicSafe?inputMid:x0), + transparentBass?x1:(musicSafe?inputMid:x1), + degrees_,transparentBass?settings_.stereoSpreadDegrees: + (musicSafe?0.f:settings_.stereoSpreadDegrees)) :SonKuEarlyReflections::Ears{}; const auto late=reverb_.active() - ?reverb_.process(musicSafe?inputMid:x0,musicSafe?inputMid:x1) + ?reverb_.process(transparentBass?x0:(musicSafe?inputMid:x0), + transparentBass?x1:(musicSafe?inputMid:x1)) :SonKuMusicalReverb::Ears{}; if(!nativeSpace && settings_.outputTrim<=1.f && smoothedTrim_<=1.f) { @@ -403,20 +440,46 @@ class SonKuSpatialCore final { float spatialR=smoothedDistanceGain_*ears[1]+ smoothedErPresence_*reflection.right+ smoothedTailPresence_*late.right; - // Low-frequency KEMAR response is ~-7..-11 dB below 200Hz. - // A gentle bounded *binaural* shelf restores warmth without - // mixing dry mono under the HRIR or altering left/right ITD. - earBass_[0]+=bassSlew_*(spatialL-earBass_[0]); - earBass_[1]+=bassSlew_*(spatialR-earBass_[1]); - spatialL+=smoothedBassShelf_*earBass_[0]; - spatialR+=smoothedBassShelf_*earBass_[1]; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + if(transparentBass){ + // Decompose DIRECT HRTF only. Room returns remain true + // reflections, not low-pass input and not an EQ lift. + // LF stereo foundation is unaltered; at 0% MIX, bypass + // below is guaranteed to remain input-bit-exact. + binauralBass_[0]+=bassCrossoverAlpha_* + (ears[0]-binauralBass_[0]); + binauralBass_[1]+=bassCrossoverAlpha_* + (ears[1]-binauralBass_[1]); + spatialL=smoothedDistanceGain_* + (ears[0]-binauralBass_[0])+ + smoothedErPresence_*reflection.left+ + smoothedTailPresence_*late.left; + spatialR=smoothedDistanceGain_* + (ears[1]-binauralBass_[1])+ + smoothedErPresence_*reflection.right+ + smoothedTailPresence_*late.right; + }else +#endif + { + // Original shelf for legacy research and public parity. + earBass_[0]+=bassSlew_*(spatialL-earBass_[0]); + earBass_[1]+=bassSlew_*(spatialR-earBass_[1]); + spatialL+=smoothedBassShelf_*earBass_[0]; + spatialR+=smoothedBassShelf_*earBass_[1]; + } // GAIN is final full-output gain, not the old wet-only trim. // When ROOM OFF is reselected after a native scene, the // additional wet presence smoothly decays with its own engine. + const float musicLowL=transparentBass? + smoothedMix_*originalLowL:0.f; + const float musicLowR=transparentBass? + smoothedMix_*originalLowR:0.f; float outL=smoothedTrim_* - (dryLevel*x0+sceneBinauralLevel*smoothedRoomLevel_*spatialL)+sideRescue; + (dryLevel*x0+musicLowL+ + sceneBinauralLevel*(transparentBass?1.f:smoothedRoomLevel_)*spatialL)+sideRescue; float outR=smoothedTrim_* - (dryLevel*x1+sceneBinauralLevel*smoothedRoomLevel_*spatialR)-sideRescue; + (dryLevel*x1+musicLowR+ + sceneBinauralLevel*(transparentBass?1.f:smoothedRoomLevel_)*spatialR)-sideRescue; // Zero-lookahead *linked* sample-peak safety guard. Quiet // signals are linear; peaks are gently returned below unity // without routing through a second engine or allocating. @@ -557,6 +620,10 @@ class SonKuSpatialCore final { float smoothedBassShelf_=0.f,limiterGain_=1.f; float smoothedErPresence_=1.f,smoothedTailPresence_=1.f; std::array earBass_{}; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + std::array originalBass_{},binauralBass_{}; + float sideBass_=0.f,bassCrossoverAlpha_=0.f; +#endif float filterSlew_=0.f,levelSlew_=0.f; float distanceSlew_=0.f,bassSlew_=0.f,limiterRelease_=0.f; double sampleRate_=0.; From 11098cce549441996eb293e193b6d15e48cccef9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:54:59 +0700 Subject: [PATCH 02/15] fix(sonku P8): route ROOM OFF through LF transparency and keep 0%-wet dry output truly unaltered --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 2925f22ad..78d9907eb 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -395,7 +395,7 @@ class SonKuSpatialCore final { ?reverb_.process(transparentBass?x0:(musicSafe?inputMid:x0), transparentBass?x1:(musicSafe?inputMid:x1)) :SonKuMusicalReverb::Ears{}; - if(!nativeSpace && settings_.outputTrim<=1.f && + if(!transparentBass && !nativeSpace && settings_.outputTrim<=1.f && smoothedTrim_<=1.f) { // Preserve byte-for-byte original HRTF/old .smix output for // ROOM OFF and gain <= unity. Newly boosted GAIN > unity @@ -474,11 +474,13 @@ class SonKuSpatialCore final { smoothedMix_*originalLowL:0.f; const float musicLowR=transparentBass? smoothedMix_*originalLowR:0.f; - float outL=smoothedTrim_* - (dryLevel*x0+musicLowL+ + const float baseDryL=transparentBass?dryLevel*x0:0.f; + const float baseDryR=transparentBass?dryLevel*x1:0.f; + float outL=baseDryL+smoothedTrim_* + ((transparentBass?musicLowL:dryLevel*x0)+ sceneBinauralLevel*(transparentBass?1.f:smoothedRoomLevel_)*spatialL)+sideRescue; - float outR=smoothedTrim_* - (dryLevel*x1+musicLowR+ + float outR=baseDryR+smoothedTrim_* + ((transparentBass?musicLowR:dryLevel*x1)+ sceneBinauralLevel*(transparentBass?1.f:smoothedRoomLevel_)*spatialR)-sideRescue; // Zero-lookahead *linked* sample-peak safety guard. Quiet // signals are linear; peaks are gently returned below unity From a4ab0a3f669ed6f6f3bd8b186cc1044c4938e4f3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:55:52 +0700 Subject: [PATCH 03/15] build(sonku P8): compile-gate LF stereo transparency and identical native JUCE/PCM evidence fixture --- CMakeLists.txt | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a4f3482f3..5ea4fc092 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,15 @@ if(ARMIX_SONKU_EXPERIMENTAL_MUSIC_SAFE AND NOT ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT) message(FATAL_ERROR "P7.5 music-safe requires explicit native XYZ research ON") endif() +# Research-only P8 acoustic diagnostic. Does NOT change public LIGHT, +# shipping presets, or P7.5 without explicit operator build flags. +option(ARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS + "Enable P8 original stereo low-frequency pressure with measured high-band HRTF" + OFF) +if(ARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS AND + NOT ARMIX_SONKU_EXPERIMENTAL_MUSIC_SAFE) + message(FATAL_ERROR "P8 requires the isolated P7.5 music-safe research profile") +endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -217,7 +226,8 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:SONKU_P7_MEASURED_ELEVATION_RESEARCH=1> $<$:SONKU_P71_DIRECT_XYZ_RESEARCH=1> $<$:SONKU_P72_NATIVE_XYZ_RT=1> - $<$:SONKU_P75_MUSIC_SAFE_RESEARCH=1>) + $<$:SONKU_P75_MUSIC_SAFE_RESEARCH=1> + $<$:SONKU_P80_TRANSPARENT_BASS_RESEARCH=1>) if(WIN32) # Windows retains its proven ASIO-first / WASAPI / static WebView2 distribution. # Never link Windows loader or sound APIs into macOS/Linux builds. @@ -348,6 +358,23 @@ if(BUILD_TESTING) SONKU_P75_MUSIC_SAFE_RESEARCH=1) add_test(NAME NativeSonKuP75MusicStereoPhaseNoNullAndChunkParity COMMAND ARMixSonKuP75MusicIntegrityTests) + if(ARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS) + # The native JUCE adapter and the PCM fixture must compile identical + # P8 DSP flags. The default P7.5/ship branch retains its original DSP. + target_compile_definitions(ARMixSonKuP72NativeTests PRIVATE + SONKU_P80_TRANSPARENT_BASS_RESEARCH=1) + add_executable(ARMixSonKuP80TonalEvidenceTests + tests/sonku_p80_tonal_room_evidence_test.cpp) + target_compile_features(ARMixSonKuP80TonalEvidenceTests PRIVATE cxx_std_20) + target_compile_definitions(ARMixSonKuP80TonalEvidenceTests PRIVATE + SONKU_P7_MEASURED_ELEVATION_RESEARCH=1 + SONKU_P71_DIRECT_XYZ_RESEARCH=1 + SONKU_P72_NATIVE_XYZ_RT=1 + SONKU_P75_MUSIC_SAFE_RESEARCH=1 + SONKU_P80_TRANSPARENT_BASS_RESEARCH=1) + add_test(NAME NativeSonKuP80TransparentBassStereoPhaseAndRoomDiagnostic + COMMAND ARMixSonKuP80TonalEvidenceTests) + endif() endif() endif() # Pure control-plane first-run routing selection: no JUCE, drivers, From a158e5e92c580be2a90c947f5f21ab717c1fc81f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:56:15 +0700 Subject: [PATCH 04/15] fix(sonku P8): compile-safe no-op low-band symbols when experiment disabled --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 78d9907eb..6b505d2ce 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -340,8 +340,8 @@ class SonKuSpatialCore final { float sideRescue=musicSafe? smoothedMix_*smoothedTrim_*musicSideWidth*preservedSide: .65f*smoothedMix_*smoothedTrim_*preservedSide; -#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH float originalLowL=0.f,originalLowR=0.f; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH if(transparentBass){ originalBass_[0]+=bassCrossoverAlpha_*(x0-originalBass_[0]); originalBass_[1]+=bassCrossoverAlpha_*(x1-originalBass_[1]); From 1db0368f16c66674b204ab3aead3dbd14a33df23 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:57:52 +0700 Subject: [PATCH 05/15] test(sonku P8): objective 1/3-octave-like frequency sweep, LF stereo preservation, room tail and block parity --- tests/sonku_p80_tonal_room_evidence_test.cpp | 182 +++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 tests/sonku_p80_tonal_room_evidence_test.cpp diff --git a/tests/sonku_p80_tonal_room_evidence_test.cpp b/tests/sonku_p80_tonal_room_evidence_test.cpp new file mode 100644 index 000000000..6e1fc8a3a --- /dev/null +++ b/tests/sonku_p80_tonal_room_evidence_test.cpp @@ -0,0 +1,182 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// P8.0: objective source/processed evidence from the EXACT real SonKu core. +// Synthetic tonal diagnostic, NOT a perceptual/dearVR qualification. +#if defined(NDEBUG) +#undef NDEBUG +#endif +#if !defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) || !SONKU_P80_TRANSPARENT_BASS_RESEARCH +#error Must compile the P8 acoustic research renderer +#endif +#include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include +#include +#include +#include +#include +#include + +using armix::sonku::Settings; +using armix::sonku::SonKuSpatialCore; +using armix::sonku::SonKuReflectionProfile; +constexpr float pi=3.14159265358979323846f; +constexpr auto research=SonKuReflectionProfile::SixSurfaceKemarResearch; + +static std::unique_ptr make(double rate,const Settings& s){ + auto p=std::make_unique(); + assert(p->prepare(rate,research)); + assert(p->setSettings(s)); + return p; +} +static Settings scene(){ + Settings s{}; + s.startAzimuthDegrees=0.f;s.stereoSpreadDegrees=60.f; + s.spatialMix=1.f;s.outputTrim=.75f;s.moving=false; + s.spacePreset=0;s.roomAmount=.55f;s.ambience=.30f; + return s; +} +static void exactDryBypass(double rate){ + auto s=scene();s.spatialMix=0.f;s.outputTrim=.28f; + auto core=make(rate,s); + constexpr int n=1024; + std::vector l(n),r(n); + for(int i=0;iprocess(l.data(),r.data(),n); + for(int i=0;i l(n),r(n); + for(int i=0;i(rate)) + +.11f*std::sin(2.f*pi*3150.f*i/static_cast(rate)); + l[i]=x;r[i]=-x; + } + const auto input=l; + core->process(l.data(),r.data(),n); + double p=0.,expected=0.; + for(int i=0;i.07*expected); + } +} +static double toneGain(double rate,float hz,bool leftOnly,bool roomOn) { + auto s=scene(); + if(roomOn){s.spacePreset=1;s.roomAmount=.7f;s.ambience=.4f;} + auto core=make(rate,s); + constexpr int n=16384; + std::vector l(n),r(n); + for(int i=0;i(rate)); + l[i]=x;r[i]=leftOnly?0.f:x; + } + auto original=l; + core->process(l.data(),r.data(),n); + double incoming=0.,outL=0.,outR=0.,maxPeak=0.; + for(int i=n/2;i( + std::max(std::abs(l[i]),std::abs(r[i])))); + assert(std::isfinite(l[i])&&std::isfinite(r[i])); + } + const double gain=std::sqrt(outL/(incoming+1e-18)); + const double right=std::sqrt(outR/(incoming+1e-18)); + std::printf("P8_EVIDENCE,%.0f,%.0f,%s,%s,%.4f,%.4f,%.4f\n", + rate,static_cast(hz),leftOnly?"hard-left":"mono", + roomOn?"room":"direct",gain,right,maxPeak); + assert(maxPeak<.99); + return gain; +} +static void roomHasActualTimedTail(double rate){ + auto off=scene(),on=off; + on.spacePreset=1;on.roomAmount=.85f;on.ambience=.7f; + auto dry=make(rate,off),room=make(rate,on); + constexpr int n=16384; + std::vector l(n),r(n),a(n),b(n); + l[0]=r[0]=a[0]=b[0]=.20f; + dry->process(l.data(),r.data(),n); + room->process(a.data(),b.data(),n); + double dryLate=0.,roomLate=0.,roomSecond=0.; + for(int i=0;i1800){ + dryLate+=l[i]*l[i]+r[i]*r[i]; + roomLate+=a[i]*a[i]+b[i]*b[i]; + } + if(i>4000)roomSecond+=a[i]*a[i]+b[i]*b[i]; + } + std::printf("P8_ROOM,%.0f,dry_after_1800=%.9f,room_after_1800=%.9f,late_after_4000=%.9f\n", + rate,dryLate,roomLate,roomSecond); + assert(dryLate<1.e-12); + assert(roomLate>1.e-9); + assert(roomSecond>1.e-12); +} +static void roomChunkParity(double rate) { + auto s=scene(); + s.spacePreset=1;s.roomAmount=.6f;s.ambience=.4f; + s.moving=true;s.startAzimuthDegrees=45.f; + s.directElevationDegrees=15.f; + auto whole=make(rate,s),chunk=make(rate,s); + constexpr int n=8192; + std::vector a(n),b(n),c(n),d(n); + for(int i=0;i(rate)); + const float side=.07f*std::sin(2.f*pi*2500.f*i/static_cast(rate)); + a[i]=c[i]=mid+side;b[i]=d[i]=mid-side; + } + whole->process(a.data(),b.data(),n); + for(int i=0;iprocess(c.data()+i,d.data()+i,k); + i+=k; + } + for(int i=0;i.02&&left>.02); + if(hz<=125.f){ + // Musical bass must not vanish when no ROOM is active. + // Measured numerical threshold deliberately below dry -6dB; + // per-direction/real-music fidelity is a later gate. + assert(mono>.35); + assert(left>.35); + } + } + roomHasActualTimedTail(rate); + roomChunkParity(rate); + } + std::puts("PASS P8: unaltered dry, stereo LF+HF anti-phase exact at 60deg, per-band evidence, timed 3D room and PCM partition invariance"); +} From 95b71611492061a5a5dd08e16c52d30877ccdf88 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:58:26 +0700 Subject: [PATCH 06/15] bridge(sonku P8): expose physical experimental LF transparency only via accepted native snapshot --- src/Main.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Main.cpp b/src/Main.cpp index e3090f74e..3f7c73889 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3040,6 +3040,11 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr if(processor && processor->preparedReflectionProfile()== armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) reply->setProperty("musicSafeStereo",true); +#endif +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + if(processor && processor->preparedReflectionProfile()== + armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) + reply->setProperty("p8TransparentBass",true); #endif if(processor) { reply->setProperty("settings", From 34bf225becbca99410e604cbbac19cd0aca7834a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 20:58:55 +0700 Subject: [PATCH 07/15] ux(sonku P8): clearly identify the real opt-in transparent-stereo-bass native research render --- site/preview-v2/assets/mixer-native-sonku.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 07fd02a61..bff33a351 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -173,7 +173,7 @@ const depthLayers={far:$("skFarSources"),near:$("skNearSources")}; const mount=()=>{if(!root.isConnected)document.body.append(root)}; if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",mount,{once:true});else mount(); let current=null,accepted=defaults(),draft=defaults(),pending=null,latest=null, - xyzCapable=false,musicSafeStereo=false, + xyzCapable=false,musicSafeStereo=false,p8TransparentBass=false, readId="",readSentAt=0,seq=1,clock=null,frame=null,observed=0,observedAt=0, drag=null,dialDrag=null,rangeEdits=new Set(),gestureStart=new Map(), visualPhase=0,visualAt=0,liveTimer=null,lastLiveAt=0; @@ -231,8 +231,9 @@ function render(){ if(!rangeEdits.has("skElevation"))elevation.value=String(s.directElevationDegrees); $("skElevationValue").textContent=s.directElevationDegrees.toFixed(1)+"°"; } - root.querySelector(".sk-stage-caption").textContent=musicSafeStereo - ?"HEADPHONES · MEASURED CENTER 3D HRTF + MUSIC SIDE · EXPERIMENT" + root.querySelector(".sk-stage-caption").textContent=p8TransparentBass + ?"HEADPHONES · P8 STEREO BASS + MEASURED 3D HRTF · EXPERIMENT" + :musicSafeStereo?"HEADPHONES · MEASURED CENTER 3D HRTF + MUSIC SIDE · EXPERIMENT" :xyzCapable?"HEADPHONES · MEASURED 3D HRIR · 44.1 / 48 kHz" :"HEADPHONES · HRIR 0° ELEVATION · 44.1 / 48 kHz"; $("skSpread").closest("label").querySelector(".sk-param-name").textContent= @@ -253,7 +254,8 @@ function render(){ // redrawn at 60 Hz. The native audio callback remains the time authority. drawSpeakers(); $("skMode").textContent=native()?(context()? - (musicSafeStereo?"NATIVE MUSIC SAFE · RESEARCH":"NATIVE HRTF"): + (p8TransparentBass?"NATIVE P8 ACOUSTICS · RESEARCH": + musicSafeStereo?"NATIVE MUSIC SAFE · RESEARCH":"NATIVE HRTF"): "NATIVE UNAVAILABLE"):"VISUAL ONLY · NO AUDIO"; } function drawSpeakers(){ @@ -400,6 +402,7 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ // Activation happens only after a fully identity-bound native readback. xyzCapable=measured; musicSafeStereo=measured && r.musicSafeStereo===true; + p8TransparentBass=musicSafeStereo && r.p8TransparentBass===true; readId="";readSentAt=0; if(pending) { if(!pending.ack || r.appliedRequestId!==pending.requestId){ @@ -422,7 +425,7 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ } render(); }); -$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;musicSafeStereo=false; +$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;musicSafeStereo=false;p8TransparentBass=false; cancelLiveTimer();pending=null;latest=null;readId="";readSentAt=0;dialDrag=null; drag=null;rangeEdits.clear();gestureStart.clear();lastLiveAt=0; if(clock!==null){clearInterval(clock);clock=null;} @@ -575,7 +578,7 @@ const api={ cancelLiveTimer();pending=null;latest=null;readId="";readSentAt=0;dialDrag=null; observedAt=0;visualAt=0;visualPhase=0;lastLiveAt=0; drag=null;rangeEdits.clear();gestureStart.clear(); - accepted=defaults();draft=defaults();xyzCapable=false;musicSafeStereo=false; + accepted=defaults();draft=defaults();xyzCapable=false;musicSafeStereo=false;p8TransparentBass=false; current={track,slot,instanceId:null}; const s=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(track); const fx=s?.graph?.channels?.find(x=>x.id===id)?.inserts?.[slot]; From a820d956f8ec5c2e0b6919947be75a339296cb53 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:00:00 +0700 Subject: [PATCH 08/15] docs(sonku P8): isolate bass/room physical trial from unproven dearVR acoustic parity --- ..._STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md diff --git a/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md b/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md new file mode 100644 index 000000000..6a0702903 --- /dev/null +++ b/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md @@ -0,0 +1,23 @@ +# SonKu P8.0 — Acoustic objective evidence and stereo-bass field test + +**Experimental only. NOT dearVR-equivalent or approved for public release.** +User headphone feedback: P7.4 severe stereo cancellation; P7.5 shrill/prominent mid, thin bass, flat room, weak natural externalization. + +## Code changes and limits +- Only opt-in `ARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS=ON` together with P7.5 and native XYZ research. The default LIGHT/public plugin is untouched. +- Preserve original channel-specific low-frequency pressure through a prepared 220 Hz complementary one-pole crossover, while spatializing its remaining upper band through the measured center KEMAR HRTF. This is **not** a guessed +dB bass boost, but an original-signal transparency path. +- Return the highpass-only SIDE in the P7.5 protection bed, never doubling low frequency after restoring original L/R. At WIDTH 60° and ROOM OFF, a fully inverted stereo program should pass through at exact user trim without cancellation. +- Use actual x0/x1 stereo source inputs for the six physical early reflection images and the eight-line late diffuse field (instead of two duplicated MID inputs). Their room size/delay and source angular spread now follow the two inputs; sound-quality realism and rearward localization still need independent headphone evaluation. +- Remove prior shelf on the new experimental path so ROOM ON/OFF cannot activate a spectral boost. Dry-only MIX=0 should be mathematically exact independent of GAIN. +- No FFT, allocations, locks, background worker, extra bridge graph, or extra per-insert data movement in the realtime callback. Original KEMAR 140-tap FIR and native JUCE/ACK persist. +- **Still not a fully spatialized stereo object renderer:** above-crossover stereo SIDE remains a direct width bed. This is a targeted bass/room diagnostic milestone, not completion of P8.1 or P8.2. + +## Bench and acceptance +- `tests/sonku_p80_tonal_room_evidence_test.cpp` records per-signal RMS transfer vs 63/125/250/500/1k/2k/4k/8k at 44.1 and 48k; hard-left and dual-mono; room OFF and ROOM ON impulse energy. It enforces finite, nonclipped samples, dry bypass equivalence, anti-phase energy, width 60° exact anti-phase waveform, room late tail and chunk partition parity. +- Log the source SHA and compile flags; ensure CTest source fixture and native JUCE adapter share P8 flag. Output metrics from synthetic waves are diagnostic ONLY, not target equalization, no real-music spectral score, no headphone claim. +- For safe physical evaluation: use **new isolated Windows tester**, start with **headphone volume low**, one P8 SonKu insert, ROUTE MAIN confirmed, Master Mono OFF, ROOM OFF, ORBIT OFF, SPATIAL MIX 100%, SIDE WIDTH 60°, GAIN -6 dB. Compare true plugin bypass vs P8 ROOM OFF, then ROOM Square 7.2m with Reflections 55 and Ambience 30, and afterwards dearVR with Bass Boost OFF and Clarity reported. Same licensed local track, output level matched and identical headphones/ASIO. +- A/B on (1) bass-heavy stereo drums/bass, (2) vocals, (3) acoustic reverb tails, (4) hard-left signal, (5) anti-phase high frequency and (6) wide chorus; *record source/output PCM dry and wet* if still thin, nasal or flat. If bypass itself sounds wrong, inspect channel mode and WIRE/MAIN/ASIO mapping first. +- Do NOT publish a Windows release or merge the original draft P7.4/P7.5 simply because synthetic CI passes. Further P8.1 full stereo positioning and P8.2 reference-calibrated broadband room remain mandatory for any dearVR-comparable claim. +- MIT KEMAR attribution in `docs/THIRD_PARTY_8D_SONKU_HRTF.md` is required in physical artifacts. + +Architecture gate: `docs/SONKU_P8_DEARVR_BENCHMARK_ACOUSTIC_ARCHITECTURE_20261114.md`. The goal is original, independent implementations benchmarked to dearVR, not copying proprietary IR/Clarity algorithms. From 4b48556c3d9e2b65198b3d9c1ed6bd95e420cb52 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:01:16 +0700 Subject: [PATCH 09/15] ci(sonku P8): objective PCM acoustic transfer evidence gate plus native Windows portable --- .../sonku-p80-acoustic-windows-field.yml | 214 ++++++++++++++++++ 1 file changed, 214 insertions(+) create mode 100644 .github/workflows/sonku-p80-acoustic-windows-field.yml diff --git a/.github/workflows/sonku-p80-acoustic-windows-field.yml b/.github/workflows/sonku-p80-acoustic-windows-field.yml new file mode 100644 index 000000000..4ec2dbd8a --- /dev/null +++ b/.github/workflows/sonku-p80-acoustic-windows-field.yml @@ -0,0 +1,214 @@ +name: SonKu P8.0 measurable stereo-bass and room native field candidate +# Isolated opt-in full JUCE app build; no public installer, tag or release. +on: + pull_request: + types: [opened, reopened, synchronize] + paths: + - '.github/workflows/sonku-p80-acoustic-windows-field.yml' + - 'src/Main.cpp' + - 'src/SonKuNativeBridgeContract.h' + - 'src/LiveAudioEngine.h' + - 'engine/builtin_fx/SonKuSpatialProcessor.h' + - 'engine/builtin_fx/sonku/**' + - 'site/preview-v2/assets/mixer-native-sonku.js' + - 'CMakeLists.txt' + - 'tests/sonku_p72_*' + - 'tests/sonku_p75_*' + - 'tests/sonku_p80_*' + workflow_dispatch: +permissions: + contents: read +concurrency: + group: sonku-p80-physical-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + preflight: + name: Isolated fast PCM and GUI preflight + runs-on: ubuntu-latest + timeout-minutes: 8 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + - name: Native JS and source GUI capability checks + run: | + set -euo pipefail + node --check site/preview-v2/assets/mixer-native-sonku.js + node tests/sonku_p73_gui_contract_test.js + grep -q "'FIELD_PREVIEW_FULL_CTEST_NOT_RUN'" scripts/m3e_fat_evidence_gate.mjs + python -m unittest discover -s tests -p native_peq_assembly_test.py + - name: 44.1 and 48 kHz prepared PCM source regression + run: | + set -euo pipefail + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + tests/sonku_p72_realtime_xyz_test.cpp -o /tmp/sonku-p75-pcm + /tmp/sonku-p75-pcm + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + tests/sonku_p75_stereo_integrity_test.cpp -o /tmp/sonku-p75-music + /tmp/sonku-p75-music + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + -DSONKU_P80_TRANSPARENT_BASS_RESEARCH=1 \ + tests/sonku_p80_tonal_room_evidence_test.cpp -o /tmp/sonku-p80-evidence + /tmp/sonku-p80-evidence | tee /tmp/sonku-p80-acoustic-evidence.csv + grep -q '^PASS P8:' /tmp/sonku-p80-acoustic-evidence.csv + windows-field: + name: Actual full Windows JUCE executable and verified portable field ZIP + needs: preflight + runs-on: windows-2022 + timeout-minutes: 55 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + - name: Verify immutable PR head and physical candidate identity + shell: pwsh + env: + EXPECTED_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + $actual = (& git rev-parse HEAD).Trim() + if ($LASTEXITCODE -ne 0 -or $actual -ne $env:EXPECTED_SHA -or $actual -notmatch '^[0-9a-f]{40}$') { + throw "SONKU_P80_SOURCE_MISMATCH:$actual" + } + Write-Host "SONKU_P75_EXACT_SOURCE=$actual" + - uses: actions/checkout@v4 + with: + repository: juce-framework/JUCE + ref: 8.0.15 + path: third_party/JUCE + persist-credentials: false + - name: Obtain pinned WebView2 compilation SDK + shell: pwsh + run: | + nuget install Microsoft.Web.WebView2 -Version 1.0.3485.44 -OutputDirectory .deps -NonInteractive + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Configure full native app with research XYZ explicit ON + shell: pwsh + run: | + cmake -S . -B build -G "Visual Studio 17 2022" -A x64 ` + -DJUCE_ROOT="$env:GITHUB_WORKSPACE/third_party/JUCE" ` + -DJUCE_WEBVIEW2_PACKAGE_LOCATION="$env:GITHUB_WORKSPACE/.deps" ` + -DARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_MUSIC_SAFE=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS=ON ` + -DBUILD_TESTING=ON + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $cache = Get-Content -LiteralPath build/CMakeCache.txt -Raw + if ($cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_MUSIC_SAFE:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS:BOOL=ON') { + throw "SONKU_P80_RESEARCH_NOT_ENABLED" + } + $tests = (& ctest --test-dir build -C Release --show-only=json-v1 | Out-String | ConvertFrom-Json) + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $required = @('NativeSonKuP72AtomicXyzLiveEditSource', + 'NativeSonKuP72JuceV3XyzLiveAckV1V2Restore', + 'NativeSonKuSessionV1V2AndAudioAppliedAck', + 'NativeSonKuP75MusicStereoPhaseNoNullAndChunkParity', + 'NativeSonKuP80TransparentBassStereoPhaseAndRoomDiagnostic') + $available = @($tests.tests | ForEach-Object { $_.name }) + foreach ($test in $required) { + if ($test -notin $available) { throw "SONKU_P80_MISSING_CTEST:$test" } + } + - name: Compile actual ARMixConsole Windows GUI and focused real JUCE tests + shell: pwsh + run: | + cmake --build build --config Release --parallel 2 --target ` + ARMixConsole ARMixSonKuP72SourceTests ARMixSonKuP72NativeTests ARMixSonKuNativeStateTests ARMixSonKuP75MusicIntegrityTests ARMixSonKuP80TonalEvidenceTests + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $exe = 'build/ARMixConsole_artefacts/Release/AR MIX Studio.exe' + if (-not (Test-Path -LiteralPath $exe -PathType Leaf)) { throw "SONKU_P75_NO_GUI_EXE" } + if ((Get-Item -LiteralPath $exe).Length -lt 4MB) { throw "SONKU_P75_WRONG_GUI_TARGET" } + - name: Scoped native XYZ state, callback ACK and legacy restoration + shell: pwsh + run: | + ctest --test-dir build -C Release --output-on-failure ` + -R '^NativeSonKu(P72AtomicXyzLiveEditSource|P72JuceV3XyzLiveAckV1V2Restore|SessionV1V2AndAudioAppliedAck|P75MusicStereoPhaseNoNullAndChunkParity|P80TransparentBassStereoPhaseAndRoomDiagnostic)$' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Package real native portable mixer, never an installer + shell: pwsh + run: | + & ./scripts/package_native_windows.ps1 -BuildDir build -OutputDir dist + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + python scripts/factoryfx_release_bundle.py stage --lock config/factoryfx-approved-releases.json --output dist --best-effort + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Record exact experiment and physical qualification pending + shell: pwsh + run: | + $path = 'dist/BUILD_PROVENANCE.json' + $p = Get-Content -LiteralPath $path -Raw -Encoding utf8 | ConvertFrom-Json + $sha = (& git rev-parse HEAD).Trim() + if ($p.sourceCommit -ne $sha) { throw "SONKU_P80_ARTIFACT_SHA_MISMATCH" } + $p.fatStatus = 'FIELD_PREVIEW_FULL_CTEST_NOT_RUN' + $p | Add-Member -NotePropertyName sonkuExperiment -NotePropertyValue @{ + enabled = $true + nativeXYZ = $true + musicSafeStereo = $true + p8TransparentBass = $true + p8LowBandCrossoverHz = 220 + musicSafeAlgorithm = 'MEASURED_CENTER_MID_PLUS_UNCONDITIONAL_STEREO_SIDE_RESEARCH' + stateSchema = 3 + fullWindowsExecutable = $true + publicRelease = $false + physicalAsioQualified = $false + dearVrPerceptualParityProven = $false + qualification = 'SONKU_P80_FULL_JUCE_APP_5_SCOPED_CTEST_PASS_REAL_ASIO_LISTENING_PENDING' + licenseRedistributionApproval = $false + mitKemarNoticeSha256 = (Get-FileHash -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Algorithm SHA256).Hash.ToLowerInvariant() + fieldFatGuideSha256 = (Get-FileHash -LiteralPath docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md -Algorithm SHA256).Hash.ToLowerInvariant() + } -Force + $p | ConvertTo-Json -Depth 20 | Set-Content -LiteralPath $path -Encoding utf8 + - name: Independent GUI PE, approved resources, provenance and ZIP verification + shell: pwsh + run: | + & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $p = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json + if (-not $p.sonkuExperiment.enabled -or + -not $p.sonkuExperiment.musicSafeStereo -or + -not $p.sonkuExperiment.p8TransparentBass -or + $p.sonkuExperiment.stateSchema -ne 3 -or $p.sonkuExperiment.publicRelease) { + throw 'SONKU_P75_WRONG_FIELD_ARTIFACT' + } + - name: Include mandatory MIT KEMAR notice and physical FAT guide + shell: pwsh + run: | + # Standard distribution allowlist was verified above. Field-only notice. + Copy-Item -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Destination dist/THIRD_PARTY_8D_SONKU_HRTF.md + Copy-Item -LiteralPath docs/SONKU_P75_PHYSICAL_AUDIO_FAILURE_FIX_20261114.md -Destination dist/SONKU_P80_FIELD_FAT.md + $p = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json + $checks = @{ + 'THIRD_PARTY_8D_SONKU_HRTF.md' = [string]$p.sonkuExperiment.mitKemarNoticeSha256 + 'SONKU_P80_FIELD_FAT.md' = [string]$p.sonkuExperiment.fieldFatGuideSha256 + } + foreach ($item in $checks.GetEnumerator()) { + $file = Join-Path dist $item.Key + if ($item.Value -notmatch '^[0-9a-f]{64}$' -or + -not (Test-Path -LiteralPath $file -PathType Leaf)) { + throw "SONKU_P75_FIELD_NOTICE_MISSING:$($item.Key)" + } + $actual = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() + if ($actual -ne $item.Value) { throw "SONKU_P75_FIELD_NOTICE_HASH_MISMATCH:$($item.Key)" } + } + if (Test-Path -LiteralPath dist/Studio) { throw 'SONKU_FIELD_USER_DATA_MUST_NOT_SHIP' } + Write-Host 'SONKU_P75_FIELD_READY: GUI EXE + verified MIT notice + FAT guide' + - uses: actions/upload-artifact@v4 + name: Upload isolated SonKu Windows x64 field candidate + with: + name: ArSonMix-SonKu-P80-Bass-Room-Research-Windows-x64-${{ github.run_id }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0 From 7c71abfc6b6f73bf9282a5f64d64de9cefdfd049 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:02:56 +0700 Subject: [PATCH 10/15] test(sonku P8): respect clickless MIX smoothing before asserting bit-exact settled dry bypass --- tests/sonku_p80_tonal_room_evidence_test.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/sonku_p80_tonal_room_evidence_test.cpp b/tests/sonku_p80_tonal_room_evidence_test.cpp index 6e1fc8a3a..74bb7f30a 100644 --- a/tests/sonku_p80_tonal_room_evidence_test.cpp +++ b/tests/sonku_p80_tonal_room_evidence_test.cpp @@ -37,6 +37,10 @@ static Settings scene(){ static void exactDryBypass(double rate){ auto s=scene();s.spatialMix=0.f;s.outputTrim=.28f; auto core=make(rate,s); + // The accepted MIX control slews over ~8 ms. Establish the exact + // accepted dry state first, without assuming an instantaneous edit. + std::vector warmL(8192),warmR(8192); + core->process(warmL.data(),warmR.data(),static_cast(warmL.size())); constexpr int n=1024; std::vector l(n),r(n); for(int i=0;i Date: Sat, 14 Nov 2026 21:07:49 +0700 Subject: [PATCH 11/15] dsp(sonku P8.1): derive bounded common-ear timbre EQ from measured KEMAR response off realtime callback --- .../sonku/SonKuHrtfTonalCalibration.h | 122 ++++++++++++++++++ 1 file changed, 122 insertions(+) create mode 100644 engine/builtin_fx/sonku/SonKuHrtfTonalCalibration.h diff --git a/engine/builtin_fx/sonku/SonKuHrtfTonalCalibration.h b/engine/builtin_fx/sonku/SonKuHrtfTonalCalibration.h new file mode 100644 index 000000000..233e2b26c --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuHrtfTonalCalibration.h @@ -0,0 +1,122 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "SonKuMeasuredHrir.h" +#include +#include +#include +#include + +// P8.1: direction-INDEPENDENT tonal equalization calibrated from the actual +// measured KEMAR horizontal bank. Applied equally to both ears, and only to +// the direct HRTF source, never SIDE, DRY, ER or diffuse late reverb. +// All analysis/trigonometry/pow is performed ONCE in prepare(), off RT. +// A pair of bounded minimum-phase biquads adds no device/audio-block latency. +// This research-only profile is not a substitute for a proprietary HRTF model +// and never claims dearVR's Clarity algorithm or individualized HRTF. +namespace armix::sonku { +class SonKuHrtfTonalCalibration final { +public: + using Bank=const std::int16_t (*)[2][hrir::taps]; + bool prepare(double rate,Bank bank) noexcept { + if(!bank || !std::isfinite(rate) || rate<40000. || rate>50000.)return false; + constexpr double eps=1.e-8; + // Horizontal geometric mean of measured ear response; NOT a measured + // head-related diffuse-field transfer function or a fitted room IR. + const double low=averageMagnitude(bank,rate,1000.); + const double middle=averageMagnitude(bank,rate,2000.); + const double upper=averageMagnitude(bank,rate,4000.); + const double treble=averageMagnitude(bank,rate,8000.); + if(low(std::clamp( + -20.*std::log10(middle/adjacent),-5.5,0.)); + // Never invert 8k pinna notches fully: modest broad air return. + airDb_=static_cast(std::clamp( + .40*20.*std::log10(low/treble),0.,4.)); + presence_=peaking(rate,2200.,.85,presenceDb_); + air_=highShelf(rate,6200.,airDb_); + reset(); + return true; + } + void reset() noexcept { + for(auto& x:presenceMemory_)x={}; + for(auto& x:airMemory_)x={}; + } + void process(float& left,float& right) noexcept { + left=run(presence_,presenceMemory_[0],left); + right=run(presence_,presenceMemory_[1],right); + left=run(air_,airMemory_[0],left); + right=run(air_,airMemory_[1],right); + } + float presenceCutDb() const noexcept{return presenceDb_;} + float highAirDb() const noexcept{return airDb_;} +private: + struct Coeff { + float b0=1.f,b1=0.f,b2=0.f,a1=0.f,a2=0.f; + }; + struct State{float z1=0.f,z2=0.f;}; + static float run(const Coeff& c,State& s,float x) noexcept { + const float out=c.b0*x+s.z1; + s.z1=c.b1*x-c.a1*out+s.z2; + s.z2=c.b2*x-c.a2*out; + return out; + } + static Coeff normalized(double b0,double b1,double b2, + double a0,double a1,double a2) noexcept { + if(!std::isfinite(a0)||a0<1.e-9)return {}; + const double inverse=1./a0; + return {static_cast(b0*inverse), + static_cast(b1*inverse), + static_cast(b2*inverse), + static_cast(a1*inverse), + static_cast(a2*inverse)}; + } + static Coeff peaking(double sr,double hz,double q,double db) noexcept { + constexpr double pi=3.14159265358979323846; + const double omega=2.*pi*hz/sr; + const double cosw=std::cos(omega),alpha=std::sin(omega)/(2.*q); + const double A=std::pow(10.,db/40.); + return normalized(1.+alpha*A,-2.*cosw,1.-alpha*A, + 1.+alpha/A,-2.*cosw,1.-alpha/A); + } + static Coeff highShelf(double sr,double hz,double db) noexcept { + constexpr double pi=3.14159265358979323846; + const double omega=2.*pi*hz/sr; + const double cosw=std::cos(omega); + const double A=std::pow(10.,db/40.); + const double root=std::sqrt(A); + // RBJ high shelf, S=1. Shared common transfer on both ears. + const double slope=2.*root*(std::sin(omega)*.5*std::sqrt(2.)); + return normalized(A*((A+1.)+(A-1.)*cosw+slope), + -2.*A*((A-1.)+(A+1.)*cosw), + A*((A+1.)+(A-1.)*cosw-slope), + (A+1.)-(A-1.)*cosw+slope, + 2.*((A-1.)-(A+1.)*cosw), + (A+1.)-(A-1.)*cosw-slope); + } + static double averageMagnitude(Bank bank,double rate, + double hz) noexcept { + constexpr double pi=3.14159265358979323846; + const double w=2.*pi*hz/rate; + double sumLog=0.; + for(int direction=0;direction(bank[direction][ear][k]); + real+=x*std::cos(p); + imag-=x*std::sin(p); + } + const double magnitude=std::hypot(real,imag)/32768.; + sumLog+=std::log(std::max(magnitude,1.e-9)); + } + return std::exp(sumLog/(2.*hrir::directions)); + } + Coeff presence_{},air_{}; + std::array presenceMemory_{},airMemory_{}; + float presenceDb_=0.f,airDb_=0.f; +}; +} // namespace armix::sonku From 8ad550f9efb9196868cb7daf0a93f93bfe1ce1a3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:08:20 +0700 Subject: [PATCH 12/15] dsp(sonku P8.1): apply measured common-ear 2k resonance and high-air calibration only on direct spatial HRTF --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 6b505d2ce..be007328b 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -4,6 +4,9 @@ #include "SonKuEarlyReflections.h" #include "SonKuMusicalReverb.h" #include "SonKuStereoIntegrity.h" +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH +#include "SonKuHrtfTonalCalibration.h" +#endif #if defined(SONKU_P71_DIRECT_XYZ_RESEARCH) && SONKU_P71_DIRECT_XYZ_RESEARCH #include "SonKuSourcePlacement3D.h" #endif @@ -91,6 +94,10 @@ class SonKuSpatialCore final { std::abs(rate-48000.)>.1))return false; sampleRate_=rate; bank_=(std::abs(rate-44100.)<=.1)?hrir::normal44100:hrir::normal48000; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + if(profile==SonKuReflectionProfile::SixSurfaceKemarResearch && + !tonalCalibration_.prepare(rate,bank_))return false; +#endif // Prepared control-side: continuous coefficient and gain smoothing // without trigonometric/exponential work in the audio callback. filterSlew_=static_cast(1.-std::exp(-1./(rate*0.006))); @@ -146,6 +153,9 @@ class SonKuSpatialCore final { smoothedErPresence_=1.f; smoothedTailPresence_=1.f; earBass_.fill(0.f); +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + tonalCalibration_.reset(); +#endif #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH originalBass_.fill(0.f); binauralBass_.fill(0.f); @@ -385,6 +395,10 @@ class SonKuSpatialCore final { ears[1]+=v0*r0+v1*r1; } } +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + if(transparentBass) + tonalCalibration_.process(ears[0],ears[1]); +#endif const auto reflection=room_.active() ?room_.process(transparentBass?x0:(musicSafe?inputMid:x0), transparentBass?x1:(musicSafe?inputMid:x1), @@ -622,6 +636,9 @@ class SonKuSpatialCore final { float smoothedBassShelf_=0.f,limiterGain_=1.f; float smoothedErPresence_=1.f,smoothedTailPresence_=1.f; std::array earBass_{}; +#if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH + SonKuHrtfTonalCalibration tonalCalibration_{}; +#endif #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH std::array originalBass_{},binauralBass_{}; float sideBass_=0.f,bassCrossoverAlpha_=0.f; From 1b468715e74f0c9f9deea1231f16c08ab5620922 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:08:51 +0700 Subject: [PATCH 13/15] test(sonku P8.1): reject measured 2k honk and assert offline HRIR-derived common-ear calibration --- tests/sonku_p80_tonal_room_evidence_test.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/sonku_p80_tonal_room_evidence_test.cpp b/tests/sonku_p80_tonal_room_evidence_test.cpp index 74bb7f30a..c4adde7d3 100644 --- a/tests/sonku_p80_tonal_room_evidence_test.cpp +++ b/tests/sonku_p80_tonal_room_evidence_test.cpp @@ -8,6 +8,7 @@ #error Must compile the P8 acoustic research renderer #endif #include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include "../engine/builtin_fx/sonku/SonKuHrtfTonalCalibration.h" #include #include #include @@ -165,11 +166,23 @@ static void roomChunkParity(double rate) { int main(){ std::puts("P8_SCHEMA,rate_hz,tone_hz,source_type,scene,l_gain_rms,r_gain_rms,peak"); for(double rate:{44100.,48000.}){ + armix::sonku::SonKuHrtfTonalCalibration calibration; + const auto bank=rate<45000.?armix::sonku::hrir::normal44100: + armix::sonku::hrir::normal48000; + assert(calibration.prepare(rate,bank)); + assert(calibration.presenceCutDb()<=-3.f && + calibration.presenceCutDb()>=-5.5f); + assert(calibration.highAirDb()>=2.f && + calibration.highAirDb()<=4.f); + std::printf("P8_CALIBRATION,%.0f,presence_cut_db=%.3f,high_air_db=%.3f\n", + rate,calibration.presenceCutDb(),calibration.highAirDb()); exactDryBypass(rate); antiPhaseExactNoNull(rate); for(float hz:{63.f,125.f,250.f,500.f,1000.f,2000.f,4000.f,8000.f}){ const double mono=toneGain(rate,hz,false,false); const double left=toneGain(rate,hz,true,false); + if(hz==2000.f)assert(mono<1.30); // rejects P8.0 nasal 2k gain of ~1.52 + if(hz==8000.f)assert(mono>.15); // bounded air return, not a pinna-notch inversion assert(mono>.02&&left>.02); if(hz<=125.f){ // Musical bass must not vanish when no ROOM is active. From 0f70ba61ef9a5f5c72c3ed5219b9f2c7f046db7a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:09:32 +0700 Subject: [PATCH 14/15] docs(sonku P8.1): record real KEMAR measured spectrum and data-derived bounded common-ear timbral calibration --- ..._P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md b/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md index 6a0702903..a701b49a2 100644 --- a/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md +++ b/docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md @@ -12,6 +12,21 @@ User headphone feedback: P7.4 severe stereo cancellation; P7.5 shrill/prominent - No FFT, allocations, locks, background worker, extra bridge graph, or extra per-insert data movement in the realtime callback. Original KEMAR 140-tap FIR and native JUCE/ACK persist. - **Still not a fully spatialized stereo object renderer:** above-crossover stereo SIDE remains a direct width bed. This is a targeted bass/room diagnostic milestone, not completion of P8.1 or P8.2. +## P8.1 measured HRTF tonal calibration (same P8 opt-in) + +Observed native P8.0 transfer at 48k, FRONT, ROOM OFF, duplicated mono: +63Hz 0.670, 125Hz 0.516, 1kHz 0.614, **2kHz 1.521**, 4kHz 1.303 and **8kHz 0.145** relative to original. These data justify the owner's "mid honking, thin/squeaky music" report independently from ASIO buffer correctness. + +The independently licensed MIT KEMAR *horizontal* bank was examined: at 48k its geometric mean ear magnitude across all 37 azimuths and 2 ears is 0.677 at 1k, 1.375 at 2k, 0.958 at 4k, 0.261 at 8k. A measured broad 2kHz surplus is real; a simple +bass shelf cannot fix it. + +A new `SonKuHrtfTonalCalibration.h` computes a horizontal-bank *common-ear* corrective EQ ONCE at prepare; no FFT/sin/cos/log/alloc on the realtime callback: +- Presence cut calculated as the measured 2k mean relative to geometric mean of 1k and 4k: capped between 0 and -5.5dB; applied as original RBJ peaking minimum-phase biquad centered at 2.2k, Q 0.85. +- High-air shelf calculated from only **40%** of the measured 1k-vs-8k deficit, maximum +4dB, at 6.2k. This deliberately does not erase the localized KEMAR high-frequency pinna notch. +- Same scalar coefficients for both ears on DIRECT HRTF ONLY, preserving frequency-wise interaural amplitude ratio and nearly identical group-delay shift at the two ears. Never equalize dry stereo SIDE, original bass, directional ER or late reverb with this common ear filter. +- All EQ state is reset on a prepared rebind. Dynamics and plugin state v1/v2/v3 remain unchanged. P7.5/default when P8 flag OFF remains byte-identical. + +This is **not** a patented dearVR Clarity algorithm, not a universal headphone correction, not diffuse-field calibration and not a perfect spectral match. Tests now reject a FRONT 2k gain > 1.30 (P8.0 baseline ~1.52), document 8k return, and still require actual music listening. + ## Bench and acceptance - `tests/sonku_p80_tonal_room_evidence_test.cpp` records per-signal RMS transfer vs 63/125/250/500/1k/2k/4k/8k at 44.1 and 48k; hard-left and dual-mono; room OFF and ROOM ON impulse energy. It enforces finite, nonclipped samples, dry bypass equivalence, anti-phase energy, width 60° exact anti-phase waveform, room late tail and chunk partition parity. - Log the source SHA and compile flags; ensure CTest source fixture and native JUCE adapter share P8 flag. Output metrics from synthetic waves are diagnostic ONLY, not target equalization, no real-music spectral score, no headphone claim. From d2d8fb03c82fa1d678b850ec240e435e34bfe019 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sat, 14 Nov 2026 21:15:16 +0700 Subject: [PATCH 15/15] fix(sonku P8 CI): hash and package the SAME exact field FAT guide --- .github/workflows/sonku-p80-acoustic-windows-field.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sonku-p80-acoustic-windows-field.yml b/.github/workflows/sonku-p80-acoustic-windows-field.yml index 4ec2dbd8a..10cd27f1f 100644 --- a/.github/workflows/sonku-p80-acoustic-windows-field.yml +++ b/.github/workflows/sonku-p80-acoustic-windows-field.yml @@ -187,7 +187,7 @@ jobs: run: | # Standard distribution allowlist was verified above. Field-only notice. Copy-Item -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Destination dist/THIRD_PARTY_8D_SONKU_HRTF.md - Copy-Item -LiteralPath docs/SONKU_P75_PHYSICAL_AUDIO_FAILURE_FIX_20261114.md -Destination dist/SONKU_P80_FIELD_FAT.md + Copy-Item -LiteralPath docs/SONKU_P80_STEREO_BASS_ACOUSTIC_EVIDENCE_20261114.md -Destination dist/SONKU_P80_FIELD_FAT.md $p = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json $checks = @{ 'THIRD_PARTY_8D_SONKU_HRTF.md' = [string]$p.sonkuExperiment.mitKemarNoticeSha256