From 125652379b9c22bddb3158dd10a887754f51115a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:01:27 +0700 Subject: [PATCH 01/26] feat(sonku): add prepared HRIR music-level calibration and source-coupled axial LF room modes in single native graph --- .../sonku/SonKuP92MusicBassFoundation.h | 186 ++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 engine/builtin_fx/sonku/SonKuP92MusicBassFoundation.h diff --git a/engine/builtin_fx/sonku/SonKuP92MusicBassFoundation.h b/engine/builtin_fx/sonku/SonKuP92MusicBassFoundation.h new file mode 100644 index 000000000..6a3caff2f --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP92MusicBassFoundation.h @@ -0,0 +1,186 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "SonKuMeasuredHrir.h" +#include +#include +#include +#include +#include + +// P9.1+P9.2: music-level foundation and gently coupled, spatialized LF room +// modes. The measured 2x2 HRIR remains the ONLY ear renderer. Room modes +// excite each WORLD-anchored source BEFORE the existing FIR; no unpositioned +// headphone sub-bus, L/R panner, fake LF oscillator or second PCM graph. +// +// This is a bounded parametric research model, NOT a measured BRIR or a +// reproduction of proprietary speaker-cabinet/room DSP. No allocation, log, +// exp, trig, IO, locks or policy decisions in process(). All fixed room-mode +// biquad coefficients and music calibration are computed at prepare(). +namespace armix::sonku::p92 { +class MusicBassFoundation final { +public: + using Bank=const std::int16_t (*)[2][hrir::taps]; + struct Sources {float left=0.f,right=0.f;}; + static constexpr int modeCount=3; + bool prepare(double rate,Bank bank) noexcept { + if(!bank||!std::isfinite(rate)|| + (std::abs(rate-44100.)>.1&&std::abs(rate-48000.)>.1))return false; + rate_=static_cast(rate); + constexpr double pi=3.1415926535897932384626433832795; + // Average the measured HRTF magnitude at representative music + // frequencies/near-front directions. One stable broadband scalar, + // not time-varying AGC that pumps with the music or head rotation. + constexpr std::array frequencies{250.,600.,1200.,2500.}; + constexpr std::array directions{0,6,9}; + double power=0.; + int count=0; + for(int d:directions)for(int ear=0;ear<2;++ear) + for(double frequency:frequencies) { + const double omega=2.*pi*frequency/rate; + double re=0.,im=0.; + for(int tap=0;tap(std::clamp( + 1./(.7071067811865476*meanMagnitude),1.0,1.90)); + bassShelfAlpha_=static_cast( + 1.-std::exp(-2.*pi*105./rate)); + roomSlew_=static_cast(1.-std::exp(-1./(rate*.045))); + // Prepared modal frequencies are actual axial eigenfrequencies of + // the three configured rooms: f=c*n/(2*dimension), with even n so + // a central listener is not on a zero-pressure node. + constexpr std::array,3> dimensions{{ + {{7.2f,7.2f,3.2f}}, + {{14.4f,14.4f,4.8f}}, + {{28.8f,28.8f,7.2f}} + }}; + constexpr std::array desiredHz{46.f,71.f,96.f}; + constexpr std::array quality{7.5f,9.f,10.f}; + for(int room=0;room<3;++room) + for(int mode=0;mode(std::lround( + desiredHz[mode]*program.dimension/343.))); + program.harmonic=harmonic; + program.frequency=343.f*harmonic/(2.f*program.dimension); + if(program.frequency>=rate*.45f)return false; + const double omega=2.*pi*program.frequency/rate; + const double sn=std::sin(omega); + const double alpha=sn/(2.*quality[mode]); + const double inv=1./(1.+alpha); + // RBJ constant-0dB-peak bandpass: no DC, no subharmonic + // synthesis, bounded output and damping Q<10. + program.b0=static_cast(alpha*inv); + program.b2=-program.b0; + program.a1=static_cast(-2.*std::cos(omega)*inv); + program.a2=static_cast((1.-alpha)*inv); + } + reset(); + return true; + } + void reset() noexcept { + for(auto& perSource:state_) + for(auto& state:perSource)state={}; + bassState_.fill(0.f); + room_=0; + roomBlend_=targetBlend_=0.f; + for(auto& perSource:coupling_)perSource.fill(0.f); + } + float directMakeup() const noexcept{return directMakeup_;} + void updateScene(int room,float wet,float distance,float worldCenter, + float spread) noexcept { + const int next=(room>=1&&room<=3)?room:0; + // A different room program cannot reuse the old resonator history. + // Only 12 float delays are cleared at most once per scene switch. + if(next!=room_) { + room_=next; + for(auto& perSource:state_) + for(auto& state:perSource)state={}; + roomBlend_=0.f; + } + targetBlend_=room_?std::clamp(wet,0.f,1.f)*.17f:0.f; + if(!room_)return; + constexpr float pi=3.14159265358979323846f; + const float azimuths[2]{worldCenter-spread*.5f, + worldCenter+spread*.5f}; + const auto& programs=programs_[room_-1]; + for(int source=0;source<2;++source) { + const float r=azimuths[source]*(pi/180.f); + const float x=distance*std::sin(r); + const float y=distance*std::cos(r); + for(int mode=0;mode=1&&room<=3&&mode>=0&&mode,3> programs_{}; + std::array,2> state_{}; + std::array,2> coupling_{}; + std::array bassState_{}; + float rate_=48000.f,directMakeup_=1.f,bassShelfAlpha_=0.f; + float roomSlew_=0.f,roomBlend_=0.f,targetBlend_=0.f; + int room_=0; +}; +} // namespace armix::sonku::p92 From d4bc3732721fe39b005a8cdee6121eebf03abef9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:02:37 +0700 Subject: [PATCH 02/26] feat(sonku): P9.2 world-anchored full-band bass, prepared room-mode excitation and calibrated music direct path --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 112 +++++++++++++++++++-- 1 file changed, 105 insertions(+), 7 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 68ca3d80d..958c5d903 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -21,6 +21,9 @@ #include "SonKuP84FusedMusicHrir.h" #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH #include "SonKuP90StereoDecoder.h" +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION +#include "SonKuP92MusicBassFoundation.h" +#endif #endif #endif #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH @@ -103,7 +106,11 @@ inline bool valid(const Settings& s) noexcept { #if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + s.renderMode<=10 && ((s.renderMode<3 || s.renderMode>10) || !s.musicCompatibleLowFrequency) && +#else s.renderMode<=9 && ((s.renderMode<3 || s.renderMode>9) || !s.musicCompatibleLowFrequency) && +#endif #else s.renderMode<=8 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5 && s.renderMode!=6 && s.renderMode!=7 && s.renderMode!=8) || !s.musicCompatibleLowFrequency) && #endif @@ -133,6 +140,9 @@ inline bool valid(const Settings& s) noexcept { && s.renderMode!=8 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH && s.renderMode!=9 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + && s.renderMode!=10 +#endif #endif #endif ) || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40.f && @@ -202,6 +212,9 @@ class SonKuSpatialCore final { if(!p84MusicKernel_.prepare(rate))return false; #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH if(!p90Decoder_.prepare(rate))return false; +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + if(!p92Foundation_.prepare(rate,bank_))return false; +#endif #endif #endif #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH @@ -269,6 +282,9 @@ class SonKuSpatialCore final { integrity_.reset(); #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH p90Decoder_.reset(); +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + p92Foundation_.reset(); +#endif #endif #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH p83LowFrequency_.reset(); @@ -502,6 +518,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + && p83Mode_!=p83::Mode::MusicSpatialP92 +#endif #endif #endif #endif @@ -513,6 +532,11 @@ class SonKuSpatialCore final { const bool monoObject=positionedMode && p83Mode_==p83::Mode::MonoObject; #else constexpr bool positionedMode=false,monoObject=false; +#endif +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + const bool p92Stage=p83Mode_==p83::Mode::MusicSpatialP92; +#else + constexpr bool p92Stage=false; #endif const float distanceGain=room_.relativeDistanceGain(); const bool nativeSpace=nativeSpaceEverUsed_; @@ -547,6 +571,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + || p83Mode_==p83::Mode::MusicSpatialP92 +#endif #endif #endif #endif @@ -568,6 +595,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + || p83Mode_==p83::Mode::MusicSpatialP92 +#endif #endif #endif #endif @@ -581,6 +611,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + || p83Mode_==p83::Mode::MusicSpatialP92 +#endif #endif #endif #endif @@ -600,6 +633,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + || p83Mode_==p83::Mode::MusicSpatialP92 +#endif #endif #endif )?0.27f:0.13f)* @@ -616,6 +652,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + || p83Mode_==p83::Mode::MusicSpatialP92 +#endif #endif #endif )? @@ -660,7 +699,11 @@ class SonKuSpatialCore final { const float x0=std::isfinite(left[i])?left[i]:0.f; const float x1=monoObject?0.f:(std::isfinite(right[i])?right[i]:0.f); #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH - if(p83Mode_==p83::Mode::MusicSpatialP90)p90Decoder_.observe(x0,x1); + if(p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + ||p83Mode_==p83::Mode::MusicSpatialP92 +#endif + )p90Decoder_.observe(x0,x1); #endif // Preserve strong anti-correlated music side energy without // collapsing it into the two virtual mono HRTF sources. The @@ -698,11 +741,22 @@ class SonKuSpatialCore final { // world-locked measured reflections shoulder the extra space. sideRescue*=p89SideGain; #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH - if(p83Mode_==p83::Mode::MusicSpatialP90)sideRescue=0.f; + if(p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + ||p83Mode_==p83::Mode::MusicSpatialP92 #endif + )sideRescue=0.f; #endif +#endif +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + const auto bassRoom=p92Stage?p92Foundation_.process(x0,x1): + p92::MusicBassFoundation::Sources{}; + history_[0][write_]=x0+bassRoom.left; + history_[1][write_]=x1+bassRoom.right; +#else history_[0][write_]=x0; history_[1][write_]=x1; +#endif float ears[2]{0.f,0.f}; for(int tap=0;tap(degrees_),settings_.stereoSpreadDegrees); +#endif p90Decoder_.compose(centerTarget_,targets_[0],targets_[1]); + } else #endif p84MusicKernel_.merge(centerTarget_,targets_[0],targets_[1]); @@ -1202,6 +1297,9 @@ class SonKuSpatialCore final { p84::FusedMusicHrir p84MusicKernel_{}; #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH p90::StereoDecoder p90Decoder_{}; +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + p92::MusicBassFoundation p92Foundation_{}; +#endif #endif #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH p87::MusicalAirBody p87Body_{}; From 4bf0254bcbb72b5c01835a3ddf19c7b5df5dfbd2 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:03:10 +0700 Subject: [PATCH 03/26] fix(sonku): include P9.2 in fused HRTF and P8.9 room-depth mode classification --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 958c5d903..9a81dd485 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -666,6 +666,9 @@ class SonKuSpatialCore final { const bool p89Stage=p83Mode_==p83::Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH ||p83Mode_==p83::Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + ||p83Mode_==p83::Mode::MusicSpatialP92 +#endif #endif ; const float p89Depth=p89Stage&&roomEnabled? @@ -1140,6 +1143,9 @@ class SonKuSpatialCore final { p83Mode_==p83::Mode::MusicSpatialP89 || #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH p83Mode_==p83::Mode::MusicSpatialP90 || +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + p83Mode_==p83::Mode::MusicSpatialP92 || +#endif #endif #endif #endif From 3e29861fcac17694ae9b6938c33663d18ad5d74a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:03:23 +0700 Subject: [PATCH 04/26] =?UTF-8?q?feat(sonku):=20reserve=20opt-in=20mode=20?= =?UTF-8?q?10=20for=20P9.1+P9.2=20preserving=20modes=200=E2=80=939?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/builtin_fx/sonku/SonKuP83SpeakerScene.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h index 2820af40f..32e4ae0c6 100644 --- a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h +++ b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h @@ -22,6 +22,9 @@ enum class Mode : std::uint8_t { ,MusicSpatialP89=8 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH ,MusicSpatialP90=9 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + ,MusicSpatialP92=10 +#endif #endif #endif #endif @@ -48,6 +51,9 @@ inline bool valid(Mode m) noexcept { || m==Mode::MusicSpatialP89 #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH || m==Mode::MusicSpatialP90 +#if defined(SONKU_P92_MUSIC_BASS_FOUNDATION) && SONKU_P92_MUSIC_BASS_FOUNDATION + || m==Mode::MusicSpatialP92 +#endif #endif #endif #endif From 5ea3c9d893aa2004bf1998b2d0842e42b1e1d338 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:04:02 +0700 Subject: [PATCH 05/26] build(sonku): opt-in P9.1+P9.2 in native JUCE and C++ PCM with separate legacy A/B gates --- CMakeLists.txt | 69 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d9ebab73..372d20891 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -96,6 +96,13 @@ if(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT AND NOT ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) message(FATAL_ERROR "P9.0 requires P8.9 research branch baseline") endif() +# P9.1+P9.2 music fidelity and physical bass share the P9 measured binaural graph. +option(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + "Private P9.1+P9.2 calibrated music and source-coupled axial LF room modes" OFF) +if(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT AND + NOT ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) + message(FATAL_ERROR "P9.2 music/bass requires P9.0 measured stereo engine") +endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -312,7 +319,9 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=1> $<$:SONKU_P89_DEPTH_COHERENCE_RESEARCH=1> $<$:ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=1> - $<$:SONKU_P90_TRUE_EXTERNAL_RESEARCH=1>) + $<$:SONKU_P90_TRUE_EXTERNAL_RESEARCH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT=1> + $<$:SONKU_P92_MUSIC_BASS_FOUNDATION=1>) if(WIN32) # Windows retains its proven ASIO-first / WASAPI / static WebView2 distribution. # Never link Windows loader or sound APIs into macOS/Linux builds. @@ -826,6 +835,64 @@ if(BUILD_TESTING) SONKU_P90_TRUE_EXTERNAL_RESEARCH=1) add_test(NAME NativeSonKuP90JuceV11AppliedAckAndLegacyRestore COMMAND ARMixSonKuP90NativeTests) + if(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) + add_executable(ARMixSonKuP92SourceTests + tests/sonku_p92_music_bass_source_test.cpp) + target_compile_features(ARMixSonKuP92SourceTests PRIVATE cxx_std_20) + target_compile_definitions(ARMixSonKuP92SourceTests 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 + SONKU_P82_MULTIBAND_ROOM_RESEARCH=1 + SONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 + SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1 + SONKU_P85_WORLD_COHERENCE_RESEARCH=1 + SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 + SONKU_P87_MUSIC_BODY_RESEARCH=1 + SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1 + SONKU_P89_DEPTH_COHERENCE_RESEARCH=1 + SONKU_P90_TRUE_EXTERNAL_RESEARCH=1 + SONKU_P92_MUSIC_BASS_FOUNDATION=1) + add_test(NAME NativeSonKuP92MusicFidelityPhysicalBassSource + COMMAND ARMixSonKuP92SourceTests) + juce_add_console_app(ARMixSonKuP92NativeTests + PRODUCT_NAME "ArSonMix SonKu P92 JUCE v12 State Tests") + target_sources(ARMixSonKuP92NativeTests PRIVATE + tests/sonku_p92_native_juce_v12_test.cpp) + target_compile_features(ARMixSonKuP92NativeTests PRIVATE cxx_std_20) + target_link_libraries(ARMixSonKuP92NativeTests PRIVATE + juce::juce_audio_processors juce::juce_recommended_config_flags) + target_compile_definitions(ARMixSonKuP92NativeTests PRIVATE + ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT=1 + 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 + SONKU_P82_MULTIBAND_ROOM_RESEARCH=1 + SONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 + SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1 + SONKU_P85_WORLD_COHERENCE_RESEARCH=1 + SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 + SONKU_P87_MUSIC_BODY_RESEARCH=1 + SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1 + SONKU_P89_DEPTH_COHERENCE_RESEARCH=1 + SONKU_P90_TRUE_EXTERNAL_RESEARCH=1 + SONKU_P92_MUSIC_BASS_FOUNDATION=1) + add_test(NAME NativeSonKuP92JuceV12AppliedAckAndV11Restore + COMMAND ARMixSonKuP92NativeTests) + endif() endif() endif() endif() From d906293921c25c04477fc012728eaf682dda9356 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:04:24 +0700 Subject: [PATCH 06/26] feat(sonku): introduce v12 63-byte state with strict mode-10 admission and v1-v11 backwards restore --- engine/builtin_fx/SonKuSpatialProcessor.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h index 6ed46528f..cb7fd2147 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -164,7 +164,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, #if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + out.writeInt(12); // unchanged 63-byte state; isolated P9.2 mode 10 +#else out.writeInt(11); // unchanged 63-byte state; P9 mode 9 +#endif #else out.writeInt(10); // 63 bytes v9 layout, opt-in mode 8 #endif @@ -253,6 +257,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, &&version!=10 #if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT &&version!=11 +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + &&version!=12 +#endif #endif #endif #endif @@ -281,6 +288,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, ||(version==10&&size!=63) #if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT ||(version==11&&size!=63) +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + ||(version==12&&size!=63) +#endif #endif #endif #endif @@ -368,6 +378,13 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, next.renderMode!=7 && next.renderMode!=8 && next.renderMode!=9) return false; if(version==11 && next.musicCompatibleLowFrequency)return false; +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + if(version==12 && next.renderMode!=0 && next.renderMode!=3 && + next.renderMode!=4 && next.renderMode!=5 && next.renderMode!=6 && + next.renderMode!=7 && next.renderMode!=8 && next.renderMode!=9 && + next.renderMode!=10)return false; + if(version==12 && next.musicCompatibleLowFrequency)return false; +#endif #endif #endif #endif From e3bbfccbaf5db5dd50ecc25e6b48f20f73903f28 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:04:46 +0700 Subject: [PATCH 07/26] feat(sonku): capability-gated native schema-12 P9.2 DSP mode readback --- src/SonKuNativeBridgeContract.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SonKuNativeBridgeContract.h b/src/SonKuNativeBridgeContract.h index f5e55bdda..5134b7538 100644 --- a/src/SonKuNativeBridgeContract.h +++ b/src/SonKuNativeBridgeContract.h @@ -8,7 +8,9 @@ #include namespace armix::builtin_fx::sonku_bridge { inline constexpr int schemaVersion() noexcept { -#if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + return 12; +#elif defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT return 11; #elif defined(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT return 10; @@ -104,7 +106,11 @@ inline bool decodeSettings(const juce::var& values,armix::sonku::Settings& out) #if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4 && proposed.renderMode!=5 && proposed.renderMode!=6 && proposed.renderMode!=7 && proposed.renderMode!=8 && proposed.renderMode!=9 && proposed.renderMode!=10)return false; +#else if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4 && proposed.renderMode!=5 && proposed.renderMode!=6 && proposed.renderMode!=7 && proposed.renderMode!=8 && proposed.renderMode!=9)return false; +#endif #else if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4 && proposed.renderMode!=5 && proposed.renderMode!=6 && proposed.renderMode!=7 && proposed.renderMode!=8)return false; #endif From f526225764315650dffea1f85c5f14ba38a8b4dc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:04:49 +0700 Subject: [PATCH 08/26] feat(sonku): capability-gated native schema-12 P9.2 DSP mode readback --- src/Main.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index 3a9937b8d..55f7e7846 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3046,7 +3046,19 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) reply->setProperty("p8TransparentBass",true); #endif -#if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT + if(processor && processor->preparedReflectionProfile()== + armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) { + reply->setProperty("p84MusicFusion",true); + reply->setProperty("p85AcousticCoherence",true); + reply->setProperty("p86HorizontalFocus",true); + reply->setProperty("p87MusicalAirBody",true); + reply->setProperty("p88PerceptualAlignment",true); + reply->setProperty("p89StereoRoomDepth",true); + reply->setProperty("p90TrueExternalSpeaker",true); + reply->setProperty("p92MusicBassFoundation",true); + } +#elif defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT if(processor && processor->preparedReflectionProfile()== armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) { reply->setProperty("p84MusicFusion",true); From 9949f584f0afa91ce1912ce7c8a0ac6e6bf286fc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:06:49 +0700 Subject: [PATCH 09/26] feat(sonku): capability-gated P9.2 stable GUI mode and calibrated first-audition stage without rewriting sessions --- site/preview-v2/assets/mixer-native-sonku.js | 60 +++++++++++++++----- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 5ad8c9597..ed0788b29 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -14,7 +14,7 @@ const elevationLimits=s=>{ const distance=s.sourceDistanceMeters; const height=roomHeights[s.spacePreset]; if(!Number.isFinite(distance)||!height)return {min:0,max:0}; - const spectralOffset=(s.renderMode===7||s.renderMode===8||s.renderMode===9)?(s.hrtfElevationTrimDegrees??0):0; + const spectralOffset=(s.renderMode===7||s.renderMode===8||s.renderMode===9||s.renderMode===10)?(s.hrtfElevationTrimDegrees??0):0; const bottom=Math.max(-40-spectralOffset,Math.asin(Math.max(-1,Math.min(1,(.5-1.45)/distance)))*180/Math.PI); const top=Math.min(60-spectralOffset,Math.asin(Math.max(-1,Math.min(1,(height-.5-1.45)/distance)))*180/Math.PI); // Keep a 0.1 degree safety margin for C++ float boundary rounding. @@ -54,12 +54,12 @@ const valid=s=>s && Number.isFinite(s.startAzimuthDegrees) && 1.45+s.sourceDistanceMeters*Math.sin(s.directElevationDegrees*Math.PI/180)<= roomHeights[s.spacePreset]-.5)) && (s.renderMode===undefined || ( - Number.isInteger(s.renderMode)&&s.renderMode>=0&&s.renderMode<=9 && + Number.isInteger(s.renderMode)&&s.renderMode>=0&&s.renderMode<=10 && typeof s.musicCompatibleLowFrequency==="boolean" && (s.hrtfElevationTrimDegrees===undefined || ( Number.isFinite(s.hrtfElevationTrimDegrees) && s.hrtfElevationTrimDegrees>=-30 && s.hrtfElevationTrimDegrees<=20 && - ((s.renderMode!==7&&s.renderMode!==8&&s.renderMode!==9) || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40 && + ((s.renderMode!==7&&s.renderMode!==8&&s.renderMode!==9&&s.renderMode!==10) || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40 && s.directElevationDegrees+s.hrtfElevationTrimDegrees<=60)))) && Number.isFinite(s.headYawDegrees)&&Math.abs(s.headYawDegrees)<=360 && (s.renderMode!==2 || (s.stereoSpreadDegrees>=20&&s.stereoSpreadDegrees<=120)))); @@ -195,7 +195,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,p83Capable=false,p84Capable=false,p85Capable=false,p86Capable=false,p87Capable=false,p88Capable=false,p89Capable=false,p90Capable=false,musicSafeStereo=false,p8TransparentBass=false,p82MultibandRoom=false, + xyzCapable=false,p83Capable=false,p84Capable=false,p85Capable=false,p86Capable=false,p87Capable=false,p88Capable=false,p89Capable=false,p90Capable=false,p92Capable=false,musicSafeStereo=false,p8TransparentBass=false,p82MultibandRoom=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; @@ -215,7 +215,19 @@ function render(){ const row=$("skRenderRow");row.hidden=!(p83Capable||p84Capable); if(p83Capable||p84Capable){ const picker=$("skRenderMode"); - if(p90Capable && picker.dataset.nativeModeSet!=="p90"){ + if(p92Capable && picker.dataset.nativeModeSet!=="p92"){ + picker.innerHTML=''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''; + picker.dataset.nativeModeSet="p92"; + root.querySelector(".sk-render-label").textContent="RENDER MODE · P9.1+P9.2 HEADPHONE FAT"; + }else if(!p92Capable && p90Capable && picker.dataset.nativeModeSet!=="p90"){ picker.innerHTML=''+ ''+ ''+ @@ -279,7 +291,8 @@ function render(){ picker.dataset.nativeModeSet="p83"; root.querySelector(".sk-render-label").textContent="RENDER MODE · P8.3 TEST"; } - const v=p90Capable?(s.renderMode===9?"external":s.renderMode===8?"depth":s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): + const v=p92Capable?(s.renderMode===10?"foundation":s.renderMode===9?"external":s.renderMode===8?"depth":s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): + p90Capable?(s.renderMode===9?"external":s.renderMode===8?"depth":s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): p89Capable?(s.renderMode===8?"depth":s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): p88Capable?(s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): p87Capable?(s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): @@ -337,7 +350,7 @@ function render(){ $("skElevationValue").textContent=s.directElevationDegrees.toFixed(1)+"°"; } const alignRow=$("skHrtfAlignRow"),align=$("skHrtfAlign"); - alignRow.hidden=!(p88Capable&&(s.renderMode===7||s.renderMode===8||s.renderMode===9)); + alignRow.hidden=!(p88Capable&&(s.renderMode===7||s.renderMode===8||s.renderMode===9||s.renderMode===10)); if(!alignRow.hidden){ const min=Math.max(-30,-40-s.directElevationDegrees); const max=Math.min(20,60-s.directElevationDegrees); @@ -345,7 +358,9 @@ function render(){ if(!rangeEdits.has("skHrtfAlign"))align.value=String(s.hrtfElevationTrimDegrees); $("skHrtfAlignValue").textContent=(s.hrtfElevationTrimDegrees>=0?"+":"")+s.hrtfElevationTrimDegrees.toFixed(1)+"°"; } - root.querySelector(".sk-stage-caption").textContent=p90Capable&&s.renderMode===9? + root.querySelector(".sk-stage-caption").textContent=p92Capable&&s.renderMode===10? + "P9.2 CALIBRATED WORLD SPEAKERS + SOURCE-COUPLED LF ROOM · HEADPHONE FAT REQUIRED": + p90Capable&&s.renderMode===9? "P9.0 MEASURED TWIN-SPEAKER HRIR · WORLD-LOCKED STEREO · FAT REQUIRED": p89Capable&&s.renderMode===8? "P8.9 ROOM-ANCHORED STEREO · DIRECT MUSICAL BODY PRESERVED · FAT REQUIRED": @@ -372,7 +387,9 @@ function render(){ $("skSpread").closest("label").querySelector(".sk-param-name").textContent= (p83Capable||p84Capable)&&s.renderMode!==0?"SPEAKER ANGLE": musicSafeStereo?"SIDE WIDTH":"SPREAD"; - root.querySelector(".sk-guide").textContent=p90Capable&&s.renderMode===9 + root.querySelector(".sk-guide").textContent=p92Capable&&s.renderMode===10 + ?"World-anchored bass and music reference level · calibrated headphone FAT pending" + :p90Capable&&s.renderMode===9 ?"Two positioned measured HRIR speakers · 0° co-location cannot preserve anti-phase" :musicSafeStereo ?"Legacy music WIDTH adjusts headlocked SIDE; P9 spatializes it" @@ -390,7 +407,8 @@ function render(){ // redrawn at 60 Hz. The native audio callback remains the time authority. drawSpeakers(); $("skMode").textContent=native()?(context()? - (p90Capable&&s.renderMode===9?"NATIVE P9.0 TRUE EXTERNAL · TEST": + (p92Capable&&s.renderMode===10?"NATIVE P9.2 MUSIC + ROOM BASS · TEST": + p90Capable&&s.renderMode===9?"NATIVE P9.0 TRUE EXTERNAL · TEST": p89Capable&&s.renderMode===8?"NATIVE P8.9 STEREO + ROOM · TEST": p88Capable&&s.renderMode===7?"NATIVE P8.8 EAR ALIGN + DISTANCE · TEST": p87Capable&&s.renderMode===6?"NATIVE P8.7 MUSICAL AIR + BODY · TEST": @@ -542,7 +560,7 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ String(r.deviceEpoch)!==String(c.deviceEpoch)|| String(r.graphRevision)!==String(c.graphRevision))return; const measured=(r.schemaVersion===3 || r.schemaVersion===4 || - r.schemaVersion===5 || r.schemaVersion===6 || r.schemaVersion===7 || r.schemaVersion===8 || r.schemaVersion===9 || r.schemaVersion===10 || r.schemaVersion===11) && + r.schemaVersion===5 || r.schemaVersion===6 || r.schemaVersion===7 || r.schemaVersion===8 || r.schemaVersion===9 || r.schemaVersion===10 || r.schemaVersion===11 || r.schemaVersion===12) && Number.isFinite(r.settings?.directElevationDegrees); if(r.schemaVersion!==2&&!measured)return; const incoming=normalizeSettings(r.settings); @@ -554,7 +572,9 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ Number.isInteger(incoming.renderMode) && typeof incoming.musicCompatibleLowFrequency==="boolean" && Number.isFinite(incoming.headYawDegrees); - p90Capable=r.schemaVersion===11 && r.p90TrueExternalSpeaker===true && + p92Capable=r.schemaVersion===12 && r.p92MusicBassFoundation===true && + Number.isFinite(incoming.hrtfElevationTrimDegrees); + p90Capable=(r.schemaVersion===11||p92Capable) && r.p90TrueExternalSpeaker===true && Number.isFinite(incoming.hrtfElevationTrimDegrees); p89Capable=(r.schemaVersion===10||p90Capable) && r.p89StereoRoomDepth===true && Number.isFinite(incoming.hrtfElevationTrimDegrees); @@ -571,7 +591,8 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ (p87Capable&&incoming.renderMode===6)|| (p88Capable&&incoming.renderMode===7)|| (p89Capable&&incoming.renderMode===8)|| - (p90Capable&&incoming.renderMode===9)) && + (p90Capable&&incoming.renderMode===9)|| + (p92Capable&&incoming.renderMode===10)) && typeof incoming.musicCompatibleLowFrequency==="boolean" && incoming.musicCompatibleLowFrequency===false && Number.isFinite(incoming.headYawDegrees); @@ -606,7 +627,7 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ } render(); }); -$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;p87Capable=false;p88Capable=false;p89Capable=false;p90Capable=false;musicSafeStereo=false;p8TransparentBass=false;p82MultibandRoom=false; +$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;p87Capable=false;p88Capable=false;p89Capable=false;p90Capable=false;p92Capable=false;musicSafeStereo=false;p8TransparentBass=false;p82MultibandRoom=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;} @@ -614,7 +635,8 @@ $("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapa $("skRenderMode").addEventListener("change",()=>{ if(!(p83Capable||p84Capable))return; const v=$("skRenderMode").value; - const mode=p90Capable?(v==="external"?9:v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): + const mode=p92Capable?(v==="foundation"?10:v==="external"?9:v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): + p90Capable?(v==="external"?9:v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): p89Capable?(v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): p88Capable?(v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): p87Capable?(v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): @@ -623,6 +645,14 @@ $("skRenderMode").addEventListener("change",()=>{ p84Capable?(v==="clarity"?3:0): v==="mono"?1:v==="physical"||v==="musiclf"?2:0; const scene={...draft,renderMode:mode,musicCompatibleLowFrequency:v==="musiclf"}; + // Apply only on deliberate P9.2 selection. Existing saved sessions and + // P8/P9 mode switches are never rewritten or migrated speculatively. + if(mode===10 && draft.renderMode!==10){ + Object.assign(scene,{moving:false,startAzimuthDegrees:0, + stereoSpreadDegrees:82,spatialMix:1,outputTrim:1,spacePreset:3, + sourceDistanceMeters:1.6,roomAmount:.72,ambience:.38, + hrtfElevationTrimDegrees:0}); + } // Mode changes in v6 must not reset the owner scene, yaw or motion. if(mode!==0 && !p85Capable){ scene.moving=false; From 5bd9868087559a2fb5a13329384c9ab54d608fff Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:08:24 +0700 Subject: [PATCH 10/26] test(sonku): gate P9.1+P9.2 with real native music/bass PCM, room and yaw transfer, 44.1/48k, block parity --- tests/sonku_p92_music_bass_source_test.cpp | 130 +++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 tests/sonku_p92_music_bass_source_test.cpp diff --git a/tests/sonku_p92_music_bass_source_test.cpp b/tests/sonku_p92_music_bass_source_test.cpp new file mode 100644 index 000000000..ffb06508b --- /dev/null +++ b/tests/sonku_p92_music_bass_source_test.cpp @@ -0,0 +1,130 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// P9.1+P9.2 true native C++ PCM: music level, LF physical source and room. +// This is numerical evidence, NEVER a claim of subjective dearVR parity. +#ifdef NDEBUG +#undef NDEBUG +#endif +#if !defined(SONKU_P92_MUSIC_BASS_FOUNDATION) || !SONKU_P92_MUSIC_BASS_FOUNDATION +#error P9.2 needs its opt-in compile flag +#endif +#include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include "../engine/builtin_fx/sonku/SonKuP92MusicBassFoundation.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace armix::sonku; +constexpr double pi=3.1415926535897932384626433832795; +struct Result { + std::vector l,r; + double energy=0.,peak=0.; +}; +static Result render(int rate,int mode,int room,float distance,float width, + float yaw,float reflection,float reverb,int material, + int frames=12288,int block=128,float mix=1.f,float trim=1.f) { + auto core=std::make_unique(); + assert(core->prepare(rate,SonKuReflectionProfile::SixSurfaceKemarResearch)); + Settings s{}; + s.startAzimuthDegrees=0.f; + s.moving=false; + s.stereoSpreadDegrees=width; + s.headYawDegrees=yaw; + s.spatialMix=mix; + s.outputTrim=trim; + s.roomAmount=reflection; + s.ambience=reverb; + s.sourceDistanceMeters=distance; + s.spacePreset=room; + s.renderMode=mode; + s.hrtfElevationTrimDegrees=0.f; + assert(valid(s) && core->setSettings(s)); + Result v{std::vector(frames),std::vector(frames)}; + for(int i=0;iprocess(v.l.data()+i,v.r.data()+i,std::min(block,frames-i)); + for(int i=0;i1.e-8); + return v; +} +static double diff(const Result& a,const Result& b) { + assert(a.l.size()==b.l.size()); + double e=0.; + for(std::size_t i=0;i=1.0f&&bass.directMakeup()<=1.9f); + for(int room=1;room<=3;++room) + for(int m=0;m<3;++m) { + const float frequency=bass.modeFrequency(room,m); + assert(frequency>=24.f&&frequency<=125.f); + } + // Mode 10 has the exact previous stereo HRIR and no headphone + // dry SIDE. At equal static scene, P9.0 must remain an independent + // baseline, not silently inherit our source-coupled room modes. + for(int material=0;material<=4;++material){ + const auto next=render(rate,10,3,1.6f,82.f,0.f,.72f,.38f,material); + const auto old=render(rate,9,3,1.6f,82.f,0.f,.72f,.38f,material); + assert(diff(next,old)>1.e-8); + assert(next.energy>old.energy*.20 && "new music stage became inaudible"); + assert(next.peak<.981); + } + const auto roomOn=render(rate,10,3,1.6f,82.f,0.f,.72f,.38f,4); + const auto roomOff=render(rate,10,0,1.6f,82.f,0.f,0.f,0.f,4); + assert(diff(roomOn,roomOff)>1.e-6&&"room modes not reaching actual ears"); + // Angle/head yaw must actually change bass-bearing full-band + // transfer rather than the old channel-locked <220Hz return. + const auto yawed=render(rate,10,3,1.6f,82.f,85.f,.72f,.38f,2); + const auto opposite=render(rate,10,3,1.6f,82.f,-85.f,.72f,.38f,2); + assert(diff(yawed,opposite)>1.e-6); + const auto left=render(rate,10,3,1.6f,82.f,0.f,.72f,.38f,2); + const auto right=render(rate,10,3,1.6f,82.f,0.f,.72f,.38f,3); + const auto anti=render(rate,10,3,1.6f,82.f,0.f,.72f,.38f,1); + assert(diff(left,right)>1.e-6&&anti.energy>1.e-7); + for(int block:{64,256}){ + const auto check=render(rate,10,3,1.6f,82.f,0.f,.72f,.38f,4,12288,block); + assert(diff(roomOn,check)==0. && "buffer-size dependent PCM"); + } + const auto dry=render(rate,10,0,1.6f,82.f,0.f,0.f,0.f,4,12288,128,0.f); + assert(dry.energy>1.e-7); + // In a measured HRTF we do not guarantee output = input gain at + // every frequency, but at 100% MIX high-level energy must be finite + // without a +7dB manual user gain just to make the plug audible. + std::printf("P92_PCM,%d,makeup=%.4f,old=%.7f,next=%.7f,room_diff=%.7f,peak=%.5f\n", + rate,bass.directMakeup(),render(rate,9,0,1.6f,82.f,0.f,0.f,0.f,4).energy, + roomOn.energy,diff(roomOn,roomOff),roomOn.peak); + } + std::puts("PASS P92 NATIVE PCM: 44.1/48k, P90 golden isolation, measured music makeup, axial LF modes, bass yaw, anti-phase, room OFF, 64/128/256 parity"); +} From 7969390f904ec0654132ab10e2f33f5ae2f44194 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:08:55 +0700 Subject: [PATCH 11/26] test(sonku): validate v12 ACK, P9.2 native mode and v1-v11 .smix backwards restore --- tests/sonku_p92_native_juce_v12_test.cpp | 261 +++++++++++++++++++++++ 1 file changed, 261 insertions(+) create mode 100644 tests/sonku_p92_native_juce_v12_test.cpp diff --git a/tests/sonku_p92_native_juce_v12_test.cpp b/tests/sonku_p92_native_juce_v12_test.cpp new file mode 100644 index 000000000..334816b48 --- /dev/null +++ b/tests/sonku_p92_native_juce_v12_test.cpp @@ -0,0 +1,261 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// REAL native Windows JUCE v10 SonKu P9.0 true external speaker headphone research: +// P8.2 -> native queued v10 -> fading -> AUDIO APPLIED ACK -> readback, +// v1..v10 .smix state, old v4 rejected physical rollback, v9 HRTF trim intact and no extra graph. +#if defined(NDEBUG) +#undef NDEBUG +#endif +#if !defined(ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT) || !ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT +#error Native JUCE v11 test requires explicit private P9 research build +#endif +#include "../engine/builtin_fx/SonKuSpatialProcessor.h" +#include "../src/SonKuNativeBridgeContract.h" +#include +#include +#include +#include +#include +using armix::builtin_fx::SonKuSpatialProcessor; +using armix::sonku::Settings; +using namespace armix::builtin_fx::sonku_bridge; +static constexpr float pi=3.14159265358979323846f; +static double render(SonKuSpatialProcessor& fx,int sampleOffset) { + juce::AudioBuffer pcm(2,128); + juce::MidiBuffer midi; + for(int i=0;i<128;++i){ + const float t=static_cast(sampleOffset+i)/48000.f; + const float main=.14f*std::sin(2*pi*311*t)+.08f*std::sin(2*pi*719*t); + const float side=.08f*std::sin(2*pi*1703*t); + pcm.setSample(0,i,main+side); + pcm.setSample(1,i,main-side); + } + fx.processBlock(pcm,midi); + double e=0; + for(int i=0;i<128;++i){ + const auto L=pcm.getSample(0,i),R=pcm.getSample(1,i); + assert(std::isfinite(L)&&std::isfinite(R)); + assert(std::abs(L)<1.f&&std::abs(R)<1.f); + e+=L*L+R*R; + } + return e; +} +static void complete(SonKuSpatialProcessor& fx,std::uint64_t id,int seed) { + SonKuSpatialProcessor::Completion ack{}; + bool ok=false; + for(int n=0;n<36;++n){ + render(fx,(seed+n)*128); + if(fx.pollCompletion(ack)){ + assert(ack.requestId==id && ack.applied); + ok=true;break; + } + } + assert(ok && "P92 must ACK only after native PCM applies settings"); + for(int n=0;n<20;++n) render(fx,(seed+40+n)*128); + assert(fx.stateSnapshotQuiescent()); +} +static juce::MemoryBlock legacy(int version,int oldMode=2){ + juce::MemoryBlock bytes; + { + juce::MemoryOutputStream o(bytes,false); + o.writeInt(0x534f4e4b);o.writeInt(version); + o.writeFloat(0.f);o.writeFloat(12.f);o.writeFloat(60.f); + o.writeFloat(1.f);o.writeFloat(.75f); + o.writeByte(0);o.writeByte(1); + if(version>=2){ + o.writeInt(1);o.writeFloat(1.6f);o.writeFloat(.55f); + o.writeFloat(.30f); + } + if(version>=3)o.writeFloat(0.f); + if(version>=4){ + o.writeInt(oldMode);o.writeByte(version>=5?0:1);o.writeFloat(0.f); + } + if(version>=9)o.writeFloat(-12.f); + } // MemoryOutputStream must flush byte count before asserting the block. + assert(bytes.getSize()==static_cast( + version==1?30:version==2?46:version==3?50:version>=9?63:59)); + return bytes; +} +int main(){ + static_assert(schemaVersion()==12); + auto fx=std::make_unique(); + fx->prepareToPlay(48000.,128); + assert(fx->isReady()); + assert(fx->preparedReflectionProfile()== + armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch); + fx->sealForRealtime(); + Settings s=fx->acceptedSettings(); + assert(s.renderMode==0); + s.moving=false;s.startAzimuthDegrees=0.f; + s.stereoSpreadDegrees=60.f;s.spatialMix=1.f;s.outputTrim=1.f; + s.spacePreset=3;s.sourceDistanceMeters=1.6f;s.roomAmount=.72f;s.ambience=.38f; + s.headYawDegrees=0.f;s.musicCompatibleLowFrequency=false;s.renderMode=10;s.hrtfElevationTrimDegrees=-12.f; + auto json=acceptedSettings(s); + Settings decoded{}; + assert(decodeSettings(json,decoded)&&decoded.renderMode==10); + for(int rejected:{-1,1,2,11,63}){ + auto bad=acceptedSettings(s); + bad.getDynamicObject()->setProperty("renderMode",rejected); + assert(!decodeSettings(bad,decoded)); + } + auto bad=acceptedSettings(s); + bad.getDynamicObject()->setProperty("musicCompatibleLowFrequency",true); + assert(!decodeSettings(bad,decoded)); + bad=acceptedSettings(s); + bad.getDynamicObject()->setProperty("headYawDegrees","invalid"); + assert(!decodeSettings(bad,decoded)); + assert(fx->queueSettings(s,801)); + SonKuSpatialProcessor::Completion ack{}; + assert(!fx->pollCompletion(ack)); + render(*fx,0); + assert(!fx->pollCompletion(ack)); + assert(!fx->stateSnapshotQuiescent()); + assert(fx->acceptedSettings().renderMode==0); + complete(*fx,801,1); + assert(fx->acceptedSettings().renderMode==10); + juce::MemoryBlock snapshot; + fx->getStateInformation(snapshot); + assert(snapshot.getSize()==63); + juce::MemoryInputStream input(snapshot.getData(),snapshot.getSize(),false); + assert(input.readInt()==0x534f4e4b&&input.readInt()==12); + auto restored=std::make_unique(); + restored->prepareToPlay(44100.,128); + assert(restored->restoreUnpublishedState( + snapshot.getData(),static_cast(snapshot.getSize()))); + assert(restored->acceptedSettings().renderMode==10); + assert(restored->acceptedSettings().hrtfElevationTrimDegrees==-12.f); + restored->prepareToPlay(48000.,256); + assert(restored->isReady() && restored->acceptedSettings().renderMode==10); + // Actual direct FIR must distinguish P8.4 from P8.2 without double engine. + auto golden=std::make_unique(); + golden->prepareToPlay(48000.,128); + auto g=s;g.renderMode=0; + assert(golden->queueSettings(g,811)); + golden->consumeRealtimeEdits(); + assert(golden->pollCompletion(ack)&&ack.applied&&ack.requestId==811); + double reference=0,fused=0; + for(int n=0;n<50;++n){ + reference+=render(*golden,(n+200)*128); + fused+=render(*restored,(n+200)*128); + } + assert(reference>0.1 && fused>0.1); + assert(std::abs(fused-reference)>0.0002); + const double relativeDb=10.*std::log10(fused/reference); + assert(std::abs(relativeDb)<12.0); + // Audio-thread head-yaw change is a separate accepted v10 transaction. + s.headYawDegrees=60.f; + assert(fx->queueSettings(s,802)); + complete(*fx,802,400); + assert(fx->acceptedSettings().renderMode==10); + assert(fx->acceptedSettings().headYawDegrees==60.f); + s.renderMode=0;s.headYawDegrees=0.f; + assert(fx->queueSettings(s,803)); + complete(*fx,803,480); + assert(fx->acceptedSettings().renderMode==0); + // Unpublished workspace has no PCM clock: edits ACK without fade. + auto offline=std::make_unique(); + offline->prepareToPlay(48000.,128); + s.renderMode=10; + assert(offline->queueSettings(s,901)); + offline->consumeRealtimeEdits(); + assert(offline->pollCompletion(ack)&&ack.applied&&ack.requestId==901); + assert(offline->acceptedSettings().renderMode==10); + assert(offline->stateSnapshotQuiescent()); + // Old v4 SpeakerPhysical and music-LF480 are REJECTED acoustically. + // When migrated into a v12 research binary, they explicitly fall back P8.2. + // Backward-compatible v5 P8.4 session must keep exact mode 3. + { + const auto v5=legacy(5,3); + auto p84=std::make_unique(); + p84->prepareToPlay(48000.,128); + assert(p84->restoreUnpublishedState(v5.getData(),static_cast(v5.getSize()))); + assert(p84->acceptedSettings().renderMode==3); + } + // v6 P8.5 world-coherence sessions restore unchanged; never rewritten as focus. + { + const auto v6=legacy(6,4); + auto p85=std::make_unique(); + p85->prepareToPlay(48000.,128); + assert(p85->restoreUnpublishedState(v6.getData(),static_cast(v6.getSize()))); + assert(p85->acceptedSettings().renderMode==4); + } + // v7 P8.6 focused music session must retain render mode 5, not 6. + { + const auto v7=legacy(7,5); + auto p86=std::make_unique(); + p86->prepareToPlay(48000.,128); + assert(p86->restoreUnpublishedState(v7.getData(),static_cast(v7.getSize()))); + assert(p86->acceptedSettings().renderMode==5); + } + // v8 P8.7 session must preserve mode 6, and no HRTF trim is invented. + { + const auto v8=legacy(8,6); + auto p87=std::make_unique(); + p87->prepareToPlay(48000.,128); + assert(p87->restoreUnpublishedState(v8.getData(),static_cast(v8.getSize()))); + assert(p87->acceptedSettings().renderMode==6); + assert(p87->acceptedSettings().hrtfElevationTrimDegrees==0.f); + } + // P9.0 v11 state is restored without accidentally opting into P9.2. + { + const auto oldP9=legacy(11,9); + auto oldP9Fx=std::make_unique(); + oldP9Fx->prepareToPlay(48000.,128); + assert(oldP9Fx->restoreUnpublishedState( + oldP9.getData(),static_cast(oldP9.getSize()))); + assert(oldP9Fx->acceptedSettings().renderMode==9); + assert(oldP9Fx->acceptedSettings().hrtfElevationTrimDegrees==-12.f); + } + // Existing v10 P8.9 session must remain byte-compatible and mode 8. + { + const auto v10=legacy(10,8); + auto p89=std::make_unique(); + p89->prepareToPlay(48000.,128); + assert(p89->restoreUnpublishedState(v10.getData(),static_cast(v10.getSize()))); + assert(p89->acceptedSettings().renderMode==8); + assert(p89->acceptedSettings().hrtfElevationTrimDegrees==-12.f); + } + // Exact v9 P8.8 session must retain mode 7 and HRTF trim -12°. + { + const auto v9=legacy(9,7); + auto p88=std::make_unique(); + p88->prepareToPlay(48000.,128); + assert(p88->restoreUnpublishedState(v9.getData(),static_cast(v9.getSize()))); + assert(p88->acceptedSettings().renderMode==7); + assert(p88->acceptedSettings().hrtfElevationTrimDegrees==-12.f); + } + for(int version:{1,2,3,4}){ + const auto old=legacy(version); + auto dest=std::make_unique(); + dest->prepareToPlay(48000.,128); + assert(dest->restoreUnpublishedState(old.getData(),static_cast(old.getSize()))); + assert(dest->acceptedSettings().renderMode==0); + if(version==4){ + assert(!dest->acceptedSettings().musicCompatibleLowFrequency); + assert(dest->acceptedSettings().headYawDegrees==0.f); + } + } + // Even legacy v4 MusicBed with a stale LF480 toggle must be sanitized + // so the new v12 research UI always discovers truthful P8.4 capability. + const auto v4GoldenWithLf=legacy(4,0); + auto downgrade=std::make_unique(); + downgrade->prepareToPlay(48000.,128); + assert(downgrade->restoreUnpublishedState( + v4GoldenWithLf.getData(),static_cast(v4GoldenWithLf.getSize()))); + assert(downgrade->acceptedSettings().renderMode==0); + assert(!downgrade->acceptedSettings().musicCompatibleLowFrequency); + auto broken=std::make_unique(); + broken->prepareToPlay(48000.,128); + assert(!broken->restoreUnpublishedState(snapshot.getData(),62)); + juce::MemoryBlock corrupt(snapshot); + auto* ptr=static_cast(corrupt.getData()); + ptr[54]=0xff; // signed JUCE bool, 0xff must never become true + assert(!broken->restoreUnpublishedState(corrupt.getData(),63)); + corrupt=snapshot;ptr=static_cast(corrupt.getData()); + ptr[50]=2;ptr[51]=ptr[52]=ptr[53]=0; // old physical mode in v10 forbidden + assert(!broken->restoreUnpublishedState(corrupt.getData(),63)); + restored->sealForRealtime(); + assert(!restored->restoreUnpublishedState(snapshot.getData(),63)); + std::printf("PASS P92 JUCE v12: audio ACK fade, single native graph A/B, " + "safe v1-v10 migration, v11 63-byte state and device reopen; " + "P92_vs_P82_RMS_dB=%.3f; ASIO/headphone NOT PROVEN\n",relativeDb); +} From 7f7e4eb0a166ffe4d9a200eb353ffa094f914222 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:09:42 +0700 Subject: [PATCH 12/26] ci(sonku): full P9.1+P9.2 PCM preflight, JUCE v12/legacy CTest and Windows FAT under isolated research branch --- .github/workflows/p1-windows.yml | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 2dac405ab..681791f93 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -647,7 +647,7 @@ jobs: sonku-p90-source: # Runs only on the P9 research PR, even while its production jobs skip. name: SonKu P9 exact-source C++ PCM preflight - if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') }} + if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || startsWith(github.event.pull_request.head.ref, 'research/sonku-p912-')) }} runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -661,17 +661,20 @@ jobs: set -euo pipefail node --check site/preview-v2/assets/mixer-native-sonku.js node tests/sonku_p90_dropdown_stability_test.cjs + node tests/sonku_p92_dropdown_stability_test.cjs FLAGS="-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 -DSONKU_P82_MULTIBAND_ROOM_RESEARCH=1 -DSONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 -DSONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1 -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 -DSONKU_P87_MUSIC_BODY_RESEARCH=1 -DSONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1 -DSONKU_P89_DEPTH_COHERENCE_RESEARCH=1 -DSONKU_P90_TRUE_EXTERNAL_RESEARCH=1" g++ $FLAGS tests/sonku_p90_true_external_source_test.cpp -o /tmp/sonku-p90 /tmp/sonku-p90 + g++ $FLAGS -DSONKU_P92_MUSIC_BASS_FOUNDATION=1 tests/sonku_p92_music_bass_source_test.cpp -o /tmp/sonku-p92 + /tmp/sonku-p92 g++ $FLAGS tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/sonku-p89 /tmp/sonku-p89 - echo "SONKU_P90_NATIVE_SOURCE_CTEST_PASSED" + echo "SONKU_P90_AND_P92_NATIVE_SOURCE_CTEST_PASSED" sonku-p90-windows-fat: name: SonKu P9 actual JUCE / GUI portable x64 needs: sonku-p90-source - if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') }} + if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || startsWith(github.event.pull_request.head.ref, 'research/sonku-p912-')) }} runs-on: windows-2022 timeout-minutes: 55 steps: @@ -708,21 +711,23 @@ jobs: -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT=ON ` -DBUILD_TESTING=ON if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $cache = Get-Content build/CMakeCache.txt -Raw - if ($cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT:BOOL=ON') { + if ($cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P92_NATIVE_RT:BOOL=ON') { throw 'SONKU_P90_WRONG_NATIVE_CONFIGURATION' } - name: Build real native JUCE PCM, state ACK, and Windows GUI shell: pwsh run: | - cmake --build build --config Release --parallel 2 --target ARMixSonKuP90NativeTests ARMixSonKuP90SourceTests ARMixSonKuP89NativeTests ARMixSonKuP89SourceTests ARMixConsole + cmake --build build --config Release --parallel 2 --target ARMixSonKuP92NativeTests ARMixSonKuP92SourceTests ARMixSonKuP90NativeTests ARMixSonKuP90SourceTests ARMixSonKuP89NativeTests ARMixSonKuP89SourceTests ARMixConsole if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } if (-not (Test-Path -LiteralPath 'build/ARMixConsole_artefacts/Release/AR MIX Studio.exe' -PathType Leaf)) { throw 'SONKU_P90_NATIVE_GUI_EXE_MISSING' } - ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP(89RoomAnchoredStereoAndP88GoldenParity|89JuceV10AppliedAckAndV9Restore|90StereoExternalizationSource|90JuceV11AppliedAckAndLegacyRestore)$' + ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP(89RoomAnchoredStereoAndP88GoldenParity|89JuceV10AppliedAckAndV9Restore|90StereoExternalizationSource|90JuceV11AppliedAckAndLegacyRestore|92MusicFidelityPhysicalBassSource|92JuceV12AppliedAckAndV11Restore)$' if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Verified portable package, no installer or release shell: pwsh @@ -734,14 +739,14 @@ jobs: & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } Copy-Item docs/THIRD_PARTY_8D_SONKU_HRTF.md dist/THIRD_PARTY_8D_SONKU_HRTF.md - Copy-Item docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md dist/SONKU_P90_FIELD_FAT.md + Copy-Item docs/SONKU_P912_MUSIC_FIDELITY_PHYSICAL_BASS_FAT_20261116.md dist/SONKU_P92_FIELD_FAT.md $provenance = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json if ($provenance.sourceCommit -ne (git rev-parse HEAD).Trim()) { throw 'SONKU_P90_SOURCE_COMMIT_MISMATCH' } $provenance | Add-Member -Force -NotePropertyName sonkuExperiment -NotePropertyValue @{ - mode = 'P9.0_TRUE_EXTERNAL_SPEAKER' - stateSchema = 11 + mode = 'P9.1_P9.2_MUSIC_FIDELITY_PHYSICAL_BASS' + stateSchema = 12 headphoneFat = 'PENDING' publicRelease = $false physicalAsioQualified = $false @@ -750,7 +755,7 @@ jobs: $provenance | ConvertTo-Json -Depth 20 | Set-Content dist/BUILD_PROVENANCE.json -Encoding utf8 - uses: actions/upload-artifact@v4 with: - name: ArSonMix-SonKu-P90-Windows-x64-${{ github.run_id }} + name: ArSonMix-SonKu-P92-Music-Bass-Windows-x64-${{ github.run_id }} path: dist/ if-no-files-found: error retention-days: 21 From c973dea69e7d30ed4791bfc68e7347021df62ca4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:10:08 +0700 Subject: [PATCH 13/26] test(sonku): retain P9.0 stable-dropdown regression in newer schema-12 menu tree --- tests/sonku_p90_dropdown_stability_test.cjs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/sonku_p90_dropdown_stability_test.cjs b/tests/sonku_p90_dropdown_stability_test.cjs index 890d0de90..8749a9585 100644 --- a/tests/sonku_p90_dropdown_stability_test.cjs +++ b/tests/sonku_p90_dropdown_stability_test.cjs @@ -7,13 +7,13 @@ const assert=require("node:assert/strict"); const fs=require("node:fs"); const vm=require("node:vm"); const source=fs.readFileSync("site/preview-v2/assets/mixer-native-sonku.js","utf8"); -const start=source.indexOf(' if(p90Capable && picker.dataset.nativeModeSet!=="p90"){'); -const end=source.indexOf(" const v=p90Capable?",start); +const start=source.indexOf(' if(p92Capable && picker.dataset.nativeModeSet!=="p92"){'); +const end=source.indexOf(" const v=p92Capable?",start); assert(start!==-1&&end>start,"Locate actual native SonKu mode menu reconciliation"); const actualReconcile=source.slice(start,end); const renderMenu=vm.runInNewContext( '(function(picker,root,cap){ const {'+ - 'p90Capable,p89Capable,p88Capable,p87Capable,p86Capable,'+ + 'p92Capable,p90Capable,p89Capable,p88Capable,p87Capable,p86Capable,'+ 'p85Capable,p84Capable,p83Capable}=cap;\n'+ actualReconcile+'\n})',{} ); @@ -45,7 +45,7 @@ const label={textContent:""}; const root={querySelector(selector){ assert.equal(selector,".sk-render-label");return label; }}; -const full={p90Capable:true,p89Capable:true,p88Capable:true, +const full={p92Capable:false,p90Capable:true,p89Capable:true,p88Capable:true, p87Capable:true,p86Capable:true,p85Capable:true,p84Capable:true, p83Capable:false}; renderMenu(picker,root,full); From 79f15053e910b27f290de0f5e6f64f29f23a87e0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 05:10:31 +0700 Subject: [PATCH 14/26] test(sonku): prove P9.2 dropdown stable through 40 native ACK snapshots with P9/P8 capability flags --- tests/sonku_p92_dropdown_stability_test.cjs | 93 +++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 tests/sonku_p92_dropdown_stability_test.cjs diff --git a/tests/sonku_p92_dropdown_stability_test.cjs b/tests/sonku_p92_dropdown_stability_test.cjs new file mode 100644 index 000000000..dadad4ae5 --- /dev/null +++ b/tests/sonku_p92_dropdown_stability_test.cjs @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Exercise the ACTUAL SonKu render-mode DOM-update branch, not a hand-copied +// model. Regression: native schema 12 advertises P9.2, P9.0 and P8.9 capabilities; +// priority must remain P9.2 > P9.0 > P8.9 without rewriting the popup. +"use strict"; +const assert=require("node:assert/strict"); +const fs=require("node:fs"); +const vm=require("node:vm"); +const source=fs.readFileSync("site/preview-v2/assets/mixer-native-sonku.js","utf8"); +const start=source.indexOf(' if(p92Capable && picker.dataset.nativeModeSet!=="p92"){'); +const end=source.indexOf(" const v=p92Capable?",start); +assert(start!==-1&&end>start,"Locate actual native SonKu mode menu reconciliation"); +const actualReconcile=source.slice(start,end); +const renderMenu=vm.runInNewContext( + '(function(picker,root,cap){ const {'+ + 'p92Capable,p90Capable,p89Capable,p88Capable,p87Capable,p86Capable,'+ + 'p85Capable,p84Capable,p83Capable}=cap;\n'+ + actualReconcile+'\n})',{} +); +const syncMatch=source.match(/if\(picker\.value!==v\)picker\.value=v;/); +assert(syncMatch,"Native render must not reset an unchanged open popup value"); +const syncSelection=vm.runInNewContext( + '(function(picker,v){'+syncMatch[0]+'})',{} +); +const optionWrites=[]; +const picker={dataset:{},isOpen:false,_markup:"",_value:"music", + get innerHTML(){return this._markup;}, + set innerHTML(markup){ + assert.equal(this.isOpen,false, + "Render must not replace