From e09ae0646e42fa208e893266e8f72174892b7a90 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:25:46 +0700 Subject: [PATCH 1/9] feat(sonku): bounded phase-safe direct air and FDN-only LF music body, P8.7 opt-in --- .../builtin_fx/sonku/SonKuP87MusicalAirBody.h | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 engine/builtin_fx/sonku/SonKuP87MusicalAirBody.h diff --git a/engine/builtin_fx/sonku/SonKuP87MusicalAirBody.h b/engine/builtin_fx/sonku/SonKuP87MusicalAirBody.h new file mode 100644 index 000000000..80487b69f --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP87MusicalAirBody.h @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include + +// P8.7 private music-first psychoacoustic audition. One shared real-time +// callback, no extra FIR, FFT, dry bypass, invented room modes or clipping. +// Air is a modest common minimum-phase lead shelf of the measured DIRECT +// HRTF; identical topology for both ears preserves interaural gain/time +// cues better than independent peak/notch boosting. NEVER invert KEMAR notches. +// Low warmth comes exclusively from actual already-rendered 8-line FDN wet +// and the original per-channel music LF, not an oscillator or uncorrelated bass. +// OFF unless explicitly selected by renderMode==6 and ROOM enabled. +namespace armix::sonku::p87 { +class MusicalAirBody final { +public: + struct Ears {float left=0.f,right=0.f;}; + bool prepare(double rate) noexcept { + if(!std::isfinite(rate) || (std::abs(rate-44100.)>.1 && + std::abs(rate-48000.)>.1))return false; + constexpr double twoPi=6.28318530717958647692; + // High shelf +1.9 dB asymptote above the ~4 kHz transition, no sharp Q peak. + // Adapted from one-pole highpass complement; stable zero/pole within circle. + airAlpha_=static_cast(1.-std::exp(-twoPi*3900./rate)); + airGain_=static_cast(std::pow(10.,1.9/20.)-1.); + // A damped, broadband low-mid tail under 180 Hz — no single resonant + // frequency, no feedback gain changes, no low-Q ringing or peak generation. + roomAlpha_=static_cast(1.-std::exp(-twoPi*175./rate)); + reset();return true; + } + void reset() noexcept {airLow_={};roomLow_={};} + void enhanceDirect(float& l,float& r) noexcept { + // Stereo equal coefficients keep both measured HRTF channels independent. + const std::array x{l,r}; + airLow_[0]+=airAlpha_*(x[0]-airLow_[0]); + airLow_[1]+=airAlpha_*(x[1]-airLow_[1]); + l=x[0]+airGain_*(x[0]-airLow_[0]); + r=x[1]+airGain_*(x[1]-airLow_[1]); + } + Ears diffuseLowBody(float l,float r) noexcept { + roomLow_[0]+=roomAlpha_*(l-roomLow_[0]); + roomLow_[1]+=roomAlpha_*(r-roomLow_[1]); + // Add ONLY 42% of the diffuse LF signal. Existing FDN RT60 remains intact + // and four horizontal early reflection image paths are untouched. + return {0.42f*roomLow_[0],0.42f*roomLow_[1]}; + } + static constexpr float musicBassRoomGain=1.09f; // room ON, LF only + float preparedAirBoost()const noexcept{return airGain_;} +private: + std::array airLow_{},roomLow_{}; + float airAlpha_=0.f,roomAlpha_=0.f,airGain_=0.f; +}; +} // namespace armix::sonku::p87 From 63f075e9383dfd166959938c424c29e3ecc753b1 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:27:51 +0700 Subject: [PATCH 2/9] feat(sonku): opt-in P8.7 musical air/direct + diffuse bass room with P8.6 focus --- CMakeLists.txt | 11 ++- .../builtin_fx/sonku/SonKuP83SpeakerScene.h | 6 ++ engine/builtin_fx/sonku/SonKuSpatialCore.h | 67 ++++++++++++++++++- 3 files changed, 80 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f2dacc8e..d21361cd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -67,6 +67,13 @@ if(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT AND NOT ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) message(FATAL_ERROR "P8.6 focus requires P8.5 coherent-world research") endif() +# P8.7 musical air and resonant FDN LF body, private A/B only. +option(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + "Opt-in P8.7 music-first direct air + FDN LF body" OFF) +if(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT AND + NOT ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) + message(FATAL_ERROR "P8.7 music body requires P8.6 horizontal focus research") +endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -275,7 +282,9 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=1> $<$:SONKU_P85_WORLD_COHERENCE_RESEARCH=1> $<$:ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=1> - $<$:SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1>) + $<$:SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=1> + $<$:SONKU_P87_MUSIC_BODY_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. diff --git a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h index efbf71ae9..24eae3a90 100644 --- a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h +++ b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h @@ -14,6 +14,9 @@ enum class Mode : std::uint8_t { ,MusicSpatialP85=4 #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH ,MusicSpatialP86=5 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + ,MusicSpatialP87=6 +#endif #endif #endif #endif @@ -28,6 +31,9 @@ inline bool valid(Mode m) noexcept { || m==Mode::MusicSpatialP85 #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH || m==Mode::MusicSpatialP86 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + || m==Mode::MusicSpatialP87 +#endif #endif #endif #endif diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 6253673b2..675d2c1c1 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -20,6 +20,9 @@ #endif #include "SonKuP84FusedMusicHrir.h" #endif +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH +#include "SonKuP87MusicalAirBody.h" +#endif #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH #include "SonKuHrtfTonalCalibration.h" #endif @@ -90,7 +93,11 @@ inline bool valid(const Settings& s) noexcept { #if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH #if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + s.renderMode<=6 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5 && s.renderMode!=6) || !s.musicCompatibleLowFrequency) && +#else s.renderMode<=5 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5) || !s.musicCompatibleLowFrequency) && +#endif #else s.renderMode<=4 && ((s.renderMode!=3 && s.renderMode!=4) || !s.musicCompatibleLowFrequency) && #endif @@ -163,6 +170,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH if(!p84MusicKernel_.prepare(rate))return false; #endif +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + if(!p87Body_.prepare(rate))return false; +#endif #if defined(SONKU_P71_DIRECT_XYZ_RESEARCH) && SONKU_P71_DIRECT_XYZ_RESEARCH // The special elevation control is not serialized or published to // a public host. Downgrading the prepared profile clears it. @@ -203,6 +213,9 @@ class SonKuSpatialCore final { earBass_.fill(0.f); #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH tonalCalibration_.reset(); +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + p87Body_.reset(); +#endif #endif #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH originalBass_.fill(0.f); @@ -256,6 +269,10 @@ class SonKuSpatialCore final { if(!s.moving || !settings_.moving || s.startAzimuthDegrees!=settings_.startAzimuthDegrees) degrees_=wrapDegrees(s.startAzimuthDegrees); +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + if(s.renderMode!=settings_.renderMode || + s.spacePreset!=settings_.spacePreset)p87Body_.reset(); +#endif settings_=s; #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH // Apply typed real-time SPSC state, not quiescent-only test setters. @@ -437,6 +454,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP85 #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP86 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + && p83Mode_!=p83::Mode::MusicSpatialP87 +#endif #endif #endif #endif @@ -470,6 +490,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP85 #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP86 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP87 +#endif #endif #endif ); @@ -478,7 +501,14 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH // Mode 5 changes wet only; P8.5 direct HRIR/LF/stereo/tonal remain. - const bool horizontalFocus=p83Mode_==p83::Mode::MusicSpatialP86; + const bool horizontalFocus=p83Mode_==p83::Mode::MusicSpatialP86 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP87 +#endif + ; +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + const bool musicalBody=p83Mode_==p83::Mode::MusicSpatialP87; +#endif #endif // Deliberate music-monitor compensation: real distance perception // still comes from direct/reflected ratio and high-frequency cues, @@ -571,6 +601,10 @@ class SonKuSpatialCore final { #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH if(transparentBass || positionedMode) tonalCalibration_.process(ears[0],ears[1]); +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + if(musicalBody && roomEnabled) + p87Body_.enhanceDirect(ears[0],ears[1]); +#endif #endif #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH if(positionedMode && !monoObject && p83MusicCompatibleLf_) @@ -597,6 +631,13 @@ class SonKuSpatialCore final { ?reverb_.process(transparentBass?x0:(musicSafe?inputMid:x0), transparentBass?x1:(musicSafe?inputMid:x1)) :SonKuMusicalReverb::Ears{}; +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + if(musicalBody && roomEnabled){ + const auto body=p87Body_.diffuseLowBody(late.left,late.right); + late.left+=body.left; + late.right+=body.right; + } +#endif #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH if(positionedMode && p83Stem_!=p83::Stem::Combined) { if(p83Stem_!=p83::Stem::Direct)ears[0]=ears[1]=0.f; @@ -686,9 +727,17 @@ class SonKuSpatialCore final { // When ROOM OFF is reselected after a native scene, the // additional wet presence smoothly decays with its own engine. const float musicLowL=transparentBass? - smoothedMix_*originalLowL:0.f; + smoothedMix_*originalLowL +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + *(musicalBody&&roomEnabled?p87::MusicalAirBody::musicBassRoomGain:1.f) +#endif + :0.f; const float musicLowR=transparentBass? - smoothedMix_*originalLowR:0.f; + smoothedMix_*originalLowR +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + *(musicalBody&&roomEnabled?p87::MusicalAirBody::musicBassRoomGain:1.f) +#endif + :0.f; const float baseDryL=transparentBass?dryLevel*x0:0.f; const float baseDryR=transparentBass?dryLevel*x1:0.f; float outL=baseDryL+smoothedTrim_* @@ -785,6 +834,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP85 #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP86 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + && p83Mode_!=p83::Mode::MusicSpatialP87 +#endif #endif #endif #endif @@ -814,6 +866,9 @@ class SonKuSpatialCore final { p83Mode_==p83::Mode::MusicSpatialP85 || #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH p83Mode_==p83::Mode::MusicSpatialP86 || +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + p83Mode_==p83::Mode::MusicSpatialP87 || +#endif #endif #endif (p84FusedMusic_ && p83Mode_==p83::Mode::MusicBedP82)) && @@ -830,6 +885,9 @@ class SonKuSpatialCore final { interpolate(centerTarget_,(p83Mode_==p83::Mode::MusicSpatialP85 #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP86 +#if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP87 +#endif #endif )?static_cast(p83::toHead(static_cast(degrees_),p83HeadYaw_)) :degrees_); @@ -931,6 +989,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_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH + p87::MusicalAirBody p87Body_{}; +#endif bool p84FusedMusic_=false; // research opt-in only; P8.2 default untouched #endif #if defined(SONKU_P71_DIRECT_XYZ_RESEARCH) && SONKU_P71_DIRECT_XYZ_RESEARCH From d28957f79f06589b9b10ad8fccd8461de14753da Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:29:00 +0700 Subject: [PATCH 3/9] feat(sonku): P8.7 native v8 schema and 59-byte backward-compatible JUCE state --- engine/builtin_fx/SonKuSpatialProcessor.h | 15 +++++++++++++++ src/Main.cpp | 10 +++++++++- src/SonKuNativeBridgeContract.h | 8 +++++++- 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h index d40b7e8cf..4d90e08b7 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -160,7 +160,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, #if defined(ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + out.writeInt(8); // same 59-byte layout; modes 0/3/4/5/6 +#else out.writeInt(7); // 59-byte layout; mode 5, old sessions intact +#endif #else out.writeInt(6); // unchanged 59-byte state; P8.5 is opt-in mode 4 #endif @@ -222,6 +226,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, &&version!=6 #if defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT &&version!=7 +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + &&version!=8 +#endif #endif #endif #endif @@ -238,6 +245,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, ||(version==6&&size!=59) #if defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT ||(version==7&&size!=59) +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + ||(version==8&&size!=59) +#endif #endif #endif #endif @@ -303,6 +313,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, if(version==7 && next.renderMode!=0 && next.renderMode!=3 && next.renderMode!=4 && next.renderMode!=5)return false; if(version==7 && next.musicCompatibleLowFrequency)return false; +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + if(version==8 && next.renderMode!=0 && next.renderMode!=3 && + next.renderMode!=4 && next.renderMode!=5 && next.renderMode!=6)return false; + if(version==8 && next.musicCompatibleLowFrequency)return false; +#endif #endif #endif #endif diff --git a/src/Main.cpp b/src/Main.cpp index e5be859b1..027a639a7 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3046,7 +3046,15 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) reply->setProperty("p8TransparentBass",true); #endif -#if defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_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); + } +#elif defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT if(processor && processor->preparedReflectionProfile()== armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch) { reply->setProperty("p84MusicFusion",true); diff --git a/src/SonKuNativeBridgeContract.h b/src/SonKuNativeBridgeContract.h index 158542a47..7fdc413b1 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_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + return 8; +#elif defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT return 7; #elif defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT return 6; @@ -87,7 +89,11 @@ inline bool decodeSettings(const juce::var& values,armix::sonku::Settings& out) // the P8.4 research binary. A/B is only P8.2 golden vs fused. #if defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT + if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4 && proposed.renderMode!=5 && proposed.renderMode!=6)return false; +#else if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4 && proposed.renderMode!=5)return false; +#endif #else if(proposed.renderMode!=0 && proposed.renderMode!=3 && proposed.renderMode!=4)return false; #endif From 296d048a4d403506425eb37870723f1b96c093e6 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:29:22 +0700 Subject: [PATCH 4/9] feat(sonku): native v8 P8.7 capability-gated GUI selector, preserving 0/3/4/5 A/B --- site/preview-v2/assets/mixer-native-sonku.js | 37 ++++++++++++++------ 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 0990fce80..7901d7343 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -53,7 +53,7 @@ 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<=5 && + Number.isInteger(s.renderMode)&&s.renderMode>=0&&s.renderMode<=6 && typeof s.musicCompatibleLowFrequency==="boolean" && Number.isFinite(s.headYawDegrees)&&Math.abs(s.headYawDegrees)<=360 && (s.renderMode!==2 || (s.stereoSpreadDegrees>=20&&s.stereoSpreadDegrees<=120)))); @@ -187,7 +187,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,musicSafeStereo=false,p8TransparentBass=false,p82MultibandRoom=false, + xyzCapable=false,p83Capable=false,p84Capable=false,p85Capable=false,p86Capable=false,p87Capable=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; @@ -207,7 +207,15 @@ function render(){ const row=$("skRenderRow");row.hidden=!(p83Capable||p84Capable); if(p83Capable||p84Capable){ const picker=$("skRenderMode"); - if(p86Capable && picker.dataset.nativeModeSet!=="p86"){ + if(p87Capable && picker.dataset.nativeModeSet!=="p87"){ + picker.innerHTML=''+ + ''+ + ''+ + ''+ + ''; + picker.dataset.nativeModeSet="p87"; + root.querySelector(".sk-render-label").textContent="RENDER MODE · P8.7 HEADPHONE FAT"; + }else if(!p87Capable && p86Capable && picker.dataset.nativeModeSet!=="p86"){ picker.innerHTML=''+ ''+ ''+ @@ -233,7 +241,8 @@ function render(){ picker.dataset.nativeModeSet="p83"; root.querySelector(".sk-render-label").textContent="RENDER MODE · P8.3 TEST"; } - const v=p86Capable?(s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): + const v=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"): p85Capable?(s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): p84Capable?(s.renderMode===3?"clarity":"music"): s.renderMode===1?"mono":s.renderMode===2? @@ -284,7 +293,9 @@ function render(){ if(!rangeEdits.has("skElevation"))elevation.value=String(s.directElevationDegrees); $("skElevationValue").textContent=s.directElevationDegrees.toFixed(1)+"°"; } - root.querySelector(".sk-stage-caption").textContent=p86Capable&&s.renderMode===5? + root.querySelector(".sk-stage-caption").textContent=p87Capable&&s.renderMode===6? + "P8.7 FOCUSED MUSIC · DIRECT AIR + DIFFUSE LF BODY · FAT REQUIRED": + p86Capable&&s.renderMode===5? "P8.6 FOCUSED HORIZONTAL SOURCES · CONTROLLED ROOM · HEADPHONE FAT REQUIRED": p85Capable&&s.renderMode===4? "P8.5 WORLD-LOCKED MUSIC MID · EXPERIMENT · HEADPHONE FAT REQUIRED": @@ -319,7 +330,8 @@ function render(){ // redrawn at 60 Hz. The native audio callback remains the time authority. drawSpeakers(); $("skMode").textContent=native()?(context()? - (p86Capable&&s.renderMode===5?"NATIVE P8.6 HORIZONTAL FOCUS · TEST": + (p87Capable&&s.renderMode===6?"NATIVE P8.7 MUSICAL AIR + BODY · TEST": + p86Capable&&s.renderMode===5?"NATIVE P8.6 HORIZONTAL FOCUS · TEST": p85Capable&&s.renderMode===4?"NATIVE P8.5 WORLD COHERENCE · TEST": p84Capable&&s.renderMode===3?"NATIVE P8.4 MUSIC FUSION · TEST": p83Capable&&s.renderMode!==0?"NATIVE P8.3 SPEAKERS · RESEARCH": @@ -467,7 +479,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===5 || r.schemaVersion===6 || r.schemaVersion===7 || r.schemaVersion===8) && Number.isFinite(r.settings?.directElevationDegrees); if(r.schemaVersion!==2&&!measured)return; const incoming=normalizeSettings(r.settings); @@ -479,13 +491,15 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ Number.isInteger(incoming.renderMode) && typeof incoming.musicCompatibleLowFrequency==="boolean" && Number.isFinite(incoming.headYawDegrees); - p86Capable=r.schemaVersion===7 && r.p86HorizontalFocus===true; + p87Capable=r.schemaVersion===8 && r.p87MusicalAirBody===true; + p86Capable=(r.schemaVersion===7 || p87Capable) && r.p86HorizontalFocus===true; p85Capable=(r.schemaVersion===6 || p86Capable) && r.p85AcousticCoherence===true; p84Capable=(r.schemaVersion===5 || p85Capable) && r.p84MusicFusion===true && Number.isInteger(incoming.renderMode) && (incoming.renderMode===0||incoming.renderMode===3|| (p85Capable&&incoming.renderMode===4)|| - (p86Capable&&incoming.renderMode===5)) && + (p86Capable&&incoming.renderMode===5)|| + (p87Capable&&incoming.renderMode===6)) && typeof incoming.musicCompatibleLowFrequency==="boolean" && incoming.musicCompatibleLowFrequency===false && Number.isFinite(incoming.headYawDegrees); @@ -519,7 +533,7 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ } render(); }); -$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;musicSafeStereo=false;p8TransparentBass=false;p82MultibandRoom=false; +$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;p87Capable=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;} @@ -527,7 +541,8 @@ $("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapa $("skRenderMode").addEventListener("change",()=>{ if(!(p83Capable||p84Capable))return; const v=$("skRenderMode").value; - const mode=p86Capable?(v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): + const mode=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): p85Capable?(v==="coherence"?4:v==="clarity"?3:0): p84Capable?(v==="clarity"?3:0): v==="mono"?1:v==="physical"||v==="musiclf"?2:0; From 25bce3443e9af2c9c43d97c91a11e0b3218444c4 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:30:26 +0700 Subject: [PATCH 5/9] test(sonku): P8.7 actual PCM A/B room OFF parity, bounded air/LF transfer and anti-phase --- ...sonku_p87_musical_air_body_source_test.cpp | 121 ++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 tests/sonku_p87_musical_air_body_source_test.cpp diff --git a/tests/sonku_p87_musical_air_body_source_test.cpp b/tests/sonku_p87_musical_air_body_source_test.cpp new file mode 100644 index 000000000..91cae46cd --- /dev/null +++ b/tests/sonku_p87_musical_air_body_source_test.cpp @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// P8.7 measured actual native PCM. Objective phase/energy only; +// no false claim that synthetic tests equal headphone user FAT. +#if defined(NDEBUG) +#undef NDEBUG +#endif +#if !defined(SONKU_P87_MUSIC_BODY_RESEARCH) || !SONKU_P87_MUSIC_BODY_RESEARCH +#error Must compile explicit opt-in P8.7 source engine +#endif +#include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include "../engine/builtin_fx/sonku/SonKuP87MusicalAirBody.h" +#include +#include +#include +#include +#include +#include +using armix::sonku::Settings; +using armix::sonku::SonKuSpatialCore; +using armix::sonku::SonKuReflectionProfile; +constexpr float pi=3.14159265358979323846f; +struct Audio{std::vector l,r;}; +static Audio scene(int mode,int rate,int room,int block,float az,float yaw, + bool anti=false,float distance=1.6f){ + constexpr int frames=12288; + auto core=std::make_unique(); + assert(core->prepare(rate,SonKuReflectionProfile::SixSurfaceKemarResearch)); + Settings s{};s.renderMode=mode;s.moving=false;s.musicCompatibleLowFrequency=false; + s.startAzimuthDegrees=az;s.headYawDegrees=yaw;s.stereoSpreadDegrees=60.f; + s.spatialMix=1.f;s.outputTrim=.75f;s.spacePreset=room; + s.sourceDistanceMeters=distance;s.roomAmount=1.f;s.ambience=.47f; + assert(core->setSettings(s)); + Audio a{{std::vector(frames)},{std::vector(frames)}}; + for(int i=0;i(i)/rate; + const float mid=.11f*std::sin(2.f*pi*83.f*t)+.047f*std::sin(2.f*pi*444.f*t); + const float side=.037f*std::sin(2.f*pi*4700.f*t)+.016f*std::sin(2.f*pi*8760.f*t); + const float transient=i==20?.09f:0.f; + a.l[i]=mid+side+transient; + a.r[i]=anti?(-mid-side-transient):mid-side+transient; + } + for(int i=0;iprocess(a.l.data()+i,a.r.data()+i,std::min(block,frames-i)); + return a; +} +static double energy(const Audio& a){ + double v=0.; + for(unsigned i=0;in/2){baseline+=x*x;after+=l*l;} + } + return std::sqrt(after/baseline); +} +int main(){ + for(int rate:{44100,48000}){ + // Direct high-air is bounded and monotonically grows without a narrow Q. + const double air1=toneResponse(rate,1000.f,true); + const double air8=toneResponse(rate,8000.f,true); + const double air12=toneResponse(rate,12000.f,true); + const double body85=toneResponse(rate,85.f,false); + const double body8k=toneResponse(rate,8000.f,false); + std::printf("P87_FILTER,rate=%d,air1k=%.5f,air8k=%.5f,air12k=%.5f,body85=%.5f,body8k=%.5f\n", + rate,air1,air8,air12,body85,body8k); + assert(air1>1.0&&air1<1.16); + assert(air8>1.13&&air8<1.28); + assert(air12>air8&&air12<1.29); + assert(body85>1.30&&body85<1.46); + assert(body8k>1.0&&body8k<1.05); + // Safety-critical: selecting P8.7 while ROOM OFF MUST NOT alter + // any P8.6 direct, bass or side PCM. 64/128 block sizes are exact. + for(float az:{0.f,90.f,180.f})for(float yaw:{0.f,60.f,180.f}) + for(bool anti:{false,true}){ + const auto p86=scene(5,rate,0,128,az,yaw,anti); + const auto p87=scene(6,rate,0,128,az,yaw,anti); + const auto sliced=scene(6,rate,0,64,az,yaw,anti); + assert(energy(p86)>.01); + assert(diff(p86,p87)==0.); + assert(diff(p87,sliced)==0.); + } + // ROOM ON: bounded improvement in wet tonal spectrum plus intact focus. + // Run both near 1.6 m and a larger 28.8 m scene at owner-like distance. + for(int room:{1,3})for(bool anti:{false,true}){ + const float distance=room==3?6.1f:1.6f; + const auto p86=scene(5,rate,room,128,90.f,60.f,anti,distance); + const auto p87=scene(6,rate,room,128,90.f,60.f,anti,distance); + const auto sliced=scene(6,rate,room,64,90.f,60.f,anti,distance); + const double e86=energy(p86),e87=energy(p87); + const double d=diff(p86,p87); + assert(diff(p87,sliced)==0.); + assert(d>1.e-7 && e86>.01 && e87>.01); + const double db=10.*std::log10(e87/e86); + std::printf("P87_NATIVE_SCENE,rate=%d,room=%d,anti=%d,db=%.4f,pcm_delta=%.8f\n", + rate,room,anti?1:0,db,d); + assert(std::isfinite(db)&&db>-3.&&db<3.); + } + } + std::puts("PASS P87 MUSICAL AIR BODY: direct PCM parity, bounded HF and FDN LF gains, anti-phase and block parity"); +} From c36b145c1dd5de659635afea3763b8d7e89bd101 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:30:50 +0700 Subject: [PATCH 6/9] test(sonku): P8.7 JUCE v8 applied ACK, old v1-v7 session and device restart --- tests/sonku_p87_native_juce_v8_test.cpp | 222 ++++++++++++++++++++++++ 1 file changed, 222 insertions(+) create mode 100644 tests/sonku_p87_native_juce_v8_test.cpp diff --git a/tests/sonku_p87_native_juce_v8_test.cpp b/tests/sonku_p87_native_juce_v8_test.cpp new file mode 100644 index 000000000..fbe553165 --- /dev/null +++ b/tests/sonku_p87_native_juce_v8_test.cpp @@ -0,0 +1,222 @@ +// SPDX-License-Identifier: AGPL-3.0-only +// REAL native Windows JUCE v8 SonKu P8.7 headphone research: +// P8.2 -> native queued v8 -> fading -> AUDIO APPLIED ACK -> readback, +// v1..v8 .smix state, old v4 rejected physical rollback and no extra graph. +#if defined(NDEBUG) +#undef NDEBUG +#endif +#if !defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) || !ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT +#error Native JUCE v8 test requires explicit private P8.4 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 && "P87 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); + } + } // MemoryOutputStream must flush byte count before asserting the block. + assert(bytes.getSize()==static_cast( + version==1?30:version==2?46:version==3?50:59)); + return bytes; +} +int main(){ + static_assert(schemaVersion()==8); + 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=6; + auto json=acceptedSettings(s); + Settings decoded{}; + assert(decodeSettings(json,decoded)&&decoded.renderMode==6); + for(int rejected:{-1,1,2,7,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==6); + juce::MemoryBlock snapshot; + fx->getStateInformation(snapshot); + assert(snapshot.getSize()==59); + juce::MemoryInputStream input(snapshot.getData(),snapshot.getSize(),false); + assert(input.readInt()==0x534f4e4b&&input.readInt()==8); + auto restored=std::make_unique(); + restored->prepareToPlay(44100.,128); + assert(restored->restoreUnpublishedState( + snapshot.getData(),static_cast(snapshot.getSize()))); + assert(restored->acceptedSettings().renderMode==6); + restored->prepareToPlay(48000.,256); + assert(restored->isReady() && restored->acceptedSettings().renderMode==6); + // 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)<1.5); + // Audio-thread head-yaw change is a separate accepted v8 transaction. + s.headYawDegrees=60.f; + assert(fx->queueSettings(s,802)); + complete(*fx,802,400); + assert(fx->acceptedSettings().renderMode==6); + 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=6; + assert(offline->queueSettings(s,901)); + offline->consumeRealtimeEdits(); + assert(offline->pollCompletion(ack)&&ack.applied&&ack.requestId==901); + assert(offline->acceptedSettings().renderMode==6); + assert(offline->stateSnapshotQuiescent()); + // Old v4 SpeakerPhysical and music-LF480 are REJECTED acoustically. + // When migrated into a v8 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); + } + 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 v8 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(),58)); + 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(),59)); + corrupt=snapshot;ptr=static_cast(corrupt.getData()); + ptr[50]=2;ptr[51]=ptr[52]=ptr[53]=0; // old physical mode in v8 forbidden + assert(!broken->restoreUnpublishedState(corrupt.getData(),59)); + restored->sealForRealtime(); + assert(!restored->restoreUnpublishedState(snapshot.getData(),59)); + std::printf("PASS P87 JUCE v8: audio ACK fade, single native graph A/B, " + "safe v1-v7 migration, v8 59-byte state and device reopen; " + "P87_vs_P82_RMS_dB=%.3f; ASIO/headphone NOT PROVEN\n",relativeDb); +} From 438144323f760c602f02b071ddcc3cb8f82ed71a Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:31:11 +0700 Subject: [PATCH 7/9] build(sonku): native P8.7 measured stereo air/bass CTest and JUCE v8 state FAT --- CMakeLists.txt | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index d21361cd6..b63ab361c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -600,6 +600,52 @@ if(BUILD_TESTING) SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1) add_test(NAME NativeSonKuP86JuceV7AudioAckAndV6Restore COMMAND ARMixSonKuP86NativeTests) + if(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) + add_executable(ARMixSonKuP87MusicSourceTests + tests/sonku_p87_musical_air_body_source_test.cpp) + target_compile_features(ARMixSonKuP87MusicSourceTests PRIVATE cxx_std_20) + target_compile_definitions(ARMixSonKuP87MusicSourceTests 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) + add_test(NAME NativeSonKuP87MusicalAirBodyP86DryParityAndFdnBass + COMMAND ARMixSonKuP87MusicSourceTests) + juce_add_console_app(ARMixSonKuP87NativeTests + PRODUCT_NAME "ArSonMix SonKu P87 Native JUCE v8 Tests") + target_sources(ARMixSonKuP87NativeTests PRIVATE + tests/sonku_p87_native_juce_v8_test.cpp) + target_compile_features(ARMixSonKuP87NativeTests PRIVATE cxx_std_20) + target_link_libraries(ARMixSonKuP87NativeTests PRIVATE + juce::juce_audio_processors juce::juce_recommended_config_flags) + target_compile_definitions(ARMixSonKuP87NativeTests 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 + 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) + add_test(NAME NativeSonKuP87JuceV8AudioAppliedAckV7Restore + COMMAND ARMixSonKuP87NativeTests) + endif() endif() endif() endif() From 0f8af424ee8a7ac6bb16fa331b7f68d8d4644bc8 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:32:05 +0700 Subject: [PATCH 8/9] docs(sonku): P8.7 focused music-body psychoacoustic rationale and phase/headphone acceptance criteria --- ..._P87_MUSICAL_AIR_RESONANT_BODY_20261115.md | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 docs/SONKU_P87_MUSICAL_AIR_RESONANT_BODY_20261115.md diff --git a/docs/SONKU_P87_MUSICAL_AIR_RESONANT_BODY_20261115.md b/docs/SONKU_P87_MUSICAL_AIR_RESONANT_BODY_20261115.md new file mode 100644 index 000000000..c03803773 --- /dev/null +++ b/docs/SONKU_P87_MUSICAL_AIR_RESONANT_BODY_20261115.md @@ -0,0 +1,48 @@ +# SonKu P8.7 — Music Air + Resonant Body, private headphone FAT (2026-11-15) + +## What the owner heard + +P8.6 horizontal focus stopped the overwhelming room-filling image but the music seemed phase-cancelled, high frequencies constrained, bass thin and insufficiently rounded/resonant. The owner's perceptual observation is not itself proof of a DSP phase-error: ear-dependent HRTFs, HRTF/headphone spectral mismatch, Mid/Side, comb-filtered reflection addition, limited treble, level differences and nonindividual KEMAR may cause such sensations. + +**Protect P8.6** (mode 5) as new focused-stage baseline; P8.5 (mode 4) for world yaw, P8.4 (mode 3) musical fusion, P8.2 (mode 0) golden fallback. P8.3 physical modes 1/2 remain rejected. No silent scene edits or preset defaults. + +## Audit of actual DSP root + +- P8.6 reduces floor ER to 24% pressure, ceiling to 15%, ER overall gain to 76%, FDN tail to 38%. This can remove diffuse masking at the cost of room body and spectral liveliness. Same actual KEMAR direct FIR and music SIDE were preserved, therefore *those* are not newly phase inverted by P8.6. +- Existing P8.1 horizontal KEMAR equalizer uses a **capped -5.5 dB broad 2.2k band** cut to restrain a measured resonance, and a modest high shelf at 6.2k. P8.7 deliberately does NOT inverse-filter narrow pinna notches or remove the original tonal calibration; broad presence/air deserves conservative audition when room is dry. +- Existing P8.4 fused stereo direct HRTFs share a center anchor plus 12%-bounded highpassed speaker difference. Existing music SIDE is head-locked; neither P8.7 nor P8.6 solves this limitation. Phase cancellations may persist from that model; do not claim otherwise. +- Existing physical horizontal 4-wall early paths already have measured HRTF and frequency-dependent material absorption. Simply raising all ER or late HF will restore the bad P8.5 room-filling sound. + +## Research basis + +Sennheiser explains that nonindividual HRTF timbre coloration is a trade-off against externalization and that an optimum per instrument often differs. We do not implement or copy their patented CLARITY algorithm: https://help.sennheiser.com/hc/en-us/articles/27424692616594-How-to-produce-natural-immersive-music-with-the-CLARITY-modul-of-dearVR-PRO2 + +Optimization of virtual loudspeakers and early reflection directions matters perceptually, particularly for small-room stereo music: https://www.mdpi.com/2076-3417/7/12/1282 + +Pinna filtering in direct BRIR supports externalization; pinna filtering in late reflected BRIR can reduce it: https://doi.org/10.1016/j.apacoust.2020.107257 + +2026 frontal NI-BRIR study emphasizes selective early reflection level and direct/room ratio rather than maximizing global reverberation: https://pmc.ncbi.nlm.nih.gov/articles/PMC13451706/ + +## P8.7 engineering candidate — one native DSP, private only + +P8.7 is **renderMode=6**, gated by `ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON` and `SONKU_P87_MUSIC_BODY_RESEARCH=1`, defaults OFF in public builds. Native JUCE v8 uses the **same 59-byte** mode/session state layout, retains v1-v7, rejects rejected physical modes 1 and 2. Only capability-gated source readback shows P8.7 beside P8.6/P8.5/P8.4/P8.2. The approved GUI and mixer source outside SonKu are untouched. + +ROOM OFF: output from mode 6 MUST be **bit identical** to P8.6 across yaw/azimuth, stereo correlation and audio chunking. Controls, 220Hz transparent bass, all per-ear measured HRIRs, 0° direct elevation, world/head transform and four horizontal/floor/ceiling image paths are unchanged. + +ROOM ON (mode 6 only): + +1. Add a modest **+1.9dB asymptotic 3.9kHz first-order minimum-phase air shelf** after the existing KEMAR measured direct EQ, identical coefficient for L/R. This is a *broad shelf*, not an aggressive inverted HRTF pinna-notch EQ, hard clipper or excitation distortion. Phase lag/leads are frequency-dependent but L/R share exactly the same filter topology, therefore no arbitrary interaural delay is inserted. +2. Preserve original *un-HRTF-filtered per-channel* music LF below the 220Hz crossover, with **+0.75dB (1.09 pressure)** when ROOM ON. Avoid introducing a second separate bass synth or side-signal doubling. +3. Add **42% of a first-order 175Hz lowpass** of the existing **eight-line stereo FDN wet tail** to itself. This is an additional natural, delayed low-frequency room component. The existing FDN decay/direction, frequency-band absorption, ER gain, six-wall geometry and off/room state remain as P8.6. Critically, the previous full-band diffuse HF tail does **not** get broadly amplified. + +No heap, mutex, disk IO, trig, FFT, extra 140-tap HRTF or second PCM graph in the native callback. Gains and poles are bounded and prepared off audio. A mode or room transition clears only four scalar memories inside the existing 12ms audio-controlled mode fade. + +This is a **candidate**, not a proven cure for phase cancellation or equivalent to dearVR. Exaggerated bass, spectral harshness or perceived inside-head image would fail owner headphone FAT. + +## Qualification gates + +- Source native: 44.1k/48k, ROOM OFF exactly equal P8.6 for az 0/90/180, yaw 0/60/180, correlated/antiphase, 64 and 128 frame parity. ROOM ON differs, remains finite/bounded both 1.6m studio and 6.1m LARGE. Separate actual processor transfer scans verify slight higher HF and more lower FDN energy while not boosting high FDN content. +- Windows: actual JUCE v8 audio-applied ACK; reject mode 1/2, old v7 P8.6 mode5 preserved, old v6 P8.5 mode4 and v5 P8.4 mode3 preserved; native device reprepare, stale-session acceptance guard, same .smix state, 16 focused real native CTests. Proper embedded GUI resource verification and source-specific provenance/ZIP. +- Listening FAT: level-match, same headphones, same music, no external EQ/crossfeed. First ROOM OFF P8.6=P8.7. Then ROOM ON, 1.6–3m and owner's LARGE/6.1m, reflections 100%, reverb47%. Rotate 0°, ±30°, ±60°, 90°, 180°. Check high-band detail, consonants, transient, acoustic separation, kick/bass weight, phase sensation, vocal center, horizontal speaker pinpoint, floor/ceiling sensation, fatigue. Owner chooses P8.6 if newer version loses clarity, focus or musicality. + +No public release, no production merge and no claim of subjective completion before owner listens. Because the branch stacks on P8.6, later approved integration MUST forward-port clean changes onto current main without bringing dormant P8.3 modes into production. From be9126dceaabf219ec1e36a86034d579c46d015b Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Sun, 15 Nov 2026 10:32:32 +0700 Subject: [PATCH 9/9] ci(sonku): P8.7 source-native air/LF proof + 16 Windows JUCE CTests, verified PE and FAT ZIP --- .github/workflows/sonku-p87-windows-field.yml | 288 ++++++++++++++++++ 1 file changed, 288 insertions(+) create mode 100644 .github/workflows/sonku-p87-windows-field.yml diff --git a/.github/workflows/sonku-p87-windows-field.yml b/.github/workflows/sonku-p87-windows-field.yml new file mode 100644 index 000000000..875359182 --- /dev/null +++ b/.github/workflows/sonku-p87-windows-field.yml @@ -0,0 +1,288 @@ +name: SonKu P8.7 musical-air-body native mixer portable FAT x64 +# Private JUCE app; no release. Native v8 A/B: P8.2/P8.4/P8.5/P8.6/P8.7. +on: + pull_request: + paths: + - '.github/workflows/sonku-p87-windows-field.yml' + workflow_dispatch: +permissions: + contents: read +concurrency: + group: sonku-p87-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 + - name: Native JS and source GUI capability checks + run: | + set -euo pipefail + node --check site/preview-v2/assets/mixer-native-sonku.js + node tests/sonku_p73_gui_contract_test.js + grep -q "'FIELD_PREVIEW_FULL_CTEST_NOT_RUN'" scripts/m3e_fat_evidence_gate.mjs + python -m unittest discover -s tests -p native_peq_assembly_test.py + - name: 44.1 and 48 kHz prepared PCM source regression + run: | + set -euo pipefail + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + tests/sonku_p72_realtime_xyz_test.cpp -o /tmp/sonku-p75-pcm + /tmp/sonku-p75-pcm + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + tests/sonku_p75_stereo_integrity_test.cpp -o /tmp/sonku-p75-music + /tmp/sonku-p75-music + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + -DSONKU_P80_TRANSPARENT_BASS_RESEARCH=1 \ + tests/sonku_p80_tonal_room_evidence_test.cpp -o /tmp/sonku-p80-evidence + /tmp/sonku-p80-evidence | tee /tmp/sonku-p80-acoustic-evidence.csv + grep -q '^PASS P8:' /tmp/sonku-p80-acoustic-evidence.csv + 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 ` + -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') { + 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') + $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 ARMixSonKuP87NativeTests + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP87JuceV8AudioAppliedAckV7Restore$' + 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 + 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)$' + 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 + p84RenderModes = @('MusicBedP82','MusicSpatialP84','MusicSpatialP85','MusicSpatialP86','MusicSpatialP87') + 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 = 8 + fullWindowsExecutable = $true + publicRelease = $false + physicalAsioQualified = $false + dearVrPerceptualParityProven = $false + qualification = 'SONKU_P87_SCOPED_NATIVE_PCM_JUCE_16_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_P87_MUSICAL_AIR_RESONANT_BODY_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 + $p.sonkuExperiment.stateSchema -ne 8 -or $p.sonkuExperiment.publicRelease) { + throw 'SONKU_P87_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_P87_MUSICAL_AIR_RESONANT_BODY_20261115.md -Destination dist/SONKU_P87_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_P87_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_P87_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-P87-Musical-Air-Body-Windows-x64-${{ github.run_id }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0