Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
270 changes: 270 additions & 0 deletions .github/workflows/sonku-p85-windows-field.yml

Large diffs are not rendered by default.

50 changes: 49 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ if(ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT AND
NOT ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT)
message(FATAL_ERROR "P8.4 research requires P8.3 typed native host as transport; old P8.3 modes remain hidden/rejected")
endif()
option(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT
"Enable opt-in P8.5 world-locked music scene for private headphone FAT" OFF)
if(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT AND
NOT ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT)
message(FATAL_ERROR "P8.5 requires P8.4 native fusion research; production stays OFF")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

Expand Down Expand Up @@ -258,7 +264,9 @@ target_compile_definitions(ARMixConsole PRIVATE
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT}>:ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT}>:SONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT}>:ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT}>:SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1>)
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT}>:SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT}>:ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT}>:SONKU_P85_WORLD_COHERENCE_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.
Expand Down Expand Up @@ -493,6 +501,46 @@ if(BUILD_TESTING)
SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1)
add_test(NAME NativeSonKuP84JuceV5AudioAckLegacySafeRestore
COMMAND ARMixSonKuP84NativeTests)
if(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT)
add_executable(ARMixSonKuP85WorldSourceTests
tests/sonku_p85_world_locked_source_test.cpp)
target_compile_features(ARMixSonKuP85WorldSourceTests PRIVATE cxx_std_20)
target_compile_definitions(ARMixSonKuP85WorldSourceTests 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)
add_test(NAME NativeSonKuP85WorldCoherentMidYawSourceAndFidelity
COMMAND ARMixSonKuP85WorldSourceTests)
juce_add_console_app(ARMixSonKuP85NativeTests
PRODUCT_NAME "ArSonMix SonKu P85 Native JUCE v6 Tests")
target_sources(ARMixSonKuP85NativeTests PRIVATE
tests/sonku_p85_native_juce_v6_test.cpp)
target_compile_features(ARMixSonKuP85NativeTests PRIVATE cxx_std_20)
target_link_libraries(ARMixSonKuP85NativeTests PRIVATE
juce::juce_audio_processors juce::juce_recommended_config_flags)
target_compile_definitions(ARMixSonKuP85NativeTests 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
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)
add_test(NAME NativeSonKuP85JuceV6AudioAckLegacySafeRestore
COMMAND ARMixSonKuP85NativeTests)
endif()
endif()
endif()
endif()
Expand Down
34 changes: 34 additions & 0 deletions docs/SONKU_P85_WORLD_HEAD_COHERENCE_20261115.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# 8D-SonKu P8.5 — world/head-coherent music anchor (research only)

## Field feedback and causal audit

The owner's Windows P8.4 headphone FAT (`641b4eae`, Actions `43653357348`) rated P8.4 slightly more musical than P8.2 but reported inadequate externalization, with the apparent source in front and above the head. P8.3 was *rejected* due to severe musical collapse; neither P8.3 nor its LF480 matrix is permitted as a native selectable mode in P8.5.

In actual P8.4 `SonKuSpatialCore::updateKernels`, the common music MID anchor used `interpolate(centerTarget_, degrees_)`. Meanwhile its left/right virtual speaker HRIR used `p83::stereo(degrees_, spread, headYaw)`, and its early reflection paths used headYaw. This was a **verified reference-frame mismatch**, not proof that elevation or ceiling reflections are the perceptual cause. Strong head-locked SIDE, late FDN directionlessness, generic MIT KEMAR HRTF and actual headphone response remain competing factors. The owner FAT at yaw180/spread180/28.8m/reflections100% is not a neutral diagnostic.

## Source implementation

- `ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT` and `SONKU_P85_WORLD_COHERENCE_RESEARCH`, both default OFF in production.
- Mode 4 corrects **only** the P8.4 common MID anchor to `p83::toHead(worldAzimuth,headYaw)`; the two speaker HRIR and early reflections already use world/head separation.
- One authoritative native JUCE `SonKuSpatialCore`. The identical P8.4 fused FIR, bass crossover, music SIDE preservation, tonal correction, reflection gains and reverb remain active. No second engine, no unlicensed BRIR, no extra per-sample FIR, no dynamic allocation in the callback.
- Modes 0=P8.2, 3=P8.4 and 4=P8.5 are selectable in exact native schema-v6 capability-gated UI. Native state v6 remains the existing 59-byte layout; v1–v5 restore supported with explicit old P8.3 mode migration to 0. Real audio-side mode switch still uses 12ms fade-out/fade-in and ACK/readback, not browser-only labels.
- In v6 research UI, changing mode does not overwrite scene yaw, azimuth, distance, ROOM or motion parameters. Production/offline P8.2 and P8.4 processing code is unchanged.
- A v6 research branch is still stacked on the older P8.4 *research* code, which includes P8.3-era dormant implementation. **Do not merge this branch to main or publish until a clean P8.2-based extraction after physical FAT.**

## Non-negotiable waveform gates

Native source tests require: P8.4 and P8.5 **bit-identical** on neutral yaw0 (ROOM OFF/ON and correlated/anti-phase); block 64/128 parity; full direct PCM at world180+yaw180 in P8.5 identical to world0+yaw0 in P8.4 (ROOM OFF); and distinguishable erroneous P8.4 center transfer for the same world180+yaw180 test. JUCE v6 must separately confirm mode-4 SPSC queued audio-applied ACK, state v6, v1–v5 restoration and invalid old modes. The Windows field workflow verifies executable, embedded GUI files, full source SHA and portable ZIP.

These gates can verify PCM geometry without establishing that headphones produce out-of-head localization. Do not relax checks after failure.

## Headphone FAT

Use identical song/headphones/Windows level, disable downstream spatial enhancements, and level-match the actual recorded output. First compare yaw0, 60° stereo, STATIC, 1.6–3m with ROOM OFF, then ROOM ON. **P8.4 and P8.5 yaw0 are intentionally identical**; improvement should not be claimed in that case.

Then independently try yaw ±30/±60/±90/180 and angle 60°/180°, with FRONT, LEFT, RIGHT and REAR world positions, followed by the owner LARGE/100%-reflections case. Score bass, vocal openness, transient, fatigue, front/back and perceived elevation, source distance and stereo focus separately. Choose P8.2/P8.4 immediately if P8.5 sounds worse. True wide-angle world-locked SIDE and listener/headphone personalization are future separately measured hypotheses; **do not solve them using arbitrary crossfeed or aggressive side removal**.

References (research only, no proprietary assets copied): [Sennheiser dearVR Clarity](https://help.sennheiser.com/hc/en-us/articles/27424692616594-How-to-produce-natural-immersive-music-with-the-CLARITY-modul-of-dearVR-PRO2), [SOFA / AES69](https://www.sofacoustics.org/), [2025 sound externalization and non-individual HRTFs](https://pubmed.ncbi.nlm.nih.gov/40748294/).

## Release veto

No claimed dearVR parity, no public release or merge, no physical ASIO/XRUN qualification, and no assertion of real externalization without the owner's headphone FAT. P8.4 continues as the current perceptual golden and P8.2 as fallback.
17 changes: 17 additions & 0 deletions engine/builtin_fx/SonKuSpatialProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor,
#if defined(ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT) && ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT
#if defined(ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT
#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
out.writeInt(6); // unchanged 59-byte state; P8.5 is opt-in mode 4
#else
out.writeInt(5); // same 59-byte layout as v4, new P8.4 mode
#endif
#else
out.writeInt(4);
#endif
Expand Down Expand Up @@ -210,6 +214,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor,
&&version!=4
#if defined(ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT
&&version!=5
#if defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT
&&version!=6
#endif
#endif
#endif
#endif
Expand All @@ -220,6 +227,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor,
||(version==4&&size!=59)
#if defined(ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT
||(version==5&&size!=59)
#if defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT
||(version==6&&size!=59)
#endif
#endif
#endif
#endif
Expand Down Expand Up @@ -272,6 +282,13 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor,
return false;
if(version==5 && next.musicCompatibleLowFrequency)
return false;
#if defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT
// Preserve legacy P8.4 mode=3 on v5 restore. Never revive v4
// rejected physical modes; v6 permits only music modes 0/3/4.
if(version==6 && next.renderMode!=0 && next.renderMode!=3 && next.renderMode!=4)
return false;
if(version==6 && next.musicCompatibleLowFrequency)return false;
#endif
#endif
}
#endif
Expand Down
6 changes: 6 additions & 0 deletions engine/builtin_fx/sonku/SonKuP83SpeakerScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ enum class Mode : std::uint8_t {
MusicBedP82=0, MonoObject=1, SpeakerMonitor=2,
#if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH
MusicSpatialP84=3
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
,MusicSpatialP85=4
#endif
#endif
};
enum class Stem : std::uint8_t { Combined=0, Direct=1, Early=2, Late=3 };
Expand All @@ -18,6 +21,9 @@ inline bool valid(Mode m) noexcept {
m==Mode::SpeakerMonitor
#if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH
|| m==Mode::MusicSpatialP84
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
|| m==Mode::MusicSpatialP85
#endif
#endif
;
}
Expand Down
28 changes: 27 additions & 1 deletion engine/builtin_fx/sonku/SonKuSpatialCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ inline bool valid(const Settings& s) noexcept {
#if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH
s.renderMode>=0 &&
#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
s.renderMode<=4 && ((s.renderMode!=3 && s.renderMode!=4) || !s.musicCompatibleLowFrequency) &&
#else
s.renderMode<=3 && (s.renderMode!=3 || !s.musicCompatibleLowFrequency) &&
#endif
#else
s.renderMode<=2 &&
#endif
Expand Down Expand Up @@ -425,6 +429,9 @@ class SonKuSpatialCore final {
p83Mode_!=p83::Mode::MusicBedP82
#if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH
&& p83Mode_!=p83::Mode::MusicSpatialP84
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
&& p83Mode_!=p83::Mode::MusicSpatialP85
#endif
#endif
;
const bool monoObject=positionedMode && p83Mode_==p83::Mode::MonoObject;
Expand All @@ -451,7 +458,11 @@ class SonKuSpatialCore final {
#endif
#if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH
const bool musicFused=musicSafe &&
(p84FusedMusic_ || p83Mode_==p83::Mode::MusicSpatialP84);
(p84FusedMusic_ || p83Mode_==p83::Mode::MusicSpatialP84
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
|| p83Mode_==p83::Mode::MusicSpatialP85
#endif
);
#else
constexpr bool musicFused=false;
#endif
Expand Down Expand Up @@ -747,6 +758,9 @@ class SonKuSpatialCore final {
if(p83Mode_!=p83::Mode::MusicBedP82
#if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH
&& p83Mode_!=p83::Mode::MusicSpatialP84
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
&& p83Mode_!=p83::Mode::MusicSpatialP85
#endif
#endif
&& room_.preparedProfile()==SonKuReflectionProfile::SixSurfaceKemarResearch) {
// 2x2 measured source-to-ear transfer. No MID center
Expand All @@ -770,13 +784,25 @@ class SonKuSpatialCore final {
#endif
#if defined(SONKU_P84_SINGLE_CORE_FUSION_RESEARCH) && SONKU_P84_SINGLE_CORE_FUSION_RESEARCH
if((p83Mode_==p83::Mode::MusicSpatialP84 ||
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
p83Mode_==p83::Mode::MusicSpatialP85 ||
#endif
(p84FusedMusic_ && p83Mode_==p83::Mode::MusicBedP82)) &&
room_.preparedProfile()==SonKuReflectionProfile::SixSurfaceKemarResearch){
// One 2x2 FIR graph. Preserve the EXACT P8.2 mixed-channel
// foundation while injecting only a bounded high-frequency
// measured directional difference into each source HRIR.
// Avoid LF480: no invented bass matrix or additional DSP core.
#if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH
// P8.5: common music MID and both virtual speakers are in
// the same head-relative frame. Earlier musical modes remain
// byte-identical; only mode 4 uses this yaw-coherent anchor.
interpolate(centerTarget_,p83Mode_==p83::Mode::MusicSpatialP85
?static_cast<double>(p83::toHead(static_cast<float>(degrees_),p83HeadYaw_))
:degrees_);
#else
interpolate(centerTarget_,degrees_);
#endif
const auto positions=p83::stereo(static_cast<float>(degrees_),
settings_.stereoSpreadDegrees,p83HeadYaw_);
interpolate(targets_[0],positions.leftHead);
Expand Down
Loading
Loading