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
288 changes: 288 additions & 0 deletions .github/workflows/sonku-p87-windows-field.yml

Large diffs are not rendered by default.

57 changes: 56 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -275,7 +282,9 @@ target_compile_definitions(ARMixConsole PRIVATE
$<$<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>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT}>:ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT}>:SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1>)
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT}>:SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT}>:ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=1>
$<$<BOOL:${ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT}>: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.
Expand Down Expand Up @@ -591,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()
Expand Down
48 changes: 48 additions & 0 deletions docs/SONKU_P87_MUSICAL_AIR_RESONANT_BODY_20261115.md
Original file line number Diff line number Diff line change
@@ -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.
15 changes: 15 additions & 0 deletions engine/builtin_fx/SonKuSpatialProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
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 @@ -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
Expand All @@ -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
Expand Down
53 changes: 53 additions & 0 deletions engine/builtin_fx/sonku/SonKuP87MusicalAirBody.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// SPDX-License-Identifier: AGPL-3.0-only
#pragma once
#include <array>
#include <cmath>

// 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<float>(1.-std::exp(-twoPi*3900./rate));
airGain_=static_cast<float>(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<float>(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<float,2> 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<float,2> airLow_{},roomLow_{};
float airAlpha_=0.f,roomAlpha_=0.f,airGain_=0.f;
};
} // namespace armix::sonku::p87
Loading
Loading