From a2506038a3364b8787d9ad5549e1502072ca6e44 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:41:53 +0700 Subject: [PATCH 01/26] feat(sonku): add phase-coherent P9 binaural stereo decoder kernel compositor --- .../builtin_fx/sonku/SonKuP90StereoDecoder.h | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 engine/builtin_fx/sonku/SonKuP90StereoDecoder.h diff --git a/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h b/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h new file mode 100644 index 000000000..4f70a0777 --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h @@ -0,0 +1,69 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include +#include + +// SonKu P9 opt-in: complex-coherent two-speaker transfer represented as +// two real FIRs per input. No separate audio engine, HRTF bypass or dry SIDE. +// Measured HRIR kernels contain the complex magnitude/phase relationships; +// the same real coefficient correction to both emitters alters only MID, +// while the full measured L-R SIDE transfer is algebraically invariant. +// +// For input L=M+S, R=M-S, output at either ear is +// [H_L+H_R + 2*c*(H_center-(H_L+H_R)/2)]*M + +// [H_L-H_R]*S. At c=1, coherent mono is precisely 2*H_center*M; +// anti-phase retains full measured (H_L-H_R)*S at ALL c. +// No frequency-domain phase reconstruction or additional convolution. +namespace armix::sonku::p90 { +class StereoDecoder final { +public: + bool prepare(double rate) noexcept { + if (!std::isfinite(rate) || rate < 44000. || rate > 48100.) return false; + const double pi=3.1415926535897932384626433832795; + (void)pi; + evidenceAlpha_=static_cast(1.-std::exp(-1./(rate*.080))); + smoothAlpha_=static_cast(1.-std::exp(-1./(rate*.120))); + reset(); + return true; + } + void reset() noexcept { + energyLeft_=energyRight_=cross_=0.f; + centerBlend_=1.f; // safe mono on first transient / cold prepare + } + void observe(float left,float right) noexcept { + const float l=std::clamp(left,-4.f,4.f); + const float r=std::clamp(right,-4.f,4.f); + energyLeft_+=evidenceAlpha_*(l*l-energyLeft_); + energyRight_+=evidenceAlpha_*(r*r-energyRight_); + cross_+=evidenceAlpha_*(l*r-cross_); + // Silence does not chase arbitrary coherence or inject PCM. + if(energyLeft_>1.e-8f || energyRight_>1.e-8f) { + const float den=std::sqrt(std::max(energyLeft_*energyRight_,1.e-14f)); + const float rho=std::clamp(cross_/den,-1.f,1.f); + const float target=std::clamp((rho-.25f)/.70f,0.f,1.f); + centerBlend_+=smoothAlpha_*(target-centerBlend_); + } + } + float centerBlend() const noexcept { + return std::clamp(centerBlend_,0.f,1.f); + } + template + void compose(const std::array,2>& center, + std::array,2>& left, + std::array,2>& right) const noexcept { + const float c=centerBlend(); + for(std::size_t ear=0;ear<2;++ear) + for(std::size_t k=0;k Date: Sun, 15 Nov 2026 16:43:31 +0700 Subject: [PATCH 02/26] feat(sonku): P9 true stereo measured HRTF pair with coherence-corrected mono and world-locked SIDE --- engine/builtin_fx/sonku/SonKuSpatialCore.h | 71 +++++++++++++++++++++- 1 file changed, 69 insertions(+), 2 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 8876ef41f..68ca3d80d 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -19,6 +19,9 @@ #error P8.4 single-graph music fusion requires the explicitly measured P8.2/P8.3 engine #endif #include "SonKuP84FusedMusicHrir.h" +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH +#include "SonKuP90StereoDecoder.h" +#endif #endif #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH #include "SonKuP87MusicalAirBody.h" @@ -99,7 +102,11 @@ inline bool valid(const Settings& s) noexcept { #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH #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 + s.renderMode<=9 && ((s.renderMode<3 || s.renderMode>9) || !s.musicCompatibleLowFrequency) && +#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 #else s.renderMode<=7 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5 && s.renderMode!=6 && s.renderMode!=7) || !s.musicCompatibleLowFrequency) && #endif @@ -124,6 +131,9 @@ inline bool valid(const Settings& s) noexcept { ((s.renderMode!=7 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH && s.renderMode!=8 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + && s.renderMode!=9 +#endif #endif ) || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40.f && s.directElevationDegrees+s.hrtfElevationTrimDegrees<=60.f)) && @@ -190,6 +200,9 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH if(!p84MusicKernel_.prepare(rate))return false; +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + if(!p90Decoder_.prepare(rate))return false; +#endif #endif #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH if(!p87Body_.prepare(rate))return false; @@ -254,6 +267,9 @@ class SonKuSpatialCore final { room_.reset(); reverb_.reset(); integrity_.reset(); +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + p90Decoder_.reset(); +#endif #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH p83LowFrequency_.reset(); #endif @@ -484,6 +500,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + && p83Mode_!=p83::Mode::MusicSpatialP90 +#endif #endif #endif #endif @@ -526,6 +545,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif #endif #endif @@ -544,6 +566,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif #endif #endif @@ -554,6 +579,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif #endif ; @@ -570,6 +598,9 @@ class SonKuSpatialCore final { ((p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif )?0.27f:0.13f)* #else @@ -583,6 +614,9 @@ class SonKuSpatialCore final { (p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif )? 1.f/(1.f+0.10f*(settings_.sourceDistanceMeters-1.6f)):1.f; @@ -590,7 +624,11 @@ class SonKuSpatialCore final { #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH // Room-energy transfer is computed once per callback block; no new // FIR/filter memory. 1.6m/ROOM OFF keeps exact P8.8 PCM. - const bool p89Stage=p83Mode_==p83::Mode::MusicSpatialP89; + const bool p89Stage=p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + ||p83Mode_==p83::Mode::MusicSpatialP90 +#endif + ; const float p89Depth=p89Stage&&roomEnabled? std::clamp((settings_.sourceDistanceMeters-1.6f)/6.4f,0.f,1.f):0.f; const float p89SideGain=1.f-.22f*p89Depth; @@ -621,6 +659,9 @@ 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); +#endif // Preserve strong anti-correlated music side energy without // collapsing it into the two virtual mono HRTF sources. The // independent guard has no hidden UI state or new audio bus. @@ -656,6 +697,9 @@ class SonKuSpatialCore final { // Headlocked SIDE is kept >=78% at maximum distance; early // 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; +#endif #endif history_[0][write_]=x0; history_[1][write_]=x1; @@ -910,6 +954,9 @@ class SonKuSpatialCore final { || ((p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif ) && settings_.hrtfElevationTrimDegrees!=0.f) @@ -922,6 +969,9 @@ class SonKuSpatialCore final { +((p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif )? settings_.hrtfElevationTrimDegrees:0.f) @@ -966,6 +1016,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + && p83Mode_!=p83::Mode::MusicSpatialP90 +#endif #endif #endif #endif @@ -1004,6 +1057,9 @@ class SonKuSpatialCore final { p83Mode_==p83::Mode::MusicSpatialP88 || #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH p83Mode_==p83::Mode::MusicSpatialP89 || +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + p83Mode_==p83::Mode::MusicSpatialP90 || +#endif #endif #endif #endif @@ -1029,6 +1085,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP90 +#endif #endif #endif #endif @@ -1042,7 +1101,12 @@ class SonKuSpatialCore final { settings_.stereoSpreadDegrees,p83HeadYaw_); interpolate(targets_[0],positions.leftHead); interpolate(targets_[1],positions.rightHead); - p84MusicKernel_.merge(centerTarget_,targets_[0],targets_[1]); +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + if(p83Mode_==p83::Mode::MusicSpatialP90) + p90Decoder_.compose(centerTarget_,targets_[0],targets_[1]); + else +#endif + p84MusicKernel_.merge(centerTarget_,targets_[0],targets_[1]); if(!haveKernel_)kernels_=targets_; haveKernel_=true; return; @@ -1136,6 +1200,9 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH p84::FusedMusicHrir p84MusicKernel_{}; +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + p90::StereoDecoder p90Decoder_{}; +#endif #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH p87::MusicalAirBody p87Body_{}; #endif From 1c92127bd774f7eb9cf7208b73e36e08430f4eb0 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:43:51 +0700 Subject: [PATCH 03/26] feat(sonku): reserve isolated P9 native render mode 9 without enabling legacy modes --- 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 3b7e3781e..2820af40f 100644 --- a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h +++ b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h @@ -20,6 +20,9 @@ enum class Mode : std::uint8_t { ,MusicSpatialP88=7 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH ,MusicSpatialP89=8 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + ,MusicSpatialP90=9 +#endif #endif #endif #endif @@ -43,6 +46,9 @@ inline bool valid(Mode m) noexcept { || m==Mode::MusicSpatialP88 #if defined(SONKU_P89_DEPTH_COHERENCE_RESEARCH) && SONKU_P89_DEPTH_COHERENCE_RESEARCH || m==Mode::MusicSpatialP89 +#if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH + || m==Mode::MusicSpatialP90 +#endif #endif #endif #endif From e4819be8f45b63f858f29bef990fca4855f37425 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:44:12 +0700 Subject: [PATCH 04/26] feat(sonku): add isolated v11 state for P9, preserve 63-byte v1-v10 .smix 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 e762a02da..6ed46528f 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -163,7 +163,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, #if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT #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 + out.writeInt(11); // unchanged 63-byte state; P9 mode 9 +#else out.writeInt(10); // 63 bytes v9 layout, opt-in mode 8 +#endif #else out.writeInt(9); // v8 59-byte state + 4-byte HRTF trim #endif @@ -247,6 +251,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, &&version!=9 #if defined(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT &&version!=10 +#if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT + &&version!=11 +#endif #endif #endif #endif @@ -272,6 +279,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, ||(version==9&&size!=63) #if defined(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT ||(version==10&&size!=63) +#if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT + ||(version==11&&size!=63) +#endif #endif #endif #endif @@ -352,6 +362,13 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, next.renderMode!=4 && next.renderMode!=5 && next.renderMode!=6 && next.renderMode!=7 && next.renderMode!=8)return false; if(version==10 && next.musicCompatibleLowFrequency)return false; +#if defined(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT + if(version==11 && next.renderMode!=0 && next.renderMode!=3 && + next.renderMode!=4 && next.renderMode!=5 && next.renderMode!=6 && + next.renderMode!=7 && next.renderMode!=8 && next.renderMode!=9) + return false; + if(version==11 && next.musicCompatibleLowFrequency)return false; +#endif #endif #endif #endif From 9dbfb3bfecaf51151526e51da3fdee4dabaff73f Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:44:26 +0700 Subject: [PATCH 05/26] feat(sonku): native bridge schema 11 capability-gated P9 mode and strict validation --- src/SonKuNativeBridgeContract.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/SonKuNativeBridgeContract.h b/src/SonKuNativeBridgeContract.h index 9c9924e78..f5e55bdda 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_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT +#if 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; #elif defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT return 9; @@ -101,7 +103,11 @@ inline bool decodeSettings(const juce::var& values,armix::sonku::Settings& out) #if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT #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(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; +#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 #else if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4 && proposed.renderMode!=5 && proposed.renderMode!=6 && proposed.renderMode!=7)return false; #endif From bb6cbc91d7bcbc044da4f4d8a723e6caf59f25dc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:44:39 +0700 Subject: [PATCH 06/26] feat(sonku): advertise P9 only from native prepared measured-HRTF instance --- src/Main.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/Main.cpp b/src/Main.cpp index 5618ac7b0..3a9937b8d 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3046,7 +3046,18 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) reply->setProperty("p8TransparentBass",true); #endif -#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(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); + } +#elif defined(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT if(processor && processor->preparedReflectionProfile()== armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) { reply->setProperty("p84MusicFusion",true); From 77f27120b4d277df8feedd900f91e7afd5410d60 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:45:49 +0700 Subject: [PATCH 07/26] feat(sonku): expose P9 only with schema 11 accepted DSP and preserve P8.9 UI --- site/preview-v2/assets/mixer-native-sonku.js | 53 ++++++++++++++------ 1 file changed, 37 insertions(+), 16 deletions(-) diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index e5d6c1428..8a9bdb09d 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.hrtfElevationTrimDegrees??0):0; + const spectralOffset=(s.renderMode===7||s.renderMode===8||s.renderMode===9)?(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<=8 && + Number.isInteger(s.renderMode)&&s.renderMode>=0&&s.renderMode<=9 && typeof s.musicCompatibleLowFrequency==="boolean" && (s.hrtfElevationTrimDegrees===undefined || ( Number.isFinite(s.hrtfElevationTrimDegrees) && s.hrtfElevationTrimDegrees>=-30 && s.hrtfElevationTrimDegrees<=20 && - ((s.renderMode!==7&&s.renderMode!==8) || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40 && + ((s.renderMode!==7&&s.renderMode!==8&&s.renderMode!==9) || (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,musicSafeStereo=false,p8TransparentBass=false,p82MultibandRoom=false, + xyzCapable=false,p83Capable=false,p84Capable=false,p85Capable=false,p86Capable=false,p87Capable=false,p88Capable=false,p89Capable=false,p90Capable=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,18 @@ function render(){ const row=$("skRenderRow");row.hidden=!(p83Capable||p84Capable); if(p83Capable||p84Capable){ const picker=$("skRenderMode"); - if(p89Capable && picker.dataset.nativeModeSet!=="p89"){ + if(p90Capable && picker.dataset.nativeModeSet!=="p90"){ + picker.innerHTML=''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''+ + ''; + picker.dataset.nativeModeSet="p90"; + root.querySelector(".sk-render-label").textContent="RENDER MODE · P9.0 HEADPHONE FAT"; + }else if(p89Capable && picker.dataset.nativeModeSet!=="p89"){ picker.innerHTML=''+ ''+ ''+ @@ -268,7 +279,8 @@ function render(){ picker.dataset.nativeModeSet="p83"; root.querySelector(".sk-render-label").textContent="RENDER MODE · P8.3 TEST"; } - const v=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"): + 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"): + 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"): p86Capable?(s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): @@ -323,7 +335,7 @@ function render(){ $("skElevationValue").textContent=s.directElevationDegrees.toFixed(1)+"°"; } const alignRow=$("skHrtfAlignRow"),align=$("skHrtfAlign"); - alignRow.hidden=!(p88Capable&&(s.renderMode===7||s.renderMode===8)); + alignRow.hidden=!(p88Capable&&(s.renderMode===7||s.renderMode===8||s.renderMode===9)); if(!alignRow.hidden){ const min=Math.max(-30,-40-s.directElevationDegrees); const max=Math.min(20,60-s.directElevationDegrees); @@ -331,7 +343,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=p89Capable&&s.renderMode===8? + root.querySelector(".sk-stage-caption").textContent=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": p88Capable&&s.renderMode===7? "P8.8 EAR-LEVEL HRTF ALIGNMENT · PHYSICAL XYZ INDEPENDENT · FAT REQUIRED": @@ -356,8 +370,10 @@ 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=musicSafeStereo - ?"Stereo WIDTH adjusts preserved L/R SIDE, not two separately located HRIR emitters" + root.querySelector(".sk-guide").textContent=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" :"Drag monitors to position · rotary knobs: vertical drag, double-click to reset"; if(!rangeEdits.has("skAmbience")) $("skAmbience").value=String(Math.round(s.ambience*100)); @@ -372,7 +388,8 @@ function render(){ // redrawn at 60 Hz. The native audio callback remains the time authority. drawSpeakers(); $("skMode").textContent=native()?(context()? - (p89Capable&&s.renderMode===8?"NATIVE P8.9 STEREO + ROOM · 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": p86Capable&&s.renderMode===5?"NATIVE P8.6 HORIZONTAL FOCUS · TEST": @@ -523,7 +540,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===5 || r.schemaVersion===6 || r.schemaVersion===7 || r.schemaVersion===8 || r.schemaVersion===9 || r.schemaVersion===10 || r.schemaVersion===11) && Number.isFinite(r.settings?.directElevationDegrees); if(r.schemaVersion!==2&&!measured)return; const incoming=normalizeSettings(r.settings); @@ -535,7 +552,9 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ Number.isInteger(incoming.renderMode) && typeof incoming.musicCompatibleLowFrequency==="boolean" && Number.isFinite(incoming.headYawDegrees); - p89Capable=r.schemaVersion===10 && r.p89StereoRoomDepth===true && + p90Capable=r.schemaVersion===11 && r.p90TrueExternalSpeaker===true && + Number.isFinite(incoming.hrtfElevationTrimDegrees); + p89Capable=(r.schemaVersion===10||p90Capable) && r.p89StereoRoomDepth===true && Number.isFinite(incoming.hrtfElevationTrimDegrees); p88Capable=(r.schemaVersion===9||p89Capable) && r.p88PerceptualAlignment===true && Number.isFinite(incoming.hrtfElevationTrimDegrees); @@ -549,7 +568,8 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ (p86Capable&&incoming.renderMode===5)|| (p87Capable&&incoming.renderMode===6)|| (p88Capable&&incoming.renderMode===7)|| - (p89Capable&&incoming.renderMode===8)) && + (p89Capable&&incoming.renderMode===8)|| + (p90Capable&&incoming.renderMode===9)) && typeof incoming.musicCompatibleLowFrequency==="boolean" && incoming.musicCompatibleLowFrequency===false && Number.isFinite(incoming.headYawDegrees); @@ -584,7 +604,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;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;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;} @@ -592,7 +612,8 @@ $("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapa $("skRenderMode").addEventListener("change",()=>{ if(!(p83Capable||p84Capable))return; const v=$("skRenderMode").value; - const mode=p89Capable?(v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): + 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): + 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): p86Capable?(v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): From 844de88aca1892e704b942c6b850570251cf36ee Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:46:36 +0700 Subject: [PATCH 08/26] perf(sonku): decimate P9 coherence normalization to 16-sample FIR retarget --- engine/builtin_fx/sonku/SonKuP90StereoDecoder.h | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h b/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h index 4f70a0777..308c7f226 100644 --- a/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h +++ b/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h @@ -21,10 +21,8 @@ class StereoDecoder final { public: bool prepare(double rate) noexcept { if (!std::isfinite(rate) || rate < 44000. || rate > 48100.) return false; - const double pi=3.1415926535897932384626433832795; - (void)pi; evidenceAlpha_=static_cast(1.-std::exp(-1./(rate*.080))); - smoothAlpha_=static_cast(1.-std::exp(-1./(rate*.120))); + smoothAlpha_=static_cast(1.-std::exp(-16./(rate*.120))); reset(); return true; } @@ -38,22 +36,22 @@ class StereoDecoder final { energyLeft_+=evidenceAlpha_*(l*l-energyLeft_); energyRight_+=evidenceAlpha_*(r*r-energyRight_); cross_+=evidenceAlpha_*(l*r-cross_); - // Silence does not chase arbitrary coherence or inject PCM. + } + float centerBlend() noexcept { + // 1 sqrt per 16-sample FIR retarget, not each PCM sample. if(energyLeft_>1.e-8f || energyRight_>1.e-8f) { const float den=std::sqrt(std::max(energyLeft_*energyRight_,1.e-14f)); const float rho=std::clamp(cross_/den,-1.f,1.f); const float target=std::clamp((rho-.25f)/.70f,0.f,1.f); centerBlend_+=smoothAlpha_*(target-centerBlend_); } - } - float centerBlend() const noexcept { return std::clamp(centerBlend_,0.f,1.f); } template void compose(const std::array,2>& center, std::array,2>& left, std::array,2>& right) const noexcept { - const float c=centerBlend(); + const float c=std::clamp(centerBlend_,0.f,1.f); for(std::size_t ear=0;ear<2;++ear) for(std::size_t k=0;k Date: Sun, 15 Nov 2026 16:46:49 +0700 Subject: [PATCH 09/26] fix(sonku): update adaptive mono coherence on each decimated P9 kernel retarget --- engine/builtin_fx/sonku/SonKuP90StereoDecoder.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h b/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h index 308c7f226..f760c673d 100644 --- a/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h +++ b/engine/builtin_fx/sonku/SonKuP90StereoDecoder.h @@ -50,8 +50,8 @@ class StereoDecoder final { template void compose(const std::array,2>& center, std::array,2>& left, - std::array,2>& right) const noexcept { - const float c=std::clamp(centerBlend_,0.f,1.f); + std::array,2>& right) noexcept { + const float c=centerBlend(); for(std::size_t ear=0;ear<2;++ear) for(std::size_t k=0;k Date: Sun, 15 Nov 2026 16:48:06 +0700 Subject: [PATCH 10/26] test(sonku): cover P9 real native PCM spatial SIDE, anti-phase, coherent MID, yaw, range and 64/256 parity --- tests/sonku_p90_true_external_source_test.cpp | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 tests/sonku_p90_true_external_source_test.cpp diff --git a/tests/sonku_p90_true_external_source_test.cpp b/tests/sonku_p90_true_external_source_test.cpp new file mode 100644 index 000000000..eeb9342b4 --- /dev/null +++ b/tests/sonku_p90_true_external_source_test.cpp @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// SonKu P9 measured stereo kernel / actual native PCM regression. +#if defined(NDEBUG) +#undef NDEBUG +#endif +#if !defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) || !SONKU_P90_TRUE_EXTERNAL_RESEARCH +#error P9 must be explicitly enabled for this test +#endif +#include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include "../engine/builtin_fx/sonku/SonKuP90StereoDecoder.h" +#include +#include +#include +#include +#include +#include +#include +using namespace armix::sonku; +using Stereo=std::array,2>; +constexpr float pi=3.14159265358979323846f; +static Stereo run(int mode,int rate,int block,int room,float distance, + float width,float yaw,int material,int frames=4096) { + auto core=std::make_unique(); + assert(core->prepare(rate,SonKuReflectionProfile::SixSurfaceKemarResearch)); + Settings p{}; + p.moving=false; + p.startAzimuthDegrees=20.f; + p.stereoSpreadDegrees=width; + p.headYawDegrees=yaw; + p.spacePreset=room; + p.sourceDistanceMeters=distance; + p.roomAmount=room?0.8f:0.f; + p.ambience=room?0.45f:0.f; + p.hrtfElevationTrimDegrees=-8.f; + p.renderMode=mode; + p.outputTrim=.6f; + p.spatialMix=1.f; + assert(valid(p)); + assert(core->setSettings(p)); + Stereo out{std::vector(frames),std::vector(frames)}; + for(int i=0;iprocess(out[0].data()+i,out[1].data()+i,std::min(block,frames-i)); + return out; +} +static double energy(const Stereo& pcm) { + double e=0.; + for(std::size_t k=0;k,2>; + Kernel center{},left{},right{}; + for(int ear=0;ear<2;++ear)for(int k=0;k<8;++k){ + center[ear][k]=float(k+1)*.003f; + left[ear][k]=float(ear+1)*float(k+1)*.011f; + right[ear][k]=float(ear+2)*float(k+1)*.006f; + } + const auto oldL=left,oldR=right; + p90::StereoDecoder decoder; + assert(decoder.prepare(48000.)); + // First transient protection: exact centered MID from corrected pair. + decoder.compose(center,left,right); + for(int ear=0;ear<2;++ear)for(int k=0;k<8;++k){ + assert(std::abs((left[ear][k]+right[ear][k])-2*center[ear][k])<1.e-6f); + assert(std::abs((left[ear][k]-right[ear][k])- + (oldL[ear][k]-oldR[ear][k]))<1.e-6f); + } + // Correlation transitions are bounded, no NaN or phase-inverted SIDE. + for(int i=0;i<24000;++i){ + decoder.observe(i%2?0.1f:-0.1f,0.f); + if(i%16==0){ + left=oldL;right=oldR; + decoder.compose(center,left,right); + } + } + assert(decoder.centerBlend()<.02f); +} +int main(){ + algebraicTransferGate(); + for(int rate:{44100,48000}){ + for(float width:{60.f,104.f,180.f}) + for(int material:{0,1,2,3,4}){ + const auto p9=run(9,rate,64,0,1.6f,width,0.f,material); + const auto p9b=run(9,rate,256,0,1.6f,width,0.f,material); + const auto p89=run(8,rate,128,0,1.6f,width,0.f,material); + assert(delta(p9,p9b)==0. && "callback block size changed PCM"); + assert(energy(p9)>1.e-7 && "P9 lost stereo input"); + // Direct stereo always differs from fused+head-locked P8.9. + assert(delta(p9,p89)>1.e-10); + } + for(float yaw:{-90.f,0.f,90.f,180.f}){ + const auto left=run(9,rate,128,3,6.7f,104.f,yaw,2,8192); + const auto right=run(9,rate,128,3,6.7f,104.f,yaw,3,8192); + const auto anti=run(9,rate,128,3,6.7f,104.f,yaw,1,8192); + assert(energy(left)>1.e-7&&energy(right)>1.e-7&&energy(anti)>1.e-7); + assert(delta(left,right)>1.e-6); + if(yaw==0.f){ + const auto rotated=run(9,rate,128,3,6.7f,104.f,90.f,2,8192); + assert(delta(left,rotated)>1.e-6 && "head yaw not spatializing treble"); + } + } + const auto near=run(9,rate,64,3,1.6f,104.f,0.f,4,8192); + const auto far=run(9,rate,256,3,6.7f,104.f,0.f,4,8192); + const auto veryFar=run(9,rate,128,3,10.f,104.f,0.f,4,8192); + assert(delta(near,far)>1.e-7&&delta(far,veryFar)>1.e-7); + assert(energy(veryFar)>1.e-6); + auto s=Settings{};s.renderMode=9;s.spacePreset=3;s.sourceDistanceMeters=6.7f; + assert(valid(s)); + s.hrtfElevationTrimDegrees=-35.f; + assert(!valid(s)); + std::printf("P90_RATE,%d,near=%.7f,far=%.7f,10m=%.7f\n", + rate,energy(near),energy(far),energy(veryFar)); + } + std::puts("PASS P90 NATIVE PCM: real 2x2 directional speaker HRIR, invariant anti-phase transfer, coherent MID, 44.1/48k, 64/128/256, yaw and distance"); +} From 185f3d69af9e3b762724619e1522fbbca44de6cc Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:48:55 +0700 Subject: [PATCH 11/26] build(sonku): opt-in P9 CMake native DSP+JUCE targets with mandatory P8.9 ancestry --- CMakeLists.txt | 66 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 65 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e7340aad..1d9ebab73 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,13 @@ if(ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT AND NOT ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) message(FATAL_ERROR "P8.9 requires P8.8 perceptual alignment") endif() +# P9.0 opt-in experiment. Production builds and previous P8.x modes remain OFF. +option(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT + "Private P9 true external speaker two-source binaural PCM experiment" OFF) +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() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -303,7 +310,9 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=1> $<$:SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1> $<$:ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=1> - $<$:SONKU_P89_DEPTH_COHERENCE_RESEARCH=1>) + $<$:SONKU_P89_DEPTH_COHERENCE_RESEARCH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=1> + $<$:SONKU_P90_TRUE_EXTERNAL_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. @@ -763,6 +772,61 @@ if(BUILD_TESTING) SONKU_P89_DEPTH_COHERENCE_RESEARCH=1) add_test(NAME NativeSonKuP89JuceV10AppliedAckAndV9Restore COMMAND ARMixSonKuP89NativeTests) + if(ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) + add_executable(ARMixSonKuP90SourceTests + tests/sonku_p90_true_external_source_test.cpp) + target_compile_features(ARMixSonKuP90SourceTests PRIVATE cxx_std_20) + target_compile_definitions(ARMixSonKuP90SourceTests 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) + add_test(NAME NativeSonKuP90StereoExternalizationSource + COMMAND ARMixSonKuP90SourceTests) + juce_add_console_app(ARMixSonKuP90NativeTests + PRODUCT_NAME "ArSonMix SonKu P90 JUCE v11 State Tests") + target_sources(ARMixSonKuP90NativeTests PRIVATE + tests/sonku_p90_native_juce_v11_test.cpp) + target_compile_features(ARMixSonKuP90NativeTests PRIVATE cxx_std_20) + target_link_libraries(ARMixSonKuP90NativeTests PRIVATE + juce::juce_audio_processors juce::juce_recommended_config_flags) + target_compile_definitions(ARMixSonKuP90NativeTests 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 + 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) + add_test(NAME NativeSonKuP90JuceV11AppliedAckAndLegacyRestore + COMMAND ARMixSonKuP90NativeTests) + endif() endif() endif() endif() From ed4b7409609961fb619f78ffc42437927cdc9540 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:49:22 +0700 Subject: [PATCH 12/26] test(sonku): P9 JUCE v11 actual audio ACK, mode 9 PCM, v1-v10 state and forbidden P8.3 regression --- tests/sonku_p90_native_juce_v11_test.cpp | 251 +++++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 tests/sonku_p90_native_juce_v11_test.cpp diff --git a/tests/sonku_p90_native_juce_v11_test.cpp b/tests/sonku_p90_native_juce_v11_test.cpp new file mode 100644 index 000000000..5bd11e201 --- /dev/null +++ b/tests/sonku_p90_native_juce_v11_test.cpp @@ -0,0 +1,251 @@ +// 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_P90_NATIVE_RT) || !ARMIX_SONKU_EXPERIMENTAL_P90_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 && "P90 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()==11); + 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=.75f; + s.spacePreset=1;s.sourceDistanceMeters=1.6f;s.roomAmount=.55f;s.ambience=.3f; + s.headYawDegrees=0.f;s.musicCompatibleLowFrequency=false;s.renderMode=9;s.hrtfElevationTrimDegrees=-12.f; + auto json=acceptedSettings(s); + Settings decoded{}; + assert(decodeSettings(json,decoded)&&decoded.renderMode==9); + for(int rejected:{-1,1,2,10,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==9); + juce::MemoryBlock snapshot; + fx->getStateInformation(snapshot); + assert(snapshot.getSize()==63); + juce::MemoryInputStream input(snapshot.getData(),snapshot.getSize(),false); + assert(input.readInt()==0x534f4e4b&&input.readInt()==11); + auto restored=std::make_unique(); + restored->prepareToPlay(44100.,128); + assert(restored->restoreUnpublishedState( + snapshot.getData(),static_cast(snapshot.getSize()))); + assert(restored->acceptedSettings().renderMode==9); + assert(restored->acceptedSettings().hrtfElevationTrimDegrees==-12.f); + restored->prepareToPlay(48000.,256); + assert(restored->isReady() && restored->acceptedSettings().renderMode==9); + // 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)<8.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==9); + 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=9; + assert(offline->queueSettings(s,901)); + offline->consumeRealtimeEdits(); + assert(offline->pollCompletion(ack)&&ack.applied&&ack.requestId==901); + assert(offline->acceptedSettings().renderMode==9); + assert(offline->stateSnapshotQuiescent()); + // Old v4 SpeakerPhysical and music-LF480 are REJECTED acoustically. + // When migrated into a v10 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); + } + // 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 v10 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 P90 JUCE v11: audio ACK fade, single native graph A/B, " + "safe v1-v10 migration, v11 63-byte state and device reopen; " + "P90_vs_P82_RMS_dB=%.3f; ASIO/headphone NOT PROVEN\n",relativeDb); +} From 0b16bdc2f9bd93342e3aa021eefaa71e6310ec19 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:50:36 +0700 Subject: [PATCH 13/26] docs(sonku): record P9 transfer proof, missing psychoacoustic milestones and rigorous headphone FAT --- ..._P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md diff --git a/docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md b/docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md new file mode 100644 index 000000000..f9fd0e035 --- /dev/null +++ b/docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md @@ -0,0 +1,50 @@ +# SonKu P9.0 — Native Stereo External Speaker Candidate (DRAFT, 2026-11-15) + +## Scope and version control + +New opt-in `MusicSpatialP90 = 9`, on the exact draft P8.9 branch lineage. All SonKu P8.2–P8.9 modes and current production mixer GUI/routing remain separate. No merge, public release, or subjective claim is authorized. Current `main` has the separate #713 audio-device continuity fixes: P9 source branch is deliberately **not** a substitute for #713 and must not be blindly merged to `main`. + +## Why P8.9 is not enough + +P8.4-P8.9 use `Hc + 0.12 HP750(Hspeaker-Hc)` and independently add wide stereo SIDE (HP220) directly to headphone L/R. At 6.7m the SIDE retains approximately 1x original near-field energy while directional direct speaker is reduced by ~0.42x. The resulting treble remains ear-locked even when virtual speakers rotate, while early reflection gains are comparatively modest. Merely raising 0.12 would reproduce untested P8.3 music damage. + +## New native DSP: coherent directional transfer + +P9 bypasses **only in new mode 9** the old P8.4 12%-contrast kernel blending and after-FIR headphone SIDE rescue. It uses the same single 2×2 native FIR mixer, with full MIT KEMAR measured directional kernels (`H_L,H_R`) and measured midpoint kernel `H_c`. Each kernel is a real impulse response encoding complex frequency response and ITD. Let `c` be a gently smoothed 0..1 positive interchannel-coherence evidence, initialized to 1. At every existing 16-frame FIR retarget: + +``` +A = (H_L + H_R)/2 +H'_L = H_L + c*(H_c - A) +H'_R = H_R + c*(H_c - A) +Y = H'_L * L + H'_R * R + = [H_L + H_R + 2c(H_c-A)]*M + [H_L-H_R]*S +where M=(L+R)/2, S=(L-R)/2 +``` + +The stereo SIDE transfer **does not depend on `c`**. At `c=1`, equal L/R produces exactly the measured center HRIR without a dual-speaker correlated-MID comb. At `c=0`, independent channel sources see their full measured speaker responses. No second renderer, extra audio callback, minimum-phase replacement, spectral high bypass, or anti-phase correlation gate. `c` uses 80ms input correlation evidence, a 120ms response, and one square root per 16-frame retarget; all state fixed-size and allocated before audio. All kernel coefficients continue using the original per-sample slew. + +Important physical degenerate case: stereo **0° angle** places two identical real speakers at the same point. Opposite-polarity inputs then cancel at the source; no physically honest linear two-source binaural renderer can simultaneously make their contributions fully independent and render them as exactly co-located. Use 60–180° for nonzero anti-phase localization; do not falsely promise anti-phase retention at 0°. The GUI explicitly says so. + +## Existing model retained, limitations and follow-up + +P9 currently retains P8.9 distance-to-direct/LF gain, world-head yaw, measured spectral elevation trim, six-wall directional early field, and late FDN. It uses the existing P8.9 long-distance early/diffuse ratio. No fresh spectral HRIR time alignment, phase-aware angular interpolation, personalized HRTF, headphone calibration, BRIR room measurement, or optimized room-distance model has been proven yet. It is an **architectural first candidate**, not the completed 100%-immersive target. + +## Objective qualification + +The new native PCM test uses 44.1/48k; 64/128/256 buffer-invariant output; source L-only, R-only, correlated MID, anti-phase and complex stereo; azimuth, head yaw, 60/104/180° angles; 1.6/6.7/10m scenes; nonzero finite output, no >0.98 peak, changing PCM vs P8.9, HRTF kernel algebra. Existing P8.4–P8.9 regression suites remain mandatory. Native JUCE v11 test covers GUI/bridge-compatible schema, applied ACK, output PCM and unchanged v1..v10 state restores. CPU profiling, HRIR directional ILD/ITD curves, DRR/IACC, and genuine physical ASIO are **not yet qualified**. + +## Headphone FAT + +1. Run an isolated Windows x64 portable candidate with no other spatial FX enabled, stereo headphones, and equal RMS loudness. +2. Compare P8.4, P8.7, P8.8, P8.9, P9 at 1.6/3/6.7m and 60/104/180° angle. Use the same full-range stereo reference and anti-phase/detail torture material. +3. Test stationary and slow yaw -90/0/+90 and elevation 0/±10° with ear-height spectral trim. Confirm each speaker and all treble actually rotate in WORLD. +4. Rate vocal center naturalness, treble source localization outside head, bass body, width, ceiling/floor confusion, silence, transient smear, and long-distance perception. Record precise settings and the source commit; do not equate passing CTest with perceptual dearVR parity. +5. Verify session close/reopen and device dis/reconnect separately against the #713 integrated `main` source before merging any acoustic patch. + +## Publicly documented research reference + +- Best et al. (2020), *Sound Externalization: A Review of Recent Research*, https://pmc.ncbi.nlm.nih.gov/articles/PMC7488874/ +- dearVR PRO 2 user manual (2024), https://files.plugin-alliance.com/products/dearvr-pro-2/dearvr-pro-2_manual.pdf — reflections, room and distance externalization +- Sennheiser AMBEO CLARITY guide, https://help.sennheiser.com/hc/en-us/articles/27424692616594-How-to-produce-natural-immersive-music-with-the-CLARITY-modul-of-dearVR-PRO2 — perceptual localization/tonal tradeoff + +This method is original engineering of public binaural principles, **not** a claim about proprietary dearVR internal code. From 13120c0205a342da2383be7f66c4b94f181c8510 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:54:34 +0700 Subject: [PATCH 14/26] ci(sonku): P9 exact-source Linux PCM, native Windows JUCE v11 and portable FAT ZIP --- .github/workflows/sonku-p90-windows-field.yml | 463 ++++++++++++++++++ 1 file changed, 463 insertions(+) create mode 100644 .github/workflows/sonku-p90-windows-field.yml diff --git a/.github/workflows/sonku-p90-windows-field.yml b/.github/workflows/sonku-p90-windows-field.yml new file mode 100644 index 000000000..2cc1f2fdb --- /dev/null +++ b/.github/workflows/sonku-p90-windows-field.yml @@ -0,0 +1,463 @@ +name: SonKu P9.0 true external speaker native mixer portable FAT x64 +# Private JUCE app, no release. Native v11 A/B P8.2 through P9. +on: + pull_request: + paths: + - '.github/workflows/sonku-p90-windows-field.yml' + workflow_dispatch: +permissions: + contents: read +concurrency: + group: sonku-p90-field-${{ 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: Strict P8.4 PCM timbre and spatial source qualification + run: | + set -euo pipefail + 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" + g++ $FLAGS tests/sonku_p84_fused_single_core_test.cpp -o /tmp/p84-native + /tmp/p84-native | tee /tmp/p84-source.log + grep -q '^PASS P84 SINGLE CORE:' /tmp/p84-source.log + g++ $FLAGS tests/sonku_p84_spatial_impulse_evidence_test.cpp -o /tmp/p84-spatial + /tmp/p84-spatial | tee /tmp/p84-spatial.log + grep -q '^PASS P84 SPATIAL SOURCE:' /tmp/p84-spatial.log + g++ $FLAGS tests/sonku_p84_live_v5_modes_source_test.cpp -o /tmp/p84-live-mode + /tmp/p84-live-mode | tee /tmp/p84-live-mode.log + grep -q '^PASS P84 V5 NATIVE SOURCE:' /tmp/p84-live-mode.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 tests/sonku_p85_world_locked_source_test.cpp -o /tmp/p85-source + /tmp/p85-source | tee /tmp/p85-source.log + grep -q '^PASS P85 WORLD LOCK:' /tmp/p85-source.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 tests/sonku_p86_horizontal_focus_native_source_test.cpp -o /tmp/p86-source + /tmp/p86-source | tee /tmp/p86-source.log + grep -q '^PASS P86 HORIZONTAL FOCUS:' /tmp/p86-source.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 -DSONKU_P87_MUSIC_BODY_RESEARCH=1 tests/sonku_p87_musical_air_body_source_test.cpp -o /tmp/p87-source + /tmp/p87-source | tee /tmp/p87-source.log + grep -q '^PASS P87 MUSICAL AIR BODY:' /tmp/p87-source.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 -DSONKU_P87_MUSIC_BODY_RESEARCH=1 -DSONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1 tests/sonku_p88_height_distance_source_test.cpp -o /tmp/p88-source + /tmp/p88-source | tee /tmp/p88-source.log + grep -q '^PASS P88 HEIGHT DISTANCE:' /tmp/p88-source.log + g++ $FLAGS -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 tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/p89-source + /tmp/p89-source | tee /tmp/p89-source.log + grep -q '^PASS P89 ROOM ANCHOR:' /tmp/p89-source.log + g++ $FLAGS -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 tests/sonku_p90_true_external_source_test.cpp -o /tmp/p90-source + /tmp/p90-source | tee /tmp/p90-source.log + grep -q '^PASS P90 NATIVE PCM:' /tmp/p90-source.log + - name: Native JS and source GUI capability checks + run: | + set -euo pipefail + node --check site/preview-v2/assets/mixer-native-sonku.js + python - <<'PY' + import re + from pathlib import Path + for path in ("engine/builtin_fx/SonKuSpatialProcessor.h", + "engine/builtin_fx/sonku/SonKuSpatialCore.h"): + depth=0 + for line in Path(path).read_text().splitlines(): + if re.match(r'^\s*#\s*(?:if|ifdef|ifndef)\b',line): + depth+=1 + elif re.match(r'^\s*#\s*endif\b',line): + depth-=1 + assert depth>=0,(path,"excess endif") + assert depth==0,(path,"missing endif",depth) + print("P89_NATIVE_HEADER_PREPROCESSOR_BALANCED") + PY + grep -q 'r.schemaVersion===10' site/preview-v2/assets/mixer-native-sonku.js + grep -q 'r.schemaVersion===11' site/preview-v2/assets/mixer-native-sonku.js + grep -q 'p90TrueExternalSpeaker' src/Main.cpp + # A mode8 enum without fused FIR dispatch silently changes P8.8 timbre. + # This source contract prevents another fallback-to-wrong-kernel regression. + python - <<'PY' + from pathlib import Path + core=Path("engine/builtin_fx/sonku/SonKuSpatialCore.h").read_text() + section=core.split("if((p83Mode_==p83::Mode::MusicSpatialP84 ||",1)[1].split("p84MusicKernel_.merge(",1)[0] + assert "p83Mode_==p83::Mode::MusicSpatialP89 ||" in section + assert "p83Mode_==p83::Mode::MusicSpatialP88 ||" in section + print("SONKU_P89_NATIVE_FUSED_FIR_DISPATCH_VERIFIED") + PY + grep -q 'skHrtfAlign' 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 + 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 \ + -DSONKU_P82_MULTIBAND_ROOM_RESEARCH=1 \ + tests/sonku_p82_sixsurface_multiband_room_test.cpp -o /tmp/sonku-p82-room + /tmp/sonku-p82-room | tee /tmp/sonku-p82-room-evidence.csv + grep -q '^PASS P8.2:' /tmp/sonku-p82-room-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_P83_SOURCE_MISMATCH:$actual" + } + Write-Host "SONKU_P84_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 ` + -DARMIX_SONKU_EXPERIMENTAL_P82_ROOM=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=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' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P82_ROOM:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT:BOOL=ON') { + throw "SONKU_P83_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', + 'NativeSonKuP82SixWallThreeBandRoomTimingDecayAndParity', + 'NativeSonKuP83RealtimeModeSourceAndMusicIntegrity', + 'NativeSonKuP83JuceV4AudioAckLegacyRestoreAndHeadYaw', + 'NativeSonKuP84SingleCoreMusicFidelityAndWorldYaw', + 'NativeSonKuP84JuceV5AudioAckLegacySafeRestore', + 'NativeSonKuP85WorldCoherentMidYawSourceAndFidelity', + 'NativeSonKuP85JuceV6AudioAckLegacySafeRestore', + 'NativeSonKuP86SixWallHorizontalFocusAndMusicIntegrity', + 'NativeSonKuP86JuceV7AudioAckAndV6Restore', + 'NativeSonKuP87MusicalAirBodyP86DryParityAndFdnBass', + 'NativeSonKuP87JuceV8AudioAppliedAckV7Restore', + 'NativeSonKuP88MeasuredEarHeightAndDistanceDrr', + 'NativeSonKuP88JuceV9AppliedAckAndV8Restore', + 'NativeSonKuP89RoomAnchoredStereoAndP88GoldenParity', + 'NativeSonKuP89JuceV10AppliedAckAndV9Restore', + 'NativeSonKuP90StereoExternalizationSource', + 'NativeSonKuP90JuceV11AppliedAckAndLegacyRestore') + $available = @($tests.tests | ForEach-Object { $_.name }) + foreach ($test in $required) { + if ($test -notin $available) { throw "SONKU_P82_MISSING_CTEST:$test" } + } + - name: Fail fast — compile and execute real JUCE v5 state + PCM ACK first + shell: pwsh + run: | + cmake --build build --config Release --parallel 2 --target ARMixSonKuP90NativeTests + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP90JuceV11AppliedAckAndLegacyRestore + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - 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 ARMixSonKuP82RoomTests ARMixSonKuP83LiveSourceTests ARMixSonKuP83NativeTests ARMixSonKuP84LiveSourceTests ARMixSonKuP84NativeTests ARMixSonKuP85WorldSourceTests ARMixSonKuP85NativeTests ARMixSonKuP86FocusSourceTests ARMixSonKuP86NativeTests ARMixSonKuP87MusicSourceTests ARMixSonKuP87NativeTests ARMixSonKuP88SourceTests ARMixSonKuP88NativeTests ARMixSonKuP89SourceTests ARMixSonKuP89NativeTests ARMixSonKuP90SourceTests ARMixSonKuP90NativeTests + 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_P83_NO_GUI_EXE" } + if ((Get-Item -LiteralPath $exe).Length -lt 4MB) { throw "SONKU_P83_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|P82SixWallThreeBandRoomTimingDecayAndParity|P83RealtimeModeSourceAndMusicIntegrity|P83JuceV4AudioAckLegacyRestoreAndHeadYaw|P84SingleCoreMusicFidelityAndWorldYaw|P84JuceV5AudioAckLegacySafeRestore|P85WorldCoherentMidYawSourceAndFidelity|P85JuceV6AudioAckLegacySafeRestore|P86SixWallHorizontalFocusAndMusicIntegrity|P86JuceV7AudioAckAndV6Restore|P87MusicalAirBodyP86DryParityAndFdnBass|P87JuceV8AudioAppliedAckV7Restore|P88MeasuredEarHeightAndDistanceDrr|P88JuceV9AppliedAckAndV8Restore|P89RoomAnchoredStereoAndP88GoldenParity|P89JuceV10AppliedAckAndV9Restore|P90StereoExternalizationSource|P90JuceV11AppliedAckAndLegacyRestore)$' + 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_P83_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 + p82MultibandRoom = $true + p83NativeSpeakers = $false + p84FusedNative = $true + p85WorldLockedMid = $true + p86HorizontalFocus = $true + p87MusicalAirBody = $true + p88PerceptualAlignment = $true + p89StereoRoomDepth = $true + p90TrueExternalSpeaker = $true + p84RenderModes = @('MusicBedP82','MusicSpatialP84','MusicSpatialP85','MusicSpatialP86','MusicSpatialP87','MusicSpatialP88','MusicSpatialP89','MusicSpatialP90') + p83HeadYaw = 'DETERMINISTIC_MANUAL_NO_SENSOR' + p84FusionDifferenceHighpassHz = 750 + p84MeasuredHrirContrast = 0.12 + legacyP83V4Migration = 'OLD_SPEAKER_TO_P82' + p83AudioAppliedAck = $true + p83RealtimeModeCrossfade = '12ms_OUT_AND_IN_NATIVE_SINGLE_PCM_GRAPH' + p82RoomBandsHz = @(250,4800) + p82MaterialCalibration = 'ORIGINAL_ILLUSTRATIVE_NOT_MEASURED_RIR' + p82Rt60StudioSeconds = @(0.717,0.392,0.231) + p82Rt60ChamberSeconds = @(0.933,0.802,0.483) + p82Rt60HallSeconds = @(1.716,1.219,0.650) + p8LowBandCrossoverHz = 220 + musicSafeAlgorithm = 'MEASURED_CENTER_MID_PLUS_UNCONDITIONAL_STEREO_SIDE_RESEARCH' + stateSchema = 11 + fullWindowsExecutable = $true + publicRelease = $false + physicalAsioQualified = $false + dearVrPerceptualParityProven = $false + qualification = 'SONKU_P90_NATIVE_TWO_SPEAKER_COHERENT_PCM_JUCE_V11_FAT_PENDING' + licenseRedistributionApproval = $false + mitKemarNoticeSha256 = (Get-FileHash -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Algorithm SHA256).Hash.ToLowerInvariant() + fieldFatGuideSha256 = (Get-FileHash -LiteralPath docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.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 + -not $p.sonkuExperiment.p82MultibandRoom -or + -not $p.sonkuExperiment.p84FusedNative -or + -not $p.sonkuExperiment.p85WorldLockedMid -or + -not $p.sonkuExperiment.p86HorizontalFocus -or + -not $p.sonkuExperiment.p87MusicalAirBody -or + -not $p.sonkuExperiment.p88PerceptualAlignment -or + -not $p.sonkuExperiment.p89StereoRoomDepth -or + -not $p.sonkuExperiment.p90TrueExternalSpeaker -or + $p.sonkuExperiment.stateSchema -ne 11 -or $p.sonkuExperiment.publicRelease) { + throw 'SONKU_P90_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_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md -Destination dist/SONKU_P90_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_P90_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_P83_FIELD_NOTICE_MISSING:$($item.Key)" + } + $actual = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() + if ($actual -ne $item.Value) { throw "SONKU_P83_FIELD_NOTICE_HASH_MISMATCH:$($item.Key)" } + } + if (Test-Path -LiteralPath dist/Studio) { throw 'SONKU_FIELD_USER_DATA_MUST_NOT_SHIP' } + Write-Host 'SONKU_P90_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-P90-True-External-Speaker-Windows-x64-${{ github.run_id }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0 + + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - 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 ARMixSonKuP82RoomTests ARMixSonKuP83LiveSourceTests ARMixSonKuP83NativeTests ARMixSonKuP84LiveSourceTests ARMixSonKuP84NativeTests ARMixSonKuP85WorldSourceTests ARMixSonKuP85NativeTests ARMixSonKuP86FocusSourceTests ARMixSonKuP86NativeTests ARMixSonKuP87MusicSourceTests ARMixSonKuP87NativeTests ARMixSonKuP88SourceTests ARMixSonKuP88NativeTests ARMixSonKuP89SourceTests ARMixSonKuP89NativeTests + 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_P83_NO_GUI_EXE" } + if ((Get-Item -LiteralPath $exe).Length -lt 4MB) { throw "SONKU_P83_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|P82SixWallThreeBandRoomTimingDecayAndParity|P83RealtimeModeSourceAndMusicIntegrity|P83JuceV4AudioAckLegacyRestoreAndHeadYaw|P84SingleCoreMusicFidelityAndWorldYaw|P84JuceV5AudioAckLegacySafeRestore|P85WorldCoherentMidYawSourceAndFidelity|P85JuceV6AudioAckLegacySafeRestore|P86SixWallHorizontalFocusAndMusicIntegrity|P86JuceV7AudioAckAndV6Restore|P87MusicalAirBodyP86DryParityAndFdnBass|P87JuceV8AudioAppliedAckV7Restore|P88MeasuredEarHeightAndDistanceDrr|P88JuceV9AppliedAckAndV8Restore|P89RoomAnchoredStereoAndP88GoldenParity|P89JuceV10AppliedAckAndV9Restore)$' + 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_P83_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 + p82MultibandRoom = $true + p83NativeSpeakers = $false + p84FusedNative = $true + p85WorldLockedMid = $true + p86HorizontalFocus = $true + p87MusicalAirBody = $true + p88PerceptualAlignment = $true + p89StereoRoomDepth = $true + p84RenderModes = @('MusicBedP82','MusicSpatialP84','MusicSpatialP85','MusicSpatialP86','MusicSpatialP87','MusicSpatialP88','MusicSpatialP89') + p83HeadYaw = 'DETERMINISTIC_MANUAL_NO_SENSOR' + p84FusionDifferenceHighpassHz = 750 + p84MeasuredHrirContrast = 0.12 + legacyP83V4Migration = 'OLD_SPEAKER_TO_P82' + p83AudioAppliedAck = $true + p83RealtimeModeCrossfade = '12ms_OUT_AND_IN_NATIVE_SINGLE_PCM_GRAPH' + p82RoomBandsHz = @(250,4800) + p82MaterialCalibration = 'ORIGINAL_ILLUSTRATIVE_NOT_MEASURED_RIR' + p82Rt60StudioSeconds = @(0.717,0.392,0.231) + p82Rt60ChamberSeconds = @(0.933,0.802,0.483) + p82Rt60HallSeconds = @(1.716,1.219,0.650) + p8LowBandCrossoverHz = 220 + musicSafeAlgorithm = 'MEASURED_CENTER_MID_PLUS_UNCONDITIONAL_STEREO_SIDE_RESEARCH' + stateSchema = 10 + fullWindowsExecutable = $true + publicRelease = $false + physicalAsioQualified = $false + dearVrPerceptualParityProven = $false + qualification = 'SONKU_P89_SCOPED_NATIVE_PCM_JUCE_20_CTESTS_HEADPHONE_FAT_PENDING' + licenseRedistributionApproval = $false + mitKemarNoticeSha256 = (Get-FileHash -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Algorithm SHA256).Hash.ToLowerInvariant() + fieldFatGuideSha256 = (Get-FileHash -LiteralPath docs/SONKU_P89_ROOM_ANCHORED_STEREO_20261115.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 + -not $p.sonkuExperiment.p82MultibandRoom -or + -not $p.sonkuExperiment.p84FusedNative -or + -not $p.sonkuExperiment.p85WorldLockedMid -or + -not $p.sonkuExperiment.p86HorizontalFocus -or + -not $p.sonkuExperiment.p87MusicalAirBody -or + -not $p.sonkuExperiment.p88PerceptualAlignment -or + -not $p.sonkuExperiment.p89StereoRoomDepth -or + $p.sonkuExperiment.stateSchema -ne 10 -or $p.sonkuExperiment.publicRelease) { + throw 'SONKU_P89_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_P89_ROOM_ANCHORED_STEREO_20261115.md -Destination dist/SONKU_P89_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_P89_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_P83_FIELD_NOTICE_MISSING:$($item.Key)" + } + $actual = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() + if ($actual -ne $item.Value) { throw "SONKU_P83_FIELD_NOTICE_HASH_MISMATCH:$($item.Key)" } + } + if (Test-Path -LiteralPath dist/Studio) { throw 'SONKU_FIELD_USER_DATA_MUST_NOT_SHIP' } + Write-Host 'SONKU_P89_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-P89-Room-Anchored-Stereo-Windows-x64-${{ github.run_id }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0 From 5dfde5119ed121cde38b29b7ce7eed743cb6e195 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:57:25 +0700 Subject: [PATCH 15/26] ci(sonku): invoke full P9 native FAT from existing P8.9 pull-request workflow path --- .github/workflows/sonku-p89-windows-field.yml | 144 +++++++++++++++++- 1 file changed, 137 insertions(+), 7 deletions(-) diff --git a/.github/workflows/sonku-p89-windows-field.yml b/.github/workflows/sonku-p89-windows-field.yml index 8e5a52a77..912fb6de0 100644 --- a/.github/workflows/sonku-p89-windows-field.yml +++ b/.github/workflows/sonku-p89-windows-field.yml @@ -1,5 +1,5 @@ -name: SonKu P8.9 room-anchored stereo native mixer portable FAT x64 -# Private JUCE app, no release. Native v10 A/B P8.2/P8.4/P8.5/P8.6/P8.7/P8.8/P8.9. +name: SonKu P9.0 true external speaker native mixer portable FAT x64 +# Private JUCE app, no release. Native v11 A/B P8.2 through P9. on: pull_request: paths: @@ -8,7 +8,7 @@ on: permissions: contents: read concurrency: - group: sonku-p89-field-${{ github.event.pull_request.number || github.ref }} + group: sonku-p90-field-${{ github.event.pull_request.number || github.ref }} cancel-in-progress: true jobs: preflight: @@ -48,6 +48,9 @@ jobs: g++ $FLAGS -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 tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/p89-source /tmp/p89-source | tee /tmp/p89-source.log grep -q '^PASS P89 ROOM ANCHOR:' /tmp/p89-source.log + g++ $FLAGS -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 tests/sonku_p90_true_external_source_test.cpp -o /tmp/p90-source + /tmp/p90-source | tee /tmp/p90-source.log + grep -q '^PASS P90 NATIVE PCM:' /tmp/p90-source.log - name: Native JS and source GUI capability checks run: | set -euo pipefail @@ -68,6 +71,8 @@ jobs: print("P89_NATIVE_HEADER_PREPROCESSOR_BALANCED") PY grep -q 'r.schemaVersion===10' site/preview-v2/assets/mixer-native-sonku.js + grep -q 'r.schemaVersion===11' site/preview-v2/assets/mixer-native-sonku.js + grep -q 'p90TrueExternalSpeaker' src/Main.cpp # A mode8 enum without fused FIR dispatch silently changes P8.8 timbre. # This source contract prevents another fallback-to-wrong-kernel regression. python - <<'PY' @@ -165,6 +170,7 @@ jobs: -DARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=ON ` -DBUILD_TESTING=ON if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $cache = Get-Content -LiteralPath build/CMakeCache.txt -Raw @@ -178,7 +184,8 @@ jobs: $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT:BOOL=ON' -or $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT:BOOL=ON' -or $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT:BOOL=ON' -or - $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT:BOOL=ON') { + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT:BOOL=ON') { throw "SONKU_P83_RESEARCH_NOT_ENABLED" } $tests = (& ctest --test-dir build -C Release --show-only=json-v1 | Out-String | ConvertFrom-Json) @@ -202,7 +209,9 @@ jobs: 'NativeSonKuP88MeasuredEarHeightAndDistanceDrr', 'NativeSonKuP88JuceV9AppliedAckAndV8Restore', 'NativeSonKuP89RoomAnchoredStereoAndP88GoldenParity', - 'NativeSonKuP89JuceV10AppliedAckAndV9Restore') + 'NativeSonKuP89JuceV10AppliedAckAndV9Restore', + 'NativeSonKuP90StereoExternalizationSource', + 'NativeSonKuP90JuceV11AppliedAckAndLegacyRestore') $available = @($tests.tests | ForEach-Object { $_.name }) foreach ($test in $required) { if ($test -notin $available) { throw "SONKU_P82_MISSING_CTEST:$test" } @@ -210,9 +219,130 @@ jobs: - name: Fail fast — compile and execute real JUCE v5 state + PCM ACK first shell: pwsh run: | - cmake --build build --config Release --parallel 2 --target ARMixSonKuP89NativeTests + cmake --build build --config Release --parallel 2 --target ARMixSonKuP90NativeTests if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP89JuceV10AppliedAckAndV9Restore$' + ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP90JuceV11AppliedAckAndLegacyRestore + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - 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 ARMixSonKuP82RoomTests ARMixSonKuP83LiveSourceTests ARMixSonKuP83NativeTests ARMixSonKuP84LiveSourceTests ARMixSonKuP84NativeTests ARMixSonKuP85WorldSourceTests ARMixSonKuP85NativeTests ARMixSonKuP86FocusSourceTests ARMixSonKuP86NativeTests ARMixSonKuP87MusicSourceTests ARMixSonKuP87NativeTests ARMixSonKuP88SourceTests ARMixSonKuP88NativeTests ARMixSonKuP89SourceTests ARMixSonKuP89NativeTests ARMixSonKuP90SourceTests ARMixSonKuP90NativeTests + 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_P83_NO_GUI_EXE" } + if ((Get-Item -LiteralPath $exe).Length -lt 4MB) { throw "SONKU_P83_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|P82SixWallThreeBandRoomTimingDecayAndParity|P83RealtimeModeSourceAndMusicIntegrity|P83JuceV4AudioAckLegacyRestoreAndHeadYaw|P84SingleCoreMusicFidelityAndWorldYaw|P84JuceV5AudioAckLegacySafeRestore|P85WorldCoherentMidYawSourceAndFidelity|P85JuceV6AudioAckLegacySafeRestore|P86SixWallHorizontalFocusAndMusicIntegrity|P86JuceV7AudioAckAndV6Restore|P87MusicalAirBodyP86DryParityAndFdnBass|P87JuceV8AudioAppliedAckV7Restore|P88MeasuredEarHeightAndDistanceDrr|P88JuceV9AppliedAckAndV8Restore|P89RoomAnchoredStereoAndP88GoldenParity|P89JuceV10AppliedAckAndV9Restore|P90StereoExternalizationSource|P90JuceV11AppliedAckAndLegacyRestore)$' + 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_P83_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 + p82MultibandRoom = $true + p83NativeSpeakers = $false + p84FusedNative = $true + p85WorldLockedMid = $true + p86HorizontalFocus = $true + p87MusicalAirBody = $true + p88PerceptualAlignment = $true + p89StereoRoomDepth = $true + p90TrueExternalSpeaker = $true + p84RenderModes = @('MusicBedP82','MusicSpatialP84','MusicSpatialP85','MusicSpatialP86','MusicSpatialP87','MusicSpatialP88','MusicSpatialP89','MusicSpatialP90') + p83HeadYaw = 'DETERMINISTIC_MANUAL_NO_SENSOR' + p84FusionDifferenceHighpassHz = 750 + p84MeasuredHrirContrast = 0.12 + legacyP83V4Migration = 'OLD_SPEAKER_TO_P82' + p83AudioAppliedAck = $true + p83RealtimeModeCrossfade = '12ms_OUT_AND_IN_NATIVE_SINGLE_PCM_GRAPH' + p82RoomBandsHz = @(250,4800) + p82MaterialCalibration = 'ORIGINAL_ILLUSTRATIVE_NOT_MEASURED_RIR' + p82Rt60StudioSeconds = @(0.717,0.392,0.231) + p82Rt60ChamberSeconds = @(0.933,0.802,0.483) + p82Rt60HallSeconds = @(1.716,1.219,0.650) + p8LowBandCrossoverHz = 220 + musicSafeAlgorithm = 'MEASURED_CENTER_MID_PLUS_UNCONDITIONAL_STEREO_SIDE_RESEARCH' + stateSchema = 11 + fullWindowsExecutable = $true + publicRelease = $false + physicalAsioQualified = $false + dearVrPerceptualParityProven = $false + qualification = 'SONKU_P90_NATIVE_TWO_SPEAKER_COHERENT_PCM_JUCE_V11_FAT_PENDING' + licenseRedistributionApproval = $false + mitKemarNoticeSha256 = (Get-FileHash -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Algorithm SHA256).Hash.ToLowerInvariant() + fieldFatGuideSha256 = (Get-FileHash -LiteralPath docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.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 + -not $p.sonkuExperiment.p82MultibandRoom -or + -not $p.sonkuExperiment.p84FusedNative -or + -not $p.sonkuExperiment.p85WorldLockedMid -or + -not $p.sonkuExperiment.p86HorizontalFocus -or + -not $p.sonkuExperiment.p87MusicalAirBody -or + -not $p.sonkuExperiment.p88PerceptualAlignment -or + -not $p.sonkuExperiment.p89StereoRoomDepth -or + -not $p.sonkuExperiment.p90TrueExternalSpeaker -or + $p.sonkuExperiment.stateSchema -ne 11 -or $p.sonkuExperiment.publicRelease) { + throw 'SONKU_P90_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_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md -Destination dist/SONKU_P90_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_P90_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_P83_FIELD_NOTICE_MISSING:$($item.Key)" + } + $actual = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() + if ($actual -ne $item.Value) { throw "SONKU_P83_FIELD_NOTICE_HASH_MISMATCH:$($item.Key)" } + } + if (Test-Path -LiteralPath dist/Studio) { throw 'SONKU_FIELD_USER_DATA_MUST_NOT_SHIP' } + Write-Host 'SONKU_P90_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-P90-True-External-Speaker-Windows-x64-${{ github.run_id }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0 + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Compile actual ARMixConsole Windows GUI and focused real JUCE tests shell: pwsh From 93e500fcc914255a5e862fb156fe049740a31ece Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 16:58:12 +0700 Subject: [PATCH 16/26] fix(sonku): avoid legacy P6/P8.4 -Werror unused head-yaw without altering DSP --- engine/builtin_fx/sonku/SonKuEarlyReflections.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/engine/builtin_fx/sonku/SonKuEarlyReflections.h b/engine/builtin_fx/sonku/SonKuEarlyReflections.h index 07658b42a..46209c6b8 100644 --- a/engine/builtin_fx/sonku/SonKuEarlyReflections.h +++ b/engine/builtin_fx/sonku/SonKuEarlyReflections.h @@ -458,6 +458,8 @@ class SonKuEarlyReflections final { return history_[source][i0]*(1.f-fract)+history_[source][i1]*fract; } void updateGeometry(double azimuth,float spread,float headYawDegrees) noexcept { + // Used only by world-yaw research variants; keep P6/P8.4 -Werror builds valid. + (void)headYawDegrees; constexpr float pi=3.14159265358979323846f; const float sourceDistance=custom_?geometry_.distanceMeters:1.60f; // The existing four-wall path stays bit-exact at equal source/ear From 42f7613ee0adcba4974bc0678820314c582f6257 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 17:01:14 +0700 Subject: [PATCH 17/26] ci(sonku): permit reusable P9 Windows FAT workflow invoked by registered PR pipeline --- .github/workflows/sonku-p90-windows-field.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sonku-p90-windows-field.yml b/.github/workflows/sonku-p90-windows-field.yml index 2cc1f2fdb..c3b922e23 100644 --- a/.github/workflows/sonku-p90-windows-field.yml +++ b/.github/workflows/sonku-p90-windows-field.yml @@ -1,6 +1,7 @@ name: SonKu P9.0 true external speaker native mixer portable FAT x64 # Private JUCE app, no release. Native v11 A/B P8.2 through P9. on: + workflow_call: pull_request: paths: - '.github/workflows/sonku-p90-windows-field.yml' From f467341ea78a009f94bb7a8007d6fb4e0f1e7a31 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 17:01:39 +0700 Subject: [PATCH 18/26] ci(sonku): invoke isolated P9 C++/JUCE Windows FAT from registered PR workflow on P9 research branch only --- .github/workflows/p1-windows.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 37f343179..87d659bc5 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -133,6 +133,15 @@ permissions: pull-requests: read jobs: + sonku-p90-private-fat: + # Draft-only research branch. Calls the isolated, exact-SHA source + JUCE + # Windows portable producer; does NOT publish a release or alter main. + name: SonKu P9 targeted source + Windows portable FAT + if: ${{ github.event_name == 'pull_request' && startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') }} + uses: ./.github/workflows/sonku-p90-windows-field.yml + permissions: + contents: read + quick: name: Fast native contracts (no Windows / JUCE checkout) From af40d9449f8d0d8823cf27ae1b73461ef79f4558 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 17:03:54 +0700 Subject: [PATCH 19/26] ci(sonku): run P9 real C++ anti-phase source gate then actual Windows JUCE & portable FAT in registered PR pipeline --- .github/workflows/p1-windows.yml | 116 +++++++++++++++++++++++++++++-- 1 file changed, 109 insertions(+), 7 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 87d659bc5..109e7463e 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -133,14 +133,116 @@ permissions: pull-requests: read jobs: - sonku-p90-private-fat: - # Draft-only research branch. Calls the isolated, exact-SHA source + JUCE - # Windows portable producer; does NOT publish a release or alter main. - name: SonKu P9 targeted source + Windows portable FAT + 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-') }} - uses: ./.github/workflows/sonku-p90-windows-field.yml - permissions: - contents: read + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - name: Real P9 single-graph PCM / anti-phase / 44.1–48k + shell: bash + run: | + set -euo pipefail + node --check site/preview-v2/assets/mixer-native-sonku.js + 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 tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/sonku-p89 + /tmp/sonku-p89 + echo "SONKU_P90_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-') }} + runs-on: windows-2022 + timeout-minutes: 55 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - uses: actions/checkout@v4 + with: + repository: juce-framework/JUCE + ref: 8.0.15 + path: third_party/JUCE + persist-credentials: false + - name: Pinned WebView2 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 the actual native app with P9 OFF by default except FAT + 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 ` + -DARMIX_SONKU_EXPERIMENTAL_P82_ROOM=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P90_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') { + 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 + 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)$' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Verified portable package, no installer or release + 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 } + & ./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 + $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 + headphoneFat = 'PENDING' + publicRelease = $false + physicalAsioQualified = $false + dearVrParityProven = $false + } + $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 }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0 quick: From cfe0922a84f0fe174e5c1cc39be0a1aa298965b5 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 17:05:12 +0700 Subject: [PATCH 20/26] ci(sonku): preserve existing FAT upload contract; place isolated P9 jobs after legacy CI lanes --- .github/workflows/p1-windows.yml | 223 +++++++++++++++---------------- 1 file changed, 111 insertions(+), 112 deletions(-) diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 109e7463e..5f985e8a9 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -133,118 +133,6 @@ permissions: pull-requests: read 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-') }} - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - persist-credentials: false - - name: Real P9 single-graph PCM / anti-phase / 44.1–48k - shell: bash - run: | - set -euo pipefail - node --check site/preview-v2/assets/mixer-native-sonku.js - 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 tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/sonku-p89 - /tmp/sonku-p89 - echo "SONKU_P90_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-') }} - runs-on: windows-2022 - timeout-minutes: 55 - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.sha }} - persist-credentials: false - - uses: actions/checkout@v4 - with: - repository: juce-framework/JUCE - ref: 8.0.15 - path: third_party/JUCE - persist-credentials: false - - name: Pinned WebView2 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 the actual native app with P9 OFF by default except FAT - 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 ` - -DARMIX_SONKU_EXPERIMENTAL_P82_ROOM=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` - -DARMIX_SONKU_EXPERIMENTAL_P90_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') { - 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 - 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)$' - if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - - name: Verified portable package, no installer or release - 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 } - & ./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 - $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 - headphoneFat = 'PENDING' - publicRelease = $false - physicalAsioQualified = $false - dearVrParityProven = $false - } - $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 }} - path: dist/ - if-no-files-found: error - retention-days: 21 - compression-level: 0 - - quick: name: Fast native contracts (no Windows / JUCE checkout) runs-on: ubuntu-latest @@ -755,3 +643,114 @@ jobs: retention-days: 14 compression-level: 0 overwrite: true + + 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-') }} + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - name: Real P9 single-graph PCM / anti-phase / 44.1–48k + shell: bash + run: | + set -euo pipefail + node --check site/preview-v2/assets/mixer-native-sonku.js + 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 tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/sonku-p89 + /tmp/sonku-p89 + echo "SONKU_P90_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-') }} + runs-on: windows-2022 + timeout-minutes: 55 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + persist-credentials: false + - uses: actions/checkout@v4 + with: + repository: juce-framework/JUCE + ref: 8.0.15 + path: third_party/JUCE + persist-credentials: false + - name: Pinned WebView2 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 the actual native app with P9 OFF by default except FAT + 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 ` + -DARMIX_SONKU_EXPERIMENTAL_P82_ROOM=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P90_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') { + 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 + 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)$' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Verified portable package, no installer or release + 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 } + & ./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 + $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 + headphoneFat = 'PENDING' + publicRelease = $false + physicalAsioQualified = $false + dearVrParityProven = $false + } + $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 }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 1 From 43200daaa6305cf5e760764278ee9e500f45f067 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 17:06:29 +0700 Subject: [PATCH 21/26] test(ci): scope production retryable FAT upload invariant to its own job alongside P9 private artifact --- tests/chat_ci_dispatch_contract.test.mjs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/chat_ci_dispatch_contract.test.mjs b/tests/chat_ci_dispatch_contract.test.mjs index 3566a7fb7..135ed6402 100644 --- a/tests/chat_ci_dispatch_contract.test.mjs +++ b/tests/chat_ci_dispatch_contract.test.mjs @@ -295,7 +295,9 @@ test('CI workflow preserves FAT while deduplicating cheaper native builds and up test('FAT upload is independently retryable without a second Windows compiler and rechecks all file digests',()=>{ const wf=readFileSync('.github/workflows/p1-windows.yml','utf8'); const build=wf.split(/\n fat-upload:\n/)[0]; - const upload=wf.split(/\n fat-upload:\n/)[1]; + // The isolated P9 research FAT has its own upload job after fat-upload. + // Verify exactly the two production FAT uploads inside the production lane. + const upload=wf.split(/\n fat-upload:\n/)[1].split(/\n sonku-p90-source:\n/)[0]; assert.ok(upload,'dedicated artifact delivery job must exist'); assert.match(build,/Seal exact-SHA FAT delivery payload after all installer tests/); assert.match(build,/Save completed FAT packages for retryable upload job/); From 8032514c77a3644c45e27b457aa971a53a8d1715 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 03:58:19 +0700 Subject: [PATCH 22/26] fix(sonku): keep P9 dropdown stable across 250ms native readbacks --- site/preview-v2/assets/mixer-native-sonku.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 8a9bdb09d..5ad8c9597 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -226,7 +226,7 @@ function render(){ ''; picker.dataset.nativeModeSet="p90"; root.querySelector(".sk-render-label").textContent="RENDER MODE · P9.0 HEADPHONE FAT"; - }else if(p89Capable && picker.dataset.nativeModeSet!=="p89"){ + }else if(!p90Capable && p89Capable && picker.dataset.nativeModeSet!=="p89"){ picker.innerHTML=''+ ''+ ''+ @@ -288,7 +288,9 @@ function render(){ p84Capable?(s.renderMode===3?"clarity":"music"): s.renderMode===1?"mono":s.renderMode===2? (s.musicCompatibleLowFrequency?"musiclf":"physical"):"music"; - $("skRenderMode").value=v; + // Native readback arrives every 250ms. A no-op assignment to an open native + // select is unnecessary; preserve popup interaction while value is unchanged. + if(picker.value!==v)picker.value=v; $("skHeadYaw").value=String(s.headYawDegrees); $("skYawValue").textContent=Math.round(s.headYawDegrees)+"°"; } From acc0653f61525cb2f2c8befe4ba78d817b54509c Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 04:00:01 +0700 Subject: [PATCH 23/26] test(sonku): reproduce and prevent P9/P8.9 select option oscillation under native readback --- tests/sonku_p90_dropdown_stability_test.cjs | 86 +++++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 tests/sonku_p90_dropdown_stability_test.cjs diff --git a/tests/sonku_p90_dropdown_stability_test.cjs b/tests/sonku_p90_dropdown_stability_test.cjs new file mode 100644 index 000000000..29ceb3602 --- /dev/null +++ b/tests/sonku_p90_dropdown_stability_test.cjs @@ -0,0 +1,86 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// Exercise the ACTUAL SonKu render-mode DOM-update branch, not a hand-copied +// model. Regression: native schema 11 also advertises schema 10 capabilities; +// prior if(p90) / else if(p89) branches alternately rewrote the open select. +"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(p90Capable && picker.dataset.nativeModeSet!=="p90"){'); +const end=source.indexOf(" const v=p90Capable?",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,'+ + '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