From b0a8d92f71033f4a95f06a5509d89f78ac158faf Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 19:51:29 +0700 Subject: [PATCH 1/9] feat(sonku): P9.9 musical vocal depth and lateral stage unmasking, opt-in and Venue-bit-exact FAT --- .github/workflows/p1-windows.yml | 17 +- CMakeLists.txt | 24 ++- ...KU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md | 39 +++++ .../sonku/SonKuP99MusicalVocalDepth.h | 146 ++++++++++++++++++ engine/builtin_fx/sonku/SonKuSpatialCore.h | 48 ++++++ scripts/verify_sonku_p99_vocal_depth.py | 55 +++++++ site/preview-v2/assets/mixer-native-sonku.js | 17 +- src/Main.cpp | 5 + tests/sonku_p99_gui_contract_test.cjs | 23 +++ tests/sonku_p99_vocal_depth_source_test.cpp | 93 +++++++++++ 10 files changed, 459 insertions(+), 8 deletions(-) create mode 100644 docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md create mode 100644 engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h create mode 100644 scripts/verify_sonku_p99_vocal_depth.py create mode 100644 tests/sonku_p99_gui_contract_test.cjs create mode 100644 tests/sonku_p99_vocal_depth_source_test.cpp diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 0962b87c1..60f8d8af2 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -723,6 +723,14 @@ jobs: /tmp/sonku-p98-scene-candidate > /tmp/sonku-p98-scene-candidate.csv cat /tmp/sonku-p98-venue-reference.csv /tmp/sonku-p98-scene-candidate.csv python3 scripts/verify_sonku_p98_scenes.py /tmp/sonku-p98-venue-reference.csv /tmp/sonku-p98-scene-candidate.csv + if [[ "${{ github.head_ref }}" == feat/sonku-p98-p99-* ]]; then + node tests/sonku_p99_gui_contract_test.cjs + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic tests/sonku_p99_vocal_depth_source_test.cpp -o /tmp/sonku-p99-unit + /tmp/sonku-p99-unit + g++ $PRESET_FLAGS -DSONKU_P98_SCENE_VOICING_RESEARCH=1 -DSONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1 tests/sonku_p98_integrated_scene_test.cpp -o /tmp/sonku-p99-integrated + /tmp/sonku-p99-integrated > /tmp/sonku-p99-integrated.csv + python3 scripts/verify_sonku_p99_vocal_depth.py /tmp/sonku-p98-scene-candidate.csv /tmp/sonku-p99-integrated.csv + fi fi fi fi @@ -760,6 +768,7 @@ jobs: $p96flag = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { 'ON' } else { 'OFF' } $p97flag = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { 'ON' } else { 'OFF' } $p98flag = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { 'ON' } else { 'OFF' } + $p99flag = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { 'ON' } else { 'OFF' } 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" ` @@ -780,6 +789,7 @@ jobs: -DARMIX_SONKU_EXPERIMENTAL_P96_DISTANCE_REINFORCEMENT=$p96flag ` -DARMIX_SONKU_EXPERIMENTAL_P97_STAGE_IMPACT=$p97flag ` -DARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING=$p98flag ` + -DARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH=$p99flag ` -DBUILD_TESTING=ON if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $cache = Get-Content build/CMakeCache.txt -Raw @@ -797,6 +807,7 @@ jobs: if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $targets += 'ARMixSonKuP96DistanceTests' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $targets += 'ARMixSonKuP97StageTests' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $targets += 'ARMixSonKuP98VoicingTests' } + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { $targets += 'ARMixSonKuP99VocalDepthTests' } cmake --build build --config Release --parallel 2 --target $targets if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } if (-not (Test-Path -LiteralPath 'build/ARMixConsole_artefacts/Release/AR MIX Studio.exe' -PathType Leaf)) { @@ -807,6 +818,7 @@ jobs: if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $tests += '|96DistanceBassAndTrebleRetention' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $tests += '|97BassVocalExternalAirSafety' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $tests += '|98SceneVoicingVenueLock' } + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { $tests += '|99AdaptiveVocalDepthVenueLock' } $tests += ')$' ctest --test-dir build -C Release --output-on-failure -R $tests if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } @@ -831,6 +843,9 @@ jobs: Copy-Item docs/SONKU_P97_STAGE_IMPACT_FAT_20261116.md dist/SONKU_P97_STAGE_FAT.md if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { Copy-Item docs/SONKU_P98_OPERATOR_VENUE_CHECKPOINT_AND_VOICING_FAT_20261116.md dist/SONKU_P98_SCENE_VOICING_FAT.md + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { + Copy-Item docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md dist/SONKU_P99_VOCAL_DEPTH_FAT.md + } } } } @@ -840,7 +855,7 @@ jobs: throw 'SONKU_P90_SOURCE_COMMIT_MISMATCH' } $provenance | Add-Member -Force -NotePropertyName sonkuExperiment -NotePropertyValue @{ - mode = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { 'P9.8_SCENE_VOICING_VENUE_LOCKED_RESEARCH' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*') { 'P9.7_STAGE_IMPACT_EXTERNAL_PRESENCE_RESEARCH' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*') { 'P9.6_STAGE_BASS_AIR_DISTANCE_RESEARCH' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { 'P9.5_IMMERSIVE_MUSIC_VENUE_FOUNDATION' } else { 'P9.4_FRONT_REAR_DEPTH_EXPERIMENT' } + mode = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { 'P9.9_MUSICAL_VOCAL_DEPTH_VENUE_LOCKED_PRIVATE_FAT' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { 'P9.8_SCENE_VOICING_VENUE_LOCKED_RESEARCH' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*') { 'P9.7_STAGE_IMPACT_EXTERNAL_PRESENCE_RESEARCH' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*') { 'P9.6_STAGE_BASS_AIR_DISTANCE_RESEARCH' } elseif ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { 'P9.5_IMMERSIVE_MUSIC_VENUE_FOUNDATION' } else { 'P9.4_FRONT_REAR_DEPTH_EXPERIMENT' } stateSchema = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { 12 } else { 11 } headphoneFat = 'PENDING' publicRelease = $false diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ad2cdd5d..14a799d3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,6 +131,14 @@ if(ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING AND NOT ARMIX_SONKU_EXPERIMENTAL_P97_STAGE_IMPACT) message(FATAL_ERROR "P9.8 requires P9.7 approved stage; public default OFF") endif() +# P9.9 adds modest adaptive center-vocal articulation and spatial unmasking. +# Named scenes only; P9.8 is an independent immutable reference on its branch. +option(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH + "Private low-cost musical vocal focus; keep P9.8/approved Venue unchanged" OFF) +if(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH AND + NOT ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING) + message(FATAL_ERROR "P9.9 requires P9.8 native typed scene voicings") +endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -357,7 +365,9 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:SONKU_P97_STAGE_IMPACT_RESEARCH=1> $<$:ARMIX_SONKU_EXPERIMENTAL_P97_STAGE_IMPACT=1> $<$:SONKU_P98_SCENE_VOICING_RESEARCH=1> - $<$:ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING=1>) + $<$:ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING=1> + $<$:SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH=1>) if(WIN32) # Windows retains its proven ASIO-first / WASAPI / static WebView2 distribution. # Never link Windows loader or sound APIs into macOS/Linux builds. @@ -894,7 +904,8 @@ if(BUILD_TESTING) SONKU_P95_MUSICAL_PRESENCE_RESEARCH=1 $<$:SONKU_P96_DISTANCE_REINFORCEMENT_RESEARCH=1> $<$:SONKU_P97_STAGE_IMPACT_RESEARCH=1> - $<$:SONKU_P98_SCENE_VOICING_RESEARCH=1>) + $<$:SONKU_P98_SCENE_VOICING_RESEARCH=1> + $<$:SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1>) add_test(NAME NativeSonKuP95MusicPresenceVenue COMMAND ARMixSonKuP95MusicTests) endif() @@ -919,6 +930,13 @@ if(BUILD_TESTING) add_test(NAME NativeSonKuP98SceneVoicingVenueLock COMMAND ARMixSonKuP98VoicingTests) endif() + if(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH) + add_executable(ARMixSonKuP99VocalDepthTests + tests/sonku_p99_vocal_depth_source_test.cpp) + target_compile_features(ARMixSonKuP99VocalDepthTests PRIVATE cxx_std_20) + add_test(NAME NativeSonKuP99AdaptiveVocalDepthVenueLock + COMMAND ARMixSonKuP99VocalDepthTests) + endif() juce_add_console_app(ARMixSonKuP90NativeTests PRODUCT_NAME "ArSonMix SonKu P90 JUCE v11 State Tests") target_sources(ARMixSonKuP90NativeTests PRIVATE @@ -938,6 +956,8 @@ if(BUILD_TESTING) ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=1 $<$:ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING=1> $<$:SONKU_P98_SCENE_VOICING_RESEARCH=1> + $<$:SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH=1> SONKU_P7_MEASURED_ELEVATION_RESEARCH=1 SONKU_P71_DIRECT_XYZ_RESEARCH=1 SONKU_P72_NATIVE_XYZ_RT=1 diff --git a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md new file mode 100644 index 000000000..37b15d969 --- /dev/null +++ b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md @@ -0,0 +1,39 @@ +# SonKu P9.9 — Musical Vocal Depth / Wide Instrument Layers (2026-11-16) + +## Approved checkpoints and strict boundaries + +- **Venue Mega Space is frozen** at P9.7 SHA `fda0eef669e0a59575c489e149662c1bf878c998` on `checkpoint/sonku-p97-venue-mega-space-approved-20261116`. Identical Venue P9.8 native PCM remains the mandatory baseline. +- P9.8 `4a9e5b2c455818c7a0dc8507ec2b7863be215033` is the independent scene-voicing baseline, *not* overwritten. P9.9 is stacked in a separate opt-in draft branch/PR. +- P9.9 adds no audio device, callback, IR convolution, PCM graph, 96k resampling, WebAudio sidecar, neural model or new .smix state schema. It is an extra compile-time stage in the **existing single native graph** for typed scene IDs 1 Signature, 2 Studio, 3 Cinema, only in active world-speaker mode9 with ROOM ON and spatial MIX>0. +- VENUE / Custom scene ID 0 (including old restored v11 state), ROOM OFF, and MIX=0 **must remain exact P9.8 bytes** at 44.1/48k and front/rear; explicitly compare native PCM hash. No change to spatial placement, scene preset values, 10m Venue, curves, P98 class or KEMAR HRIR. +- Private `ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH=OFF` default requires opt-in P9.8. Native bridge remains *v12*, with truthful additive `p99MusicalVocalDepth` capability (never infer from GUI). The ordinary public build remains unchanged. + +## Engineering rationale from global audio research + +Full stereo recordings do not provide separated singer and backing stems. A center-frequency boost alone elevates guitars/piano/snare too; a center-dominant *activity estimate* is a conservative guide, not actual voice identity. This project must never claim vocal separation or independent vocalist positioning. Relevant research: + +- Yuval Ronen, AES 139 Paper 9445 (2015), [Vocal Clarity in the Mix](https://aes.org/publications/elibrary/elibrary-page/?id=18001): professional mixing techniques can improve *perceived* intelligibility; perceptual testing is needed. +- Wakefield & Dewey, AES 138 Paper 9341 (2015), [Frequency Masking in Multitrack Music](https://aes.org/publications/elibrary/elibrary-page/?id=17765): spatial separation/panning is a useful alternative to large mirrored EQ boosts. +- Kirsten Hermes, AES 146 Paper 10174 (2019), [Spectral Clarity of Vocals](https://aes.org/publications/elibrary/elibrary-page/?id=20307): timbral clarity depends on program; simply adding high-frequency content is not universally safe. +- Hafezi & Reiss, JAES 63(5) (2015), [Autonomous Multitrack EQ Masking Reduction](https://aes.org/publications/elibrary/elibrary-page/?id=17637): masking relief can improve intelligibility when instrument stems are available—**not equivalent** to doing stem-specific EQ on one stereo master. +- Wichern et al., AES 141 Paper 9646 (2016), [Masking and Loudness Loss](https://aes.org/publications/elibrary/elibrary-page/?id=18450): not all spectral overlap is problematic, so avoid indiscriminate maximal unmasking. + +## Implemented single-graph acoustic strategy + +1. **Direct center articulation, full-bodied**: source before the existing measured loudspeaker KEMAR FIR. Two broad first-order complementary bands (210–880Hz body, 760–3350Hz articulation), at bounded profile weights. The gate follows a smoothed ratio of in-band MID to SIDE and a minimum audible level; its 21ms/122ms envelope + 32ms/187ms gain attention avoid per-syllable switches. A 55ms scene change ramp prevents step clicks. Sig > Cinema > Studio intensity. +2. **Lateral instrument atmosphere without fake Haas**: only the *already physically modeled first-image stereo reflection* receives a tiny complementary 680–3900Hz SIDE emphasis (maximum 0.08 linear); the MID and source phase are unchanged. No added random delay, decorrelation, stereo phase rotation, width collapse or rear center duplication. +3. **Vocal vs backdrop depth**: when center dominance is strong, slightly relieve the 720–3400Hz MID of the *existing late room return* (maximum 0.095 linear), never its SIDE or bass. Gives the real direct center more contrast to the diffuse surroundings. The floor/ceiling/side reflection network and room tails otherwise remain authoritative. +4. **No 4–8k treble/sibilance shelf**; no high-pass stripping at 250Hz, hard expander, multiband limiter, or vocal-only fake stem. Preserve bass impact and 0.98 linked peak guard, and reject non-finite PCM in existing core. +5. **No significant CPU overhead**: fixed scalar one-pole states, constant 4 profile vectors, no heap allocation/block buffer/FFT/convolution beyond the existing P90 path, no extra sample latency. Exact CPU saving is not proven by source tests; real Windows performance/ASIO headphone audition remains operator FAT. + +## Validation matrix and acceptance limits + +- Standalone **44.1/48k**: male-range 260Hz body must not thin; 1800Hz increases vocal-band center audibility; 7600Hz bounded (not harsh); real early-IMAGE side expands slightly; late center band reduces; late SIDE and anti-phase direct remain unchanged; near silence avoids pump; on-the-fly Venue and ROOM OFF exact. +- Full wet actual KEMAR+room+P95-P98 graph: P9.8 vs P9.9 **24 cases** (44.1/48k × front/rear × Venue/Signature/Studio/Cinema/ROOM OFF/MIX0), exact hashes for Venue/ROOM OFF/MIX0; no original bass deletion or 7500Hz excessive boost; low max linked peak guard. +- Native JUCE v12 ACK and old v11 migration regressions; compile/test on Windows x64 and Chromium front-end capability contract; package full GUI portable executable with SHA provenance and this FAT guide. No automatic merge/release without native Windows CI and a level-matched listener test. + +## Honest remaining limitations and hearing FAT + +Mid/side gating can enhance a centered guitar/snare/piano, not only a singer. No algorithm can distinguish overlapping mono-center sources with certainty without separate stems or model-based extraction. The confidence detector **must remain conservative** and can occasionally act on instrument-only centered content. + +Use level-matched male/female vocal recordings, dense rock drums/guitars, piano/voice, sibilant vocal, cymbal-heavy instrumental, mono full mix, deliberate 180° anti-phase, and front/rear stage motion. Listen for chest body, articulatory consonants, non-nasal tone, no new sharp 3–8k peak, no center ghost, no pumping, no collapsed room or bass. Quantitative PCM/spectral tests do not prove the intended **subjective** intimacy or audience goosebumps. In all doubt restore the P9.8 reference; the Venue P9.7 checkpoint is non-negotiable. diff --git a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h new file mode 100644 index 000000000..d066c0847 --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -0,0 +1,146 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include +#include + +// P9.9 PRIVATE, scene-aware musical vocal focus. This is NOT voice separation +// and does not infer a singer from a full stereo mix. Only center-dominant, +// audible midrange earns a modest, slowly smoothed forward correction. +// The existing two virtual speakers, measured KEMAR FIRs, directional first +// reflections and linked limiter remain the ONLY output graph. No FFT, +// delay line, resampling, allocation, string analysis or per-sample trig. +// Venue/Custom (scene=0), ROOM OFF, and MIX=0 return exact P9.8/P9.7 PCM. +namespace armix::sonku::p99 { +class MusicalVocalDepth final { +public: + struct Stereo {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; + const auto alpha=[rate](double hz) noexcept { + constexpr double twoPi=6.283185307179586476925286766559; + return static_cast(1.-std::exp(-twoPi*hz/rate)); + }; + bodyLow_=alpha(210.); + bodyHigh_=alpha(880.); + focusLow_=alpha(760.); + focusHigh_=alpha(3350.); + widthLow_=alpha(680.); + widthHigh_=alpha(3900.); + lateLow_=alpha(720.); + lateHigh_=alpha(3400.); + attack_=alpha(7.5); // ~21 ms envelope attack + release_=alpha(1.3); // ~122 ms envelope release + attentionAttack_=alpha(5.); // ~32 ms, no per-syllable pumping + attentionRelease_=alpha(.85);// ~187 ms + gainSlew_=static_cast(1.-std::exp(-1./(rate*.055))); + reset(); + return true; + } + void reset() noexcept { + midBodyLow_={};midBodyHigh_={};midFocusLow_={};midFocusHigh_={}; + sideFocusLow_={};sideFocusHigh_={};firstLow_={};firstHigh_={}; + tailLow_={};tailHigh_={}; + centerEnvelope_=sideEnvelope_=attention_=0.f; + gains_={}; + active_=false; + } + // ID 0 = completely unmodified approved Venue or Custom/Live Orbit. + // Signature offers the clearest front-stage; Cinema preserves LF body; + // Studio is deliberately a lower-delta, natural room. + Stereo source(float left,float right,int scene,bool enabled) noexcept { + active_=enabled && scene>=1 && scene<=3; + const auto target=profiles_[active_?scene:0]; + for(std::size_t i=0;i0.f?attentionRelease_:attentionAttack_)* + (0.f-attention_); + return {left,right}; // NO altered float arithmetic + } + + const float mid=.5f*(left+right); + const float side=.5f*(left-right); + const float body=midBodyHigh_.run(bodyHigh_,mid)- + midBodyLow_.run(bodyLow_,mid); + const float focus=midFocusHigh_.run(focusHigh_,mid)- + midFocusLow_.run(focusLow_,mid); + const float sideFocus=sideFocusHigh_.run(focusHigh_,side)- + sideFocusLow_.run(focusLow_,side); + const float c=std::abs(focus); + const float s=std::abs(sideFocus); + // Envelope matching is musical-phrase-scale, not a per-sample gate. + centerEnvelope_+=(c>centerEnvelope_?attack_:release_)* + (c-centerEnvelope_); + sideEnvelope_+=(s>sideEnvelope_?attack_:release_)* + (s-sideEnvelope_); + const float centerShare=centerEnvelope_/ + (centerEnvelope_+1.65f*sideEnvelope_+1.e-5f); + const float dominance=std::clamp((centerShare-.46f)*2.f,0.f,1.f); + // Silence and tiny leakage must never trigger a sudden voice boost. + const float audible=std::clamp( + (centerEnvelope_-.00075f)/.0035f,0.f,1.f); + const float desired=dominance*audible; + attention_+=(desired>attention_?attentionAttack_:attentionRelease_)* + (desired-attention_); + // 210-880Hz body is explicitly reinforced, not cut. Most focus is + // at 760-3350Hz. No upper-air shelf, de-esser or narrow 4-8k peak. + const float delta=attention_*(gains_[0]*body+gains_[1]*focus); + return {left+delta,right+delta}; + } + // Small complementary widening of REAL directional first images, not + // fake Haas/crossfeed. Mid stays algebraically identical. This moves + // stereo accompaniment/reverb around the forward center without + // collapsing width or duplicating a second room/IR processor. + Stereo early(float left,float right) noexcept { + if(!active_ || gains_[2]==0.f)return {left,right}; + const float side=.5f*(left-right); + const float width=firstHigh_.run(widthHigh_,side)- + firstLow_.run(widthLow_,side); + const float delta=gains_[2]*width; + return {left+delta,right-delta}; + } + // Center midrange in existing LATE field is gently relieved when the + // direct source is confident/centered. Lateral late ambience and bass + // remain unchanged: direct center appears closer while the already- + // rendered instruments retain their wider acoustic layer. + Stereo late(float left,float right) noexcept { + if(!active_ || gains_[3]==0.f)return {left,right}; + const float mid=.5f*(left+right); + const float band=tailHigh_.run(lateHigh_,mid)- + tailLow_.run(lateLow_,mid); + const float delta=gains_[3]*attention_*band; + return {left-delta,right-delta}; + } +private: + struct LP { + float v=0.f; + float run(float coeff,float x) noexcept { + v+=coeff*(x-v); + return v; + } + }; + // body(210-880), focus(760-3350), directional early-side(680-3900), + // center-late relief(720-3400); these are MAX linear mixing weights, + // not claimed vocal-estimation confidence or EQ dB targets. + static constexpr std::array,4> profiles_{{ + {{0.f,0.f,0.f,0.f}}, // Venue remains exact P9.8 + {{.095f,.165f,.080f,.095f}}, // Signature: full and front-focused + {{.040f,.062f,.030f,.038f}}, // Studio: gentle, intimate + {{.070f,.115f,.065f,.070f}} // Cinema: full-body clear dialog + }}; + LP midBodyLow_{},midBodyHigh_{},midFocusLow_{},midFocusHigh_{}; + LP sideFocusLow_{},sideFocusHigh_{}; + LP firstLow_{},firstHigh_{},tailLow_{},tailHigh_{}; + float bodyLow_=0.f,bodyHigh_=0.f,focusLow_=0.f,focusHigh_=0.f; + float widthLow_=0.f,widthHigh_=0.f,lateLow_=0.f,lateHigh_=0.f; + float attack_=0.f,release_=0.f,attentionAttack_=0.f; + float attentionRelease_=0.f,gainSlew_=0.f; + float centerEnvelope_=0.f,sideEnvelope_=0.f,attention_=0.f; + std::array gains_{}; + bool active_=false; +}; +} // namespace armix::sonku::p99 diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 808cb1b9a..fd2e81560 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -34,6 +34,12 @@ #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH #include "SonKuP98SceneVoicing.h" #endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH +#if !defined(SONKU_P98_SCENE_VOICING_RESEARCH) || !SONKU_P98_SCENE_VOICING_RESEARCH +#error "P9.9 requires the P9.8 typed scene engine" +#endif +#include "SonKuP99MusicalVocalDepth.h" +#endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH #include "SonKuP94FrontBackDepthCue.h" #endif @@ -241,6 +247,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH if(!p98Voicing_.prepare(rate))return false; #endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + if(!p99VocalDepth_.prepare(rate))return false; +#endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH if(!p95Presence_.prepare(rate))return false; #endif @@ -324,6 +333,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH p98Voicing_.reset(); #endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + p99VocalDepth_.reset(); +#endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95Presence_.reset(); #endif @@ -390,6 +402,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH p98Voicing_.reset(); #endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + p99VocalDepth_.reset(); +#endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95Presence_.reset(); #endif @@ -825,6 +840,21 @@ class SonKuSpatialCore final { // injecting headphone-dry voice or mutating the original PCM. (void)p98Voicing_.source(0.f,0.f,0,false); } +#endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + if(p90World && settings_.spatialMix>0.f){ + // Source-depth control happens BEFORE measured two-speaker + // KEMAR FIR. No center headphone-dry path or second bus. + const auto focus=p99VocalDepth_.source( + history_[0][write_],history_[1][write_], + settings_.sceneVoicing,roomEnabled); + history_[0][write_]=focus.left; + history_[1][write_]=focus.right; + }else{ + // MIX=0 and mode bypass stay exact; reset attention smoothly + // without ever leaking a private cue into dry input PCM. + (void)p99VocalDepth_.source(0.f,0.f,0,false); + } #endif float ears[2]{0.f,0.f}; for(int tap=0;tap0.f && roomEnabled){ + // A slightly more lateral REAL first image gives + // accompaniment space without moving the singer. + const auto lateral=p99VocalDepth_.early( + reflection.left,reflection.right); + reflection.left=lateral.left; + reflection.right=lateral.right; + // Reduce only center-mid late energy, preserving stereo + // diffuse sides and full low-frequency reverberation. + const auto background=p99VocalDepth_.late(late.left,late.right); + late.left=background.left; + late.right=background.right; + } #endif float spatialL=directL+ smoothedErPresence_*calibratedEarly*reflection.left+ @@ -1433,6 +1478,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH p98::SceneVoicing p98Voicing_{}; #endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + p99::MusicalVocalDepth p99VocalDepth_{}; +#endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95::MusicalPresence p95Presence_{}; #endif diff --git a/scripts/verify_sonku_p99_vocal_depth.py b/scripts/verify_sonku_p99_vocal_depth.py new file mode 100644 index 000000000..61b3cf563 --- /dev/null +++ b/scripts/verify_sonku_p99_vocal_depth.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 +"""P9.9 stage proof against actual P9.8 native PCM, not invented stem labels. + +Both CSVs come from the SAME complete SonKu KEMAR+room+P95-P98 graph with +the same factory parameters at 44.1/48 kHz and front/rear; only P99 macro +differs. Venue, ROOM OFF and MIX=0 must be bit-for-bit preserved. +""" +from pathlib import Path +import sys + + +def load(path): + rows = {} + for line in Path(path).read_text().splitlines(): + if not line.startswith("P98_SCENE,"): + continue + fields = line.split(",") + assert len(fields) == 10, line + key = (int(fields[1]), int(fields[2]), int(fields[3]), fields[4]) + assert key not in rows, key + rows[key] = (tuple(map(float, fields[5:9])), fields[9]) + assert len(rows) == 24, (path, len(rows)) + return rows + + +def main(): + assert len(sys.argv) == 3 + reference = load(sys.argv[1]) + candidate = load(sys.argv[2]) + assert reference.keys() == candidate.keys() + seen = [] + for key in sorted(reference): + old, old_hash = reference[key] + new, new_hash = candidate[key] + rate, azimuth, index, scene = key + ratios = tuple(new[i] / old[i] for i in range(3)) + assert all(.89 < r < 1.27 for r in ratios), (key, ratios) + if index in (0, 4, 5): + assert new_hash == old_hash, f"P99_APPROVED_VENUE_PCM_CHANGED:{key}" + print("P99_VENUE_ROOMOFF_MIX0_BIT_EXACT", key) + continue + # Music warmth 86Hz must not be deleted to make vocals seem louder. + assert .96 < ratios[0] < 1.09, (key, ratios) + # 2.05k center articulation should rise without a harsh upper shelf. + assert 1.005 < ratios[1] < 1.17, (key, ratios) + assert .96 < ratios[2] < 1.07, (key, ratios) + assert new[3] <= .9805, (key, "overshoot") + seen.append((index, ratios[1])) + print("P99_COMPLETE_SPATIAL_GRAPH", key, *[round(x, 5) for x in ratios]) + assert len(seen) == 12 + print("P99_LOCKED_VENUE_AND_MUSICAL_VOCAL_DEPTH_FULL_PCM_PASSED") + + +if __name__ == "__main__": + main() diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 0869c5ccb..1335fc7b3 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -236,7 +236,7 @@ const depthLayers={far:$("skFarSources"),near:$("skNearSources")}; const mount=()=>{if(!root.isConnected)document.body.append(root)}; if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",mount,{once:true});else mount(); let current=null,accepted=defaults(),draft=defaults(),pending=null,latest=null, - xyzCapable=false,p83Capable=false,p84Capable=false,p85Capable=false,p86Capable=false,p87Capable=false,p88Capable=false,p89Capable=false,p90Capable=false,p91p92Capable=false,p94Capable=false,p95Capable=false,p96Capable=false,p97Capable=false,p98Capable=false,musicSafeStereo=false,p8TransparentBass=false,p82MultibandRoom=false, + xyzCapable=false,p83Capable=false,p84Capable=false,p85Capable=false,p86Capable=false,p87Capable=false,p88Capable=false,p89Capable=false,p90Capable=false,p91p92Capable=false,p94Capable=false,p95Capable=false,p96Capable=false,p97Capable=false,p98Capable=false,p99Capable=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; @@ -438,7 +438,10 @@ function render(){ if(!rangeEdits.has("skHrtfAlign"))align.value=String(s.hrtfElevationTrimDegrees); $("skHrtfAlignValue").textContent=(s.hrtfElevationTrimDegrees>=0?"+":"")+s.hrtfElevationTrimDegrees.toFixed(1)+"°"; } - root.querySelector(".sk-stage-caption").textContent=p98Capable&&s.renderMode===9? + root.querySelector(".sk-stage-caption").textContent= + p99Capable&&s.renderMode===9&&s.sceneVoicing>0? + "VOCAL BODY + CENTER CLARITY · WIDE INSTRUMENT LAYERS · VENUE LOCKED": + p98Capable&&s.renderMode===9? "SIGNATURE / CINEMA / STUDIO VOICING · VENUE P9.7 PRESERVED": p97Capable&&s.renderMode===9? "IMMERSIVE STAGE · BASS IMPACT · CENTER PRESENCE · EARLY AIR": @@ -495,7 +498,9 @@ function render(){ // redrawn at 60 Hz. The native audio callback remains the time authority. drawSpeakers(); $("skMode").textContent=native()?(context()? - (p98Capable&&s.renderMode===9?"NATIVE IMMERSIVE · SCENE VOICING · VENUE LOCKED": + (p99Capable&&s.renderMode===9&&s.sceneVoicing>0? + "NATIVE IMMERSIVE · MUSICAL VOCAL DEPTH · REAL STAGE": + p98Capable&&s.renderMode===9?"NATIVE IMMERSIVE · SCENE VOICING · VENUE LOCKED": p97Capable&&s.renderMode===9?"NATIVE IMMERSIVE · STAGE IMPACT + EXTERNAL AIR": p96Capable&&s.renderMode===9?"NATIVE IMMERSIVE · STAGE BASS + AIR": p95Capable&&s.renderMode===9?"NATIVE IMMERSIVE · MUSIC PRESENCE · WORLD BASS": @@ -678,6 +683,8 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ p98Capable=p97Capable && r.schemaVersion===12 && r.p98SceneVoicing===true && Number.isInteger(incoming.sceneVoicing) && incoming.sceneVoicing>=0 && incoming.sceneVoicing<=3; + // Schema v12 remains unchanged. Truthfully require the native DSP flag. + p99Capable=p98Capable && r.p99MusicalVocalDepth===true; p89Capable=(r.schemaVersion===10||p90Capable) && r.p89StereoRoomDepth===true && Number.isFinite(incoming.hrtfElevationTrimDegrees); p88Capable=(r.schemaVersion===9||p89Capable) && r.p88PerceptualAlignment===true && @@ -786,7 +793,7 @@ $("skPreset").addEventListener("change",()=>{ if(!p98Capable)delete scene.sceneVoicing; if(!send(scene))render(); }); -$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;p87Capable=false;p88Capable=false;p89Capable=false;p90Capable=false;p91p92Capable=false;p94Capable=false;p95Capable=false;p96Capable=false;p97Capable=false;p98Capable=false;musicSafeStereo=false;p8TransparentBass=false;p82MultibandRoom=false; +$("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapable=false;p85Capable=false;p86Capable=false;p87Capable=false;p88Capable=false;p89Capable=false;p90Capable=false;p91p92Capable=false;p94Capable=false;p95Capable=false;p96Capable=false;p97Capable=false;p98Capable=false;p99Capable=false;musicSafeStereo=false;p8TransparentBass=false;p82MultibandRoom=false; cancelLiveTimer();pending=null;latest=null;readId="";readSentAt=0;dialDrag=null; drag=null;windowGesture=null;rangeEdits.clear();gestureStart.clear();lastLiveAt=0; if(clock!==null){clearInterval(clock);clock=null;} @@ -985,7 +992,7 @@ const api={ drag=null;rangeEdits.clear();gestureStart.clear(); accepted=defaults();draft=defaults();xyzCapable=false; p83Capable=p84Capable=p85Capable=p86Capable=p87Capable=p88Capable= - p89Capable=p90Capable=p91p92Capable=p94Capable=p95Capable=p96Capable=p97Capable=p98Capable=false; + p89Capable=p90Capable=p91p92Capable=p94Capable=p95Capable=p96Capable=p97Capable=p98Capable=p99Capable=false; musicSafeStereo=p8TransparentBass=p82MultibandRoom=false; current={track,slot,instanceId:null}; const s=snapshot(),id=window.__ARMIX_NATIVE_M2__?.nativeIdFor?.(track); diff --git a/src/Main.cpp b/src/Main.cpp index 8aafc8cd0..f3b51774d 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3138,6 +3138,11 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr #if defined(ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING) && ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING reply->setProperty("p98SceneVoicing",true); #endif +#if defined(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH) && ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH + // Truthful native opt-in: P9.8 hosts must never claim P9.9. + // No new JSON scene ID or state bytes; v12 reads back normally. + reply->setProperty("p99MusicalVocalDepth",true); +#endif #if defined(ARMIX_SONKU_EXPERIMENTAL_P94_FRONT_BACK_DEPTH) && ARMIX_SONKU_EXPERIMENTAL_P94_FRONT_BACK_DEPTH // Branch-only measured-engine A/B. A previous v11 binary cannot // advertise this front/rear perceptual depth research capability. diff --git a/tests/sonku_p99_gui_contract_test.cjs b/tests/sonku_p99_gui_contract_test.cjs new file mode 100644 index 000000000..121624bca --- /dev/null +++ b/tests/sonku_p99_gui_contract_test.cjs @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: AGPL-3.0-only +"use strict"; +const fs=require("node:fs"),assert=require("node:assert/strict"); +const ui=fs.readFileSync("site/preview-v2/assets/mixer-native-sonku.js","utf8"); +const app=fs.readFileSync("src/Main.cpp","utf8"); +const cmake=fs.readFileSync("CMakeLists.txt","utf8"); +const core=fs.readFileSync("engine/builtin_fx/sonku/SonKuSpatialCore.h","utf8"); +const source=fs.readFileSync("engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h","utf8"); +assert.match(cmake,/option\(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH[\s\S]*?OFF\)/); +assert.match(cmake,/P9\.9 requires P9\.8 native typed scene voicings/); +assert.match(app,/reply->setProperty\("p99MusicalVocalDepth",true\)/); +assert.match(ui,/p99Capable=p98Capable && r\.p99MusicalVocalDepth===true/); +assert.match(ui,/p99Capable&&s\.renderMode===9&&s\.sceneVoicing>0/); +assert.match(ui,/VOCAL BODY \+ CENTER CLARITY/); +assert.match(core,/p99VocalDepth_\.source\(/); +assert.match(core,/p99VocalDepth_\.early\(/); +assert.match(core,/p99VocalDepth_\.late\(/); +assert.match(source,/return \{left,right\}; \/\/ NO altered float arithmetic/); +assert.match(source,/No upper-air shelf, de-esser or narrow 4-8k peak/); +assert.match(ui,/spacePreset:3,sourceDistanceMeters:10,roomAmount:1,ambience:1,sceneVoicing:0/); +// v12 unchanged; this is an algorithm improvement to existing named scenes. +assert.doesNotMatch(cmake,/ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH[\s\S]{0,100}VERSION 13/); +console.log("P99_NATIVE_TRUTHFUL_V12_CAPABILITY_FACTORY_VENUE_LOCK_PASSED"); diff --git a/tests/sonku_p99_vocal_depth_source_test.cpp b/tests/sonku_p99_vocal_depth_source_test.cpp new file mode 100644 index 000000000..f1653e097 --- /dev/null +++ b/tests/sonku_p99_vocal_depth_source_test.cpp @@ -0,0 +1,93 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#if defined(NDEBUG) +#undef NDEBUG +#endif +#include "../engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h" +#include +#include +#include +using armix::sonku::p99::MusicalVocalDepth; + +static double rmsRatio(int rate,int scene,int stage,double hz,bool phaseReversed=false, + float level=.07f) { + MusicalVocalDepth e; + assert(e.prepare(rate)); + constexpr double pi=3.1415926535897932384626433832795; + double before=0.,after=0.; + for(int i=0;irate/2){before+=double(x)*x;after+=double(out)*out;} + } + return std::sqrt(after/before); +} +int main(){ + MusicalVocalDepth unprepared; + assert(!unprepared.prepare(96000)); + for(int rate:{44100,48000}){ + for(int stage=0;stage<3;++stage) + for(double hz:{260.,1800.,7600.}) + assert(std::abs(rmsRatio(rate,0,stage,hz)-1.)<1.e-8); + + // Two musical frequency regions: warmth survives and articulation + // becomes more audible; a 7.6 kHz sibilance shelf is NEVER added. + const auto warmth=rmsRatio(rate,1,0,260.); + const auto vocal=rmsRatio(rate,1,0,1800.); + const auto airy=rmsRatio(rate,1,0,7600.); + const auto studio=rmsRatio(rate,2,0,1800.); + const auto cinema=rmsRatio(rate,3,0,1800.); + assert(warmth>1.006 && warmth<1.12); + assert(vocal>1.025 && vocal<1.25); + assert(airy>.98 && airy<1.045); + assert(vocal>cinema && cinema>studio && studio>1.007); + // No invented vocal image when all signal is stereo SIDE. + assert(std::abs(rmsRatio(rate,1,0,1800.,true)-1.)<1.e-7); + // Real first images become a little more lateral only where + // SIDE exists, without moving/summing the center image. + const auto earlySide=rmsRatio(rate,1,1,1800.,true); + const auto earlyCenter=rmsRatio(rate,1,1,1800.); + assert(earlySide>1.008 && earlySide<1.15); + assert(std::abs(earlyCenter-1.)<1.e-8); + // A modest midrange *late* reduction rather than cutting full + // stereo ambience; antiphase late is untouched. + const auto centerLate=rmsRatio(rate,1,2,1800.); + const auto sideLate=rmsRatio(rate,1,2,1800.,true); + assert(centerLate<.998 && centerLate>.86); + assert(std::abs(sideLate-1.)<1.e-8); + // Near-silent centered leakage cannot activate a loud voice gate. + assert(rmsRatio(rate,1,0,1800.,false,.00008f)<1.012); + // Switching to neutral MUST return exact samples from that call. + MusicalVocalDepth e; + assert(e.prepare(rate)); + for(int i=0;i Date: Mon, 16 Nov 2026 19:54:48 +0700 Subject: [PATCH 2/9] fix(sonku): reject 7.6k sibilance rise with 2-pole vocal and room bands --- .../sonku/SonKuP99MusicalVocalDepth.h | 40 +++++++++++++------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h index d066c0847..8464a0a09 100644 --- a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -40,8 +40,11 @@ class MusicalVocalDepth final { } void reset() noexcept { midBodyLow_={};midBodyHigh_={};midFocusLow_={};midFocusHigh_={}; - sideFocusLow_={};sideFocusHigh_={};firstLow_={};firstHigh_={}; - tailLow_={};tailHigh_={}; + midFocusLow2_={};midFocusHigh2_={}; + sideFocusLow_={};sideFocusHigh_={}; + sideFocusLow2_={};sideFocusHigh2_={}; + firstLow_={};firstHigh_={};firstLow2_={};firstHigh2_={}; + tailLow_={};tailHigh_={};tailLow2_={};tailHigh2_={}; centerEnvelope_=sideEnvelope_=attention_=0.f; gains_={}; active_=false; @@ -66,10 +69,17 @@ class MusicalVocalDepth final { const float side=.5f*(left-right); const float body=midBodyHigh_.run(bodyHigh_,mid)- midBodyLow_.run(bodyLow_,mid); - const float focus=midFocusHigh_.run(focusHigh_,mid)- - midFocusLow_.run(focusLow_,mid); - const float sideFocus=sideFocusHigh_.run(focusHigh_,side)- - sideFocusLow_.run(focusLow_,side); + // Cascaded matched one-poles form a soft 12dB/oct upper rolloff: + // a first-order band differential still raised 7.6kHz too much. + // Its *actual native test* rejected that high-sibilance excess. + const float focus=midFocusHigh2_.run( + focusHigh_,midFocusHigh_.run(focusHigh_,mid))- + midFocusLow2_.run( + focusLow_,midFocusLow_.run(focusLow_,mid)); + const float sideFocus=sideFocusHigh2_.run( + focusHigh_,sideFocusHigh_.run(focusHigh_,side))- + sideFocusLow2_.run( + focusLow_,sideFocusLow_.run(focusLow_,side)); const float c=std::abs(focus); const float s=std::abs(sideFocus); // Envelope matching is musical-phrase-scale, not a per-sample gate. @@ -98,8 +108,10 @@ class MusicalVocalDepth final { Stereo early(float left,float right) noexcept { if(!active_ || gains_[2]==0.f)return {left,right}; const float side=.5f*(left-right); - const float width=firstHigh_.run(widthHigh_,side)- - firstLow_.run(widthLow_,side); + const float width=firstHigh2_.run( + widthHigh_,firstHigh_.run(widthHigh_,side))- + firstLow2_.run( + widthLow_,firstLow_.run(widthLow_,side)); const float delta=gains_[2]*width; return {left+delta,right-delta}; } @@ -110,8 +122,10 @@ class MusicalVocalDepth final { Stereo late(float left,float right) noexcept { if(!active_ || gains_[3]==0.f)return {left,right}; const float mid=.5f*(left+right); - const float band=tailHigh_.run(lateHigh_,mid)- - tailLow_.run(lateLow_,mid); + const float band=tailHigh2_.run( + lateHigh_,tailHigh_.run(lateHigh_,mid))- + tailLow2_.run( + lateLow_,tailLow_.run(lateLow_,mid)); const float delta=gains_[3]*attention_*band; return {left-delta,right-delta}; } @@ -133,8 +147,10 @@ class MusicalVocalDepth final { {{.070f,.115f,.065f,.070f}} // Cinema: full-body clear dialog }}; LP midBodyLow_{},midBodyHigh_{},midFocusLow_{},midFocusHigh_{}; - LP sideFocusLow_{},sideFocusHigh_{}; - LP firstLow_{},firstHigh_{},tailLow_{},tailHigh_{}; + LP midFocusLow2_{},midFocusHigh2_{}; + LP sideFocusLow_{},sideFocusHigh_{},sideFocusLow2_{},sideFocusHigh2_{}; + LP firstLow_{},firstHigh_{},firstLow2_{},firstHigh2_{}; + LP tailLow_{},tailHigh_{},tailLow2_{},tailHigh2_{}; float bodyLow_=0.f,bodyHigh_=0.f,focusLow_=0.f,focusHigh_=0.f; float widthLow_=0.f,widthHigh_=0.f,lateLow_=0.f,lateHigh_=0.f; float attack_=0.f,release_=0.f,attentionAttack_=0.f; From 16508820c4d50b398a8941c6bb14d22142910cc9 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 21:15:39 +0700 Subject: [PATCH 3/9] fix(sonku): couple vocal low-mid body to real six-wall room and late decay without dry center --- .github/workflows/p1-windows.yml | 8 +++ ...KU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md | 16 +++++- .../sonku/SonKuP99MusicalVocalDepth.h | 51 ++++++++++++++--- engine/builtin_fx/sonku/SonKuSpatialCore.h | 25 +++++++-- scripts/verify_sonku_p99_room_body.py | 56 +++++++++++++++++++ site/preview-v2/assets/mixer-native-sonku.js | 2 +- tests/sonku_p98_integrated_scene_test.cpp | 12 +++- tests/sonku_p99_gui_contract_test.cjs | 8 +++ tests/sonku_p99_vocal_depth_source_test.cpp | 56 ++++++++++++++++++- 9 files changed, 213 insertions(+), 21 deletions(-) create mode 100644 scripts/verify_sonku_p99_room_body.py diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 60f8d8af2..2300e7776 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -730,6 +730,14 @@ jobs: g++ $PRESET_FLAGS -DSONKU_P98_SCENE_VOICING_RESEARCH=1 -DSONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1 tests/sonku_p98_integrated_scene_test.cpp -o /tmp/sonku-p99-integrated /tmp/sonku-p99-integrated > /tmp/sonku-p99-integrated.csv python3 scripts/verify_sonku_p99_vocal_depth.py /tmp/sonku-p98-scene-candidate.csv /tmp/sonku-p99-integrated.csv + # Additional full-graph 320 Hz ROOM BODY probe; preserve + # the old 86 Hz and all approved P9.8 / Venue fixtures. + BODY_FLAGS="$PRESET_FLAGS -DSONKU_P98_SCENE_VOICING_RESEARCH=1 -DSONKU_P99_ROOM_BODY_PROBE=1" + g++ $BODY_FLAGS tests/sonku_p98_integrated_scene_test.cpp -o /tmp/sonku-p99-body-reference + /tmp/sonku-p99-body-reference > /tmp/sonku-p99-body-reference.csv + g++ $BODY_FLAGS -DSONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1 tests/sonku_p98_integrated_scene_test.cpp -o /tmp/sonku-p99-body-candidate + /tmp/sonku-p99-body-candidate > /tmp/sonku-p99-body-candidate.csv + python3 scripts/verify_sonku_p99_room_body.py /tmp/sonku-p99-body-reference.csv /tmp/sonku-p99-body-candidate.csv fi fi fi diff --git a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md index 37b15d969..86e98060d 100644 --- a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md +++ b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md @@ -22,14 +22,15 @@ Full stereo recordings do not provide separated singer and backing stems. A cent 1. **Direct center articulation, full-bodied**: source before the existing measured loudspeaker KEMAR FIR. Two broad first-order complementary bands (210–880Hz body, 760–3350Hz articulation), at bounded profile weights. The gate follows a smoothed ratio of in-band MID to SIDE and a minimum audible level; its 21ms/122ms envelope + 32ms/187ms gain attention avoid per-syllable switches. A 55ms scene change ramp prevents step clicks. Sig > Cinema > Studio intensity. 2. **Lateral instrument atmosphere without fake Haas**: only the *already physically modeled first-image stereo reflection* receives a tiny complementary 680–3900Hz SIDE emphasis (maximum 0.08 linear); the MID and source phase are unchanged. No added random delay, decorrelation, stereo phase rotation, width collapse or rear center duplication. -3. **Vocal vs backdrop depth**: when center dominance is strong, slightly relieve the 720–3400Hz MID of the *existing late room return* (maximum 0.095 linear), never its SIDE or bass. Gives the real direct center more contrast to the diffuse surroundings. The floor/ceiling/side reflection network and room tails otherwise remain authoritative. +3. **Physically coupled room body (P9.9 room correction)**: the original approach enhanced direct history_ while the real `room_.process` and `reverb_.process` received original x0/x1. That inconsistency made the enriched singer sound *too dry/less physically present*. Feed an activity-gated **165–670 Hz coherent MID band** into the pre-existing true directional first-images and diffuse reverb, using separate Signature ER 0.68 / late 0.28, Cinema 0.47 / 0.19, Studio 0.27 / 0.11 scalar send weights. No extra delay/feedback/second room/binaural crossfeed. The room remains frequency-dependent through its own native physical geometry and acoustics. This is a musically bounded warm band, NOT a claimed isolated vocal stem or a synthetic high-Q resonant mode. The existing L/R SIDE is unchanged. +4. **Vocal vs backdrop depth**: preserve the 200–650 Hz vocal room body; slightly relieve only 1350–3800Hz MID of the *existing late room return* (maximum 0.095 linear), never its SIDE or bass. This retains articulatory definition while low-mid reflections/tail supply room presence. The floor/ceiling/side reflection network and room tails otherwise remain authoritative. 4. **No 4–8k treble/sibilance shelf**; no high-pass stripping at 250Hz, hard expander, multiband limiter, or vocal-only fake stem. Preserve bass impact and 0.98 linked peak guard, and reject non-finite PCM in existing core. -5. **No significant CPU overhead**: fixed scalar one-pole states, constant 4 profile vectors, no heap allocation/block buffer/FFT/convolution beyond the existing P90 path, no extra sample latency. Exact CPU saving is not proven by source tests; real Windows performance/ASIO headphone audition remains operator FAT. +6. **Bounded real-time overhead**: fixed scalar one-pole states, six-coefficient scene profiles, no heap allocation/block buffer/FFT/convolution beyond the existing P90 path, no additional samples of latency. Filtering into the existing room adds four simple scalar warm-band filter states and feed mixing. Actual CPU margin and ASIO headphone audition remain operator FAT. ## Validation matrix and acceptance limits - Standalone **44.1/48k**: male-range 260Hz body must not thin; 1800Hz increases vocal-band center audibility; 7600Hz bounded (not harsh); real early-IMAGE side expands slightly; late center band reduces; late SIDE and anti-phase direct remain unchanged; near silence avoids pump; on-the-fly Venue and ROOM OFF exact. -- Full wet actual KEMAR+room+P95-P98 graph: P9.8 vs P9.9 **24 cases** (44.1/48k × front/rear × Venue/Signature/Studio/Cinema/ROOM OFF/MIX0), exact hashes for Venue/ROOM OFF/MIX0; no original bass deletion or 7500Hz excessive boost; low max linked peak guard. +- Full wet actual KEMAR+room+P95-P98 graph: P9.8 vs P9.9 **24 cases** at 86/2050/7500 Hz and a separate **24-case, complete six-wall room 320/2050/7500 Hz probe** (44.1/48k × front/rear × Venue/Signature/Studio/Cinema/ROOM OFF/MIX0). Demand warm 320Hz response in scene1/2/3, not merely new dry EQ; exact hashes for Venue/ROOM OFF/MIX0 in both sets; no original bass deletion or 7500Hz excessive boost; linked peak guard. - Native JUCE v12 ACK and old v11 migration regressions; compile/test on Windows x64 and Chromium front-end capability contract; package full GUI portable executable with SHA provenance and this FAT guide. No automatic merge/release without native Windows CI and a level-matched listener test. ## Honest remaining limitations and hearing FAT @@ -37,3 +38,12 @@ Full stereo recordings do not provide separated singer and backing stems. A cent Mid/side gating can enhance a centered guitar/snare/piano, not only a singer. No algorithm can distinguish overlapping mono-center sources with certainty without separate stems or model-based extraction. The confidence detector **must remain conservative** and can occasionally act on instrument-only centered content. Use level-matched male/female vocal recordings, dense rock drums/guitars, piano/voice, sibilant vocal, cymbal-heavy instrumental, mono full mix, deliberate 180° anti-phase, and front/rear stage motion. Listen for chest body, articulatory consonants, non-nasal tone, no new sharp 3–8k peak, no center ghost, no pumping, no collapsed room or bass. Quantitative PCM/spectral tests do not prove the intended **subjective** intimacy or audience goosebumps. In all doubt restore the P9.8 reference; the Venue P9.7 checkpoint is non-negotiable. + + +## Correction rationale — direct sound and acoustic-body consistency + +The operator correctly identified that P9.9 initially strengthened the CENTER of the direct KEMAR virtual speaker input while both ROOM processors still observed the unchanged stereo master. Furthermore, a 720–3400 Hz late-mid reduction made the vocal seem even more dry/detached. It did **not** mean there was zero room sound; the issue was inconsistent excitation/voicing between direct and reflected paths. + +This revision deliberately sends a band-limited, activity-controlled, identical L/R low-mid contribution to the original room engines BEFORE their existing wall/late response. It does not reroute all P9.7/P9.8 tonal boost (which would over-excite snare, cymbals and LF). Only P9.9 scene IDs 1–3, room ON, wet MIX>0 get this feed. A source with no center signal, or a near-silent gate, returns exact original stereo. The user-approved Venue scene ID0 / ROOM OFF / MIX0 remain cold-start native PCM unchanged. + +See background on direct/reverberant balance and C50/C80 clarity: https://pmc.ncbi.nlm.nih.gov/articles/PMC6375510/ and https://aes.org/publications/elibrary/elibrary-page/?id=14920 . A little early reflection often increases fullness and can improve articulation; excessive late energy can mask words. This is NOT a proof of vocalist identification in a stereo mix, nor a promise of subjective superiority before listening. diff --git a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h index 8464a0a09..c7e165131 100644 --- a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -26,10 +26,15 @@ class MusicalVocalDepth final { bodyHigh_=alpha(880.); focusLow_=alpha(760.); focusHigh_=alpha(3350.); + // Broad low-mid energy only. Two cascaded low passes keep it out + // of sub/bass modes and upper consonant/cymbal transients. + roomWarmLow_=alpha(165.); + roomWarmHigh_=alpha(670.); widthLow_=alpha(680.); widthHigh_=alpha(3900.); - lateLow_=alpha(720.); - lateHigh_=alpha(3400.); + // Late-field relief must NOT eat vocal chest/body 200-650 Hz. + lateLow_=alpha(1350.); + lateHigh_=alpha(3800.); attack_=alpha(7.5); // ~21 ms envelope attack release_=alpha(1.3); // ~122 ms envelope release attentionAttack_=alpha(5.); // ~32 ms, no per-syllable pumping @@ -41,6 +46,8 @@ class MusicalVocalDepth final { void reset() noexcept { midBodyLow_={};midBodyHigh_={};midFocusLow_={};midFocusHigh_={}; midFocusLow2_={};midFocusHigh2_={}; + warmLow1_={};warmLow2_={};warmHigh1_={};warmHigh2_={}; + roomWarmSignal_=0.f; sideFocusLow_={};sideFocusHigh_={}; sideFocusLow2_={};sideFocusHigh2_={}; firstLow_={};firstHigh_={};firstLow2_={};firstHigh2_={}; @@ -62,6 +69,7 @@ class MusicalVocalDepth final { if(!active_) { attention_+=(attention_>0.f?attentionRelease_:attentionAttack_)* (0.f-attention_); + roomWarmSignal_=0.f; return {left,right}; // NO altered float arithmetic } @@ -96,11 +104,35 @@ class MusicalVocalDepth final { const float desired=dominance*audible; attention_+=(desired>attention_?attentionAttack_:attentionRelease_)* (desired-attention_); + // Feed the SAME already-prepared six-wall/late-room engines with + // a gentle 165-670Hz center-body component. Prior P9.9 enhanced + // the DIRECT virtual loudspeaker only, while room/reverb observed + // original x0/x1: this could make the boosted singer sound dry. + // No new reflections, resonator, feedback, extra output or delay. + const float warm=warmHigh2_.run(roomWarmHigh_, + warmHigh1_.run(roomWarmHigh_,mid))- + warmLow2_.run(roomWarmLow_, + warmLow1_.run(roomWarmLow_,mid)); + roomWarmSignal_=attention_*warm; // 210-880Hz body is explicitly reinforced, not cut. Most focus is // at 760-3350Hz. No upper-air shelf, de-esser or narrow 4-8k peak. const float delta=attention_*(gains_[0]*body+gains_[1]*focus); return {left+delta,right+delta}; } + // Inputs to the SAME acoustic room. Original L-R SIDE is preserved. + // Early has enough coherent low-mid energy to sound as if the vocal + // actually excites the room; a lower LATE feed provides its decay + // without over-reverberating syllables. No broadband tail boost. + Stereo roomEarlyFeed(float left,float right) const noexcept { + if(!active_ || gains_[4]==0.f)return {left,right}; + const float body=gains_[4]*roomWarmSignal_; + return {left+body,right+body}; + } + Stereo roomLateFeed(float left,float right) const noexcept { + if(!active_ || gains_[5]==0.f)return {left,right}; + const float body=gains_[5]*roomWarmSignal_; + return {left+body,right+body}; + } // Small complementary widening of REAL directional first images, not // fake Haas/crossfeed. Mid stays algebraically identical. This moves // stereo accompaniment/reverb around the forward center without @@ -138,20 +170,23 @@ class MusicalVocalDepth final { } }; // body(210-880), focus(760-3350), directional early-side(680-3900), - // center-late relief(720-3400); these are MAX linear mixing weights, + // center-late relief(1350-3800), and warm-band room sends(165-670). + // These are bounded linear mixing weights, // not claimed vocal-estimation confidence or EQ dB targets. - static constexpr std::array,4> profiles_{{ - {{0.f,0.f,0.f,0.f}}, // Venue remains exact P9.8 - {{.095f,.165f,.080f,.095f}}, // Signature: full and front-focused - {{.040f,.062f,.030f,.038f}}, // Studio: gentle, intimate - {{.070f,.115f,.065f,.070f}} // Cinema: full-body clear dialog + static constexpr std::array,4> profiles_{{ + {{0.f,0.f,0.f,0.f,0.f,0.f}}, // Venue EXACT + {{.095f,.165f,.080f,.095f,.68f,.28f}}, // Signature room-body + {{.040f,.062f,.030f,.038f,.27f,.11f}}, // Live Studio subtle + {{.070f,.115f,.065f,.070f,.47f,.19f}} // Cinema powerful, clear }}; LP midBodyLow_{},midBodyHigh_{},midFocusLow_{},midFocusHigh_{}; LP midFocusLow2_{},midFocusHigh2_{}; + LP warmLow1_{},warmLow2_{},warmHigh1_{},warmHigh2_{}; LP sideFocusLow_{},sideFocusHigh_{},sideFocusLow2_{},sideFocusHigh2_{}; LP firstLow_{},firstHigh_{},firstLow2_{},firstHigh2_{}; LP tailLow_{},tailHigh_{},tailLow2_{},tailHigh2_{}; float bodyLow_=0.f,bodyHigh_=0.f,focusLow_=0.f,focusHigh_=0.f; + float roomWarmLow_=0.f,roomWarmHigh_=0.f,roomWarmSignal_=0.f; float widthLow_=0.f,widthHigh_=0.f,lateLow_=0.f,lateHigh_=0.f; float attack_=0.f,release_=0.f,attentionAttack_=0.f; float attentionRelease_=0.f,gainSlew_=0.f; diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index fd2e81560..be89a6c06 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -905,10 +905,27 @@ class SonKuSpatialCore final { #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH if(positionedMode && !monoObject && p83MusicCompatibleLf_) p83LowFrequency_.process(x0,x1,ears[0],ears[1]); +#endif + // In P9.9, SOURCE center body used to reach only the direct + // KEMAR virtual speakers; room received original x0/x1. + // Route a bounded warm MID component into the EXISTING real + // six-wall and late reverberation processors as well, retaining + // the original stereo SIDE and respecting their geometry/delay. + float earlyFeedL=x0,earlyFeedR=x1; + float lateFeedL=x0,lateFeedR=x1; +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + if(p90World && settings_.spatialMix>0.f && roomEnabled){ + const auto earlyFeed=p99VocalDepth_.roomEarlyFeed(x0,x1); + const auto lateFeed=p99VocalDepth_.roomLateFeed(x0,x1); + earlyFeedL=earlyFeed.left; + earlyFeedR=earlyFeed.right; + lateFeedL=lateFeed.left; + lateFeedR=lateFeed.right; + } #endif auto reflection=room_.active() - ?room_.process((p90World||transparentBass)?x0:(musicSafe?inputMid:x0), - (p90World||transparentBass)?x1:(musicSafe?inputMid:x1), + ?room_.process((p90World||transparentBass)?earlyFeedL:(musicSafe?inputMid:x0), + (p90World||transparentBass)?earlyFeedR:(musicSafe?inputMid:x1), degrees_,(p90World||transparentBass)?settings_.stereoSpreadDegrees: ((musicSafe||monoObject)?0.f:settings_.stereoSpreadDegrees) #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH @@ -924,8 +941,8 @@ class SonKuSpatialCore final { ) :SonKuEarlyReflections::Ears{}; auto late=reverb_.active() - ?reverb_.process((p90World||transparentBass)?x0:(musicSafe?inputMid:x0), - (p90World||transparentBass)?x1:(musicSafe?inputMid:x1)) + ?reverb_.process((p90World||transparentBass)?lateFeedL:(musicSafe?inputMid:x0), + (p90World||transparentBass)?lateFeedR:(musicSafe?inputMid:x1)) :SonKuMusicalReverb::Ears{}; #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH if(musicalBody && roomEnabled){ diff --git a/scripts/verify_sonku_p99_room_body.py b/scripts/verify_sonku_p99_room_body.py new file mode 100644 index 000000000..f1accdd6b --- /dev/null +++ b/scripts/verify_sonku_p99_room_body.py @@ -0,0 +1,56 @@ +#!/usr/bin/env python3 +"""Proof of P9.9 coherent vocal upper-body exciting real ER + late room. + +The fixture uses the complete SonKu source->KEMAR->room->limiter graph with +320Hz chest, 2050Hz clarity and 7500Hz sibilance components. Compare P9.8 +with P9.9, not a bypass-only or stand-alone surrogate. Exactly preserve +Venue/ROOM OFF/MIX0; no false claim of extracted singer stems. +""" +from pathlib import Path +import sys + + +def load(path): + rows = {} + for line in Path(path).read_text().splitlines(): + if not line.startswith("P98_SCENE,"): + continue + p = line.split(",") + assert len(p) == 10, line + key = (int(p[1]), int(p[2]), int(p[3]), p[4]) + assert key not in rows + rows[key] = (tuple(map(float, p[5:9])), p[9]) + assert len(rows) == 24, (path, len(rows)) + return rows + + +def main(): + assert len(sys.argv) == 3 + base, candidate = load(sys.argv[1]), load(sys.argv[2]) + assert base.keys() == candidate.keys() + count = 0 + for key in sorted(base): + old, old_hash = base[key] + new, new_hash = candidate[key] + rate, az, index, scene = key + gains = tuple(new[k] / old[k] for k in range(3)) + assert new[3] <= .9805, ("linked guard", key, new[3]) + if index in (0, 4, 5): + assert old_hash == new_hash, ("Venue/off/bypass changed", key) + print("P99_ROOM_BODY_LOCKED_PCM", key) + continue + # Near 320Hz warm room-body must be an actual change to the + # COMPLETE spatial engine, not merely an altered unit-test meter. + # No LF loss to make vocals appear loud; no huge boom. + lower = {1: 1.055, 2: 1.008, 3: 1.035}[index] + assert lower < gains[0] < 1.29, ("room-body insufficient or boomy", key, gains) + assert 1.005 < gains[1] < 1.18, ("vocal articulation", key, gains) + assert .95 < gains[2] < 1.07, ("sibilant/cymbal", key, gains) + count += 1 + print("P99_TRUE_ROOM_COHERENT_BODY", key, *[round(g, 5) for g in gains]) + assert count == 12 + print("P99_ROOM_RESONANCE_320HZ_FULL_GRAPH_AND_VENUE_LOCK_PASSED") + + +if __name__ == "__main__": + main() diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 1335fc7b3..fb6694351 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -440,7 +440,7 @@ function render(){ } root.querySelector(".sk-stage-caption").textContent= p99Capable&&s.renderMode===9&&s.sceneVoicing>0? - "VOCAL BODY + CENTER CLARITY · WIDE INSTRUMENT LAYERS · VENUE LOCKED": + "VOCAL BODY + CENTER CLARITY · ROOM-COUPLED REFLECTIONS · VENUE LOCKED": p98Capable&&s.renderMode===9? "SIGNATURE / CINEMA / STUDIO VOICING · VENUE P9.7 PRESERVED": p97Capable&&s.renderMode===9? diff --git a/tests/sonku_p98_integrated_scene_test.cpp b/tests/sonku_p98_integrated_scene_test.cpp index 6dad427a7..e776b043d 100644 --- a/tests/sonku_p98_integrated_scene_test.cpp +++ b/tests/sonku_p98_integrated_scene_test.cpp @@ -41,10 +41,18 @@ void run(int rate,int az,int index){ assert(valid(s)&&core->setSettings(s)); const int n=rate; constexpr double pi=3.1415926535897932384626433832795; +#if defined(SONKU_P99_ROOM_BODY_PROBE) && SONKU_P99_ROOM_BODY_PROBE + // Dedicated FULL-ROOM source fixture: 320Hz upper chest/body excites + // six-wall first images and the EXISTING diffuse late network. Plain + // P9.8 golden source fixture remains the exact 86Hz reference. + constexpr int lowHz=320; +#else + constexpr int lowHz=86; +#endif std::vector l(n),r(n); for(int i=0;i(value); hash*=1099511628211ull; } - constexpr std::array hz{86,2050,7500}; + constexpr std::array hz{lowHz,2050,7500}; std::array amp{}; for(int k=0;k<3;++k){ double c=0,d=0; diff --git a/tests/sonku_p99_gui_contract_test.cjs b/tests/sonku_p99_gui_contract_test.cjs index 121624bca..dc2a189e2 100644 --- a/tests/sonku_p99_gui_contract_test.cjs +++ b/tests/sonku_p99_gui_contract_test.cjs @@ -15,6 +15,14 @@ assert.match(ui,/VOCAL BODY \+ CENTER CLARITY/); assert.match(core,/p99VocalDepth_\.source\(/); assert.match(core,/p99VocalDepth_\.early\(/); assert.match(core,/p99VocalDepth_\.late\(/); +assert.match(core,/p99VocalDepth_\.roomEarlyFeed\(x0,x1\)/); +assert.match(core,/p99VocalDepth_\.roomLateFeed\(x0,x1\)/); +assert.match(core,/room_\.process\(\(p90World\|\|transparentBass\)\?earlyFeedL/); +assert.match(core,/reverb_\.process\(\(p90World\|\|transparentBass\)\?lateFeedL/); +assert.match(source,/roomWarmSignal_=attention_\*warm/); +assert.match(source,/return \{left\+body,right\+body\}/); +assert.match(source,/lateLow_=alpha\(1350\.\)/); + assert.match(source,/return \{left,right\}; \/\/ NO altered float arithmetic/); assert.match(source,/No upper-air shelf, de-esser or narrow 4-8k peak/); assert.match(ui,/spacePreset:3,sourceDistanceMeters:10,roomAmount:1,ambience:1,sceneVoicing:0/); diff --git a/tests/sonku_p99_vocal_depth_source_test.cpp b/tests/sonku_p99_vocal_depth_source_test.cpp index f1653e097..0e46d85d3 100644 --- a/tests/sonku_p99_vocal_depth_source_test.cpp +++ b/tests/sonku_p99_vocal_depth_source_test.cpp @@ -28,6 +28,32 @@ static double rmsRatio(int rate,int scene,int stage,double hz,bool phaseReversed } return std::sqrt(after/before); } +// Actual DSP-to-EXISTING-room input, not arbitrary post-output EQ. The +// musical vocal-body band must excite the room at 320Hz without boosting +// cymbals/sibilants at 7.6k. Both room paths must retain original SIDE. +static double roomRatio(int rate,int scene,bool early,double hz, + bool antiphase=false,float level=.07f){ + MusicalVocalDepth e; + assert(e.prepare(rate)); + constexpr double pi=3.1415926535897932384626433832795; + double before=0.,after=0.; + for(int i=0;irate/2){before+=double(x)*x;after+=double(wet.left)*wet.left;} + } + return std::sqrt(after/before); +} int main(){ MusicalVocalDepth unprepared; assert(!unprepared.prepare(96000)); @@ -63,6 +89,22 @@ int main(){ assert(std::abs(sideLate-1.)<1.e-8); // Near-silent centered leakage cannot activate a loud voice gate. assert(rmsRatio(rate,1,0,1800.,false,.00008f)<1.012); + const auto earlyWarm=roomRatio(rate,1,true,320.); + const auto lateWarm=roomRatio(rate,1,false,320.); + const auto studioWarm=roomRatio(rate,2,true,320.); + const auto cinemaWarm=roomRatio(rate,3,true,320.); + // Audible ROOM warmth: early response stronger than late, Signature + // strongest, Cinema intermediate, Studio subtle. No excess HF. + assert(earlyWarm>1.15 && earlyWarm<1.60); + assert(lateWarm>1.04 && lateWarm<1.30); + assert(earlyWarm>cinemaWarm && cinemaWarm>studioWarm); + assert(studioWarm>1.035); + assert(roomRatio(rate,1,true,7600.)<1.035); + assert(roomRatio(rate,1,false,7600.)<1.025); + assert(std::abs(roomRatio(rate,1,true,320.,true)-1.)<1.e-7); + assert(std::abs(roomRatio(rate,1,false,320.,true)-1.)<1.e-7); + assert(std::abs(roomRatio(rate,1,true,320.,false,.00008f)-1.)<1.e-7); + assert(std::abs(roomRatio(rate,0,true,320.)-1.)<1.e-7); // Switching to neutral MUST return exact samples from that call. MusicalVocalDepth e; assert(e.prepare(rate)); @@ -76,17 +118,25 @@ int main(){ const auto neutral=e.source(.084f,-.027f,0,true); const auto unchangedEarly=e.early(.084f,-.027f); const auto unchangedLate=e.late(.084f,-.027f); - for(const auto result:{neutral,unchangedEarly,unchangedLate}){ + const auto neutralRoomEarly=e.roomEarlyFeed(.084f,-.027f); + const auto neutralRoomLate=e.roomLateFeed(.084f,-.027f); + for(const auto result:{neutral,unchangedEarly,unchangedLate, + neutralRoomEarly,neutralRoomLate}){ assert(result.left==.084f && result.right==-.027f); } const auto roomOff=e.source(.084f,-.027f,1,false); assert(roomOff.left==.084f && roomOff.right==-.027f); + for(const auto out:{e.roomEarlyFeed(.084f,-.027f), + e.roomLateFeed(.084f,-.027f)}) + assert(out.left==.084f && out.right==-.027f); std::printf( "P99_FOCUS,%d,warmth=%.6f,voice=%.6f,sibilance=%.6f," "studio=%.6f,cinema=%.6f,earlySide=%.6f," - "lateCenter=%.6f,lateSide=%.6f\n", + "lateCenter=%.6f,lateSide=%.6f," + "ER320=%.6f,TAIL320=%.6f,STUDIO_ER320=%.6f,CINEMA_ER320=%.6f\n", rate,warmth,vocal,airy,studio,cinema, - earlySide,centerLate,sideLate); + earlySide,centerLate,sideLate,earlyWarm,lateWarm, + studioWarm,cinemaWarm); } std::puts("PASS P9.9: musical vocal body, dynamic center focus, " "true directional early stereo and no high treble harshness"); From f1b990ce8c3265d229f075a0cd4d984a49fffed3 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 21:17:41 +0700 Subject: [PATCH 4/9] fix(sonku): size real-time P9.9 gain state for all six scene coefficients --- engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h index c7e165131..ecfb40293 100644 --- a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -191,7 +191,7 @@ class MusicalVocalDepth final { float attack_=0.f,release_=0.f,attentionAttack_=0.f; float attentionRelease_=0.f,gainSlew_=0.f; float centerEnvelope_=0.f,sideEnvelope_=0.f,attention_=0.f; - std::array gains_{}; + std::array gains_{}; bool active_=false; }; } // namespace armix::sonku::p99 From 692c0f570d4af9bdc03f3f0edeb0864b19267a35 Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 21:21:46 +0700 Subject: [PATCH 5/9] fix(sonku): reject 86Hz phase loss with centered dual-biquad room warmth --- ...KU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md | 13 +++-- .../sonku/SonKuP99MusicalVocalDepth.h | 52 +++++++++++++------ 2 files changed, 46 insertions(+), 19 deletions(-) diff --git a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md index 86e98060d..4eecd0051 100644 --- a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md +++ b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md @@ -22,10 +22,10 @@ Full stereo recordings do not provide separated singer and backing stems. A cent 1. **Direct center articulation, full-bodied**: source before the existing measured loudspeaker KEMAR FIR. Two broad first-order complementary bands (210–880Hz body, 760–3350Hz articulation), at bounded profile weights. The gate follows a smoothed ratio of in-band MID to SIDE and a minimum audible level; its 21ms/122ms envelope + 32ms/187ms gain attention avoid per-syllable switches. A 55ms scene change ramp prevents step clicks. Sig > Cinema > Studio intensity. 2. **Lateral instrument atmosphere without fake Haas**: only the *already physically modeled first-image stereo reflection* receives a tiny complementary 680–3900Hz SIDE emphasis (maximum 0.08 linear); the MID and source phase are unchanged. No added random delay, decorrelation, stereo phase rotation, width collapse or rear center duplication. -3. **Physically coupled room body (P9.9 room correction)**: the original approach enhanced direct history_ while the real `room_.process` and `reverb_.process` received original x0/x1. That inconsistency made the enriched singer sound *too dry/less physically present*. Feed an activity-gated **165–670 Hz coherent MID band** into the pre-existing true directional first-images and diffuse reverb, using separate Signature ER 0.68 / late 0.28, Cinema 0.47 / 0.19, Studio 0.27 / 0.11 scalar send weights. No extra delay/feedback/second room/binaural crossfeed. The room remains frequency-dependent through its own native physical geometry and acoustics. This is a musically bounded warm band, NOT a claimed isolated vocal stem or a synthetic high-Q resonant mode. The existing L/R SIDE is unchanged. +3. **Physically coupled room body (P9.9 room correction)**: the original approach enhanced direct history_ while the real `room_.process` and `reverb_.process` received original x0/x1. That inconsistency made the enriched singer sound *too dry/less physically present*. Feed an activity-gated **165–670 Hz coherent MID band** into the pre-existing true directional first-images and diffuse reverb, using separate Signature ER 0.48 / late 0.22, Cinema 0.34 / 0.15, Studio 0.22 / 0.095 scalar send weights. No extra delay/feedback/second room/binaural crossfeed. The room remains frequency-dependent through its own native physical geometry and acoustics. This is a musically bounded warm band, NOT a claimed isolated vocal stem or a synthetic high-Q resonant mode. The existing L/R SIDE is unchanged. 4. **Vocal vs backdrop depth**: preserve the 200–650 Hz vocal room body; slightly relieve only 1350–3800Hz MID of the *existing late room return* (maximum 0.095 linear), never its SIDE or bass. This retains articulatory definition while low-mid reflections/tail supply room presence. The floor/ceiling/side reflection network and room tails otherwise remain authoritative. 4. **No 4–8k treble/sibilance shelf**; no high-pass stripping at 250Hz, hard expander, multiband limiter, or vocal-only fake stem. Preserve bass impact and 0.98 linked peak guard, and reject non-finite PCM in existing core. -6. **Bounded real-time overhead**: fixed scalar one-pole states, six-coefficient scene profiles, no heap allocation/block buffer/FFT/convolution beyond the existing P90 path, no additional samples of latency. Filtering into the existing room adds four simple scalar warm-band filter states and feed mixing. Actual CPU margin and ASIO headphone audition remain operator FAT. +6. **Bounded real-time overhead**: fixed scalar one-pole states, six-coefficient scene profiles, no heap allocation/block buffer/FFT/convolution beyond the existing P90 path, no additional samples of latency. Filtering into the existing room adds two biquad warm-band filter states and feed mixing. Actual CPU margin and ASIO headphone audition remain operator FAT. ## Validation matrix and acceptance limits @@ -44,6 +44,13 @@ Use level-matched male/female vocal recordings, dense rock drums/guitars, piano/ The operator correctly identified that P9.9 initially strengthened the CENTER of the direct KEMAR virtual speaker input while both ROOM processors still observed the unchanged stereo master. Furthermore, a 720–3400 Hz late-mid reduction made the vocal seem even more dry/detached. It did **not** mean there was zero room sound; the issue was inconsistent excitation/voicing between direct and reflected paths. -This revision deliberately sends a band-limited, activity-controlled, identical L/R low-mid contribution to the original room engines BEFORE their existing wall/late response. It does not reroute all P9.7/P9.8 tonal boost (which would over-excite snare, cymbals and LF). Only P9.9 scene IDs 1–3, room ON, wet MIX>0 get this feed. A source with no center signal, or a near-silent gate, returns exact original stereo. The user-approved Venue scene ID0 / ROOM OFF / MIX0 remain cold-start native PCM unchanged. +This revision deliberately sends a two-biquad, activity-controlled, identical L/R low-mid contribution to the original room engines BEFORE their existing wall/late response. It does not reroute all P9.7/P9.8 tonal boost (which would over-excite snare, cymbals and LF). Only P9.9 scene IDs 1–3, room ON, wet MIX>0 get this feed. A source with no center signal, or a near-silent gate, returns exact original stereo. The user-approved Venue scene ID0 / ROOM OFF / MIX0 remain cold-start native PCM unchanged. See background on direct/reverberant balance and C50/C80 clarity: https://pmc.ncbi.nlm.nih.gov/articles/PMC6375510/ and https://aes.org/publications/elibrary/elibrary-page/?id=14920 . A little early reflection often increases fullness and can improve articulation; excessive late energy can mask words. This is NOT a proof of vocalist identification in a stereo mix, nor a promise of subjective superiority before listening. + + +## DSP gate rejected — first room feed LF cancellation + +The first warm-band attempt (difference of 165Hz and 670Hz second-order low-passes) made an apparent +47% direct ER320 input, but **failed full-graph P9.8/P9.9 86Hz regression at 0.929×**. This is an important counterexample: extra low-mid energy may cancel sub/bass because of filter phase and existing six-wall paths. The test was **not relaxed**. Replaced this imperfect difference response with a pair of stable, centered 330Hz Q1.4 biquads whose lower-octave magnitude rolls off strongly, and reduced sends so LF remains within the existing approved bound. The verification harness still rejects any decrease below 96% at 86Hz and any peak above the previously approved bounds. + +No claim that boosted ER input by itself proves a better final acoustic output. Always check complete KEMAR+room+limiter PCM and listener A/B. diff --git a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h index ecfb40293..b2142cacf 100644 --- a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -26,10 +26,11 @@ class MusicalVocalDepth final { bodyHigh_=alpha(880.); focusLow_=alpha(760.); focusHigh_=alpha(3350.); - // Broad low-mid energy only. Two cascaded low passes keep it out - // of sub/bass modes and upper consonant/cymbal transients. - roomWarmLow_=alpha(165.); - roomWarmHigh_=alpha(670.); + // Two centered low-mid biquads, not a subtraction of unmatched + // low-pass phases: the original first-order warm band decreased + // integrated 86 Hz by 7%. Biquads reject deep LF/cymbals strongly + // and return near-zero phase at 330 Hz where room-body is intended. + roomWarmCoeff_=bandpass(rate,330.,1.4); widthLow_=alpha(680.); widthHigh_=alpha(3900.); // Late-field relief must NOT eat vocal chest/body 200-650 Hz. @@ -46,7 +47,7 @@ class MusicalVocalDepth final { void reset() noexcept { midBodyLow_={};midBodyHigh_={};midFocusLow_={};midFocusHigh_={}; midFocusLow2_={};midFocusHigh2_={}; - warmLow1_={};warmLow2_={};warmHigh1_={};warmHigh2_={}; + roomWarm1_={};roomWarm2_={}; roomWarmSignal_=0.f; sideFocusLow_={};sideFocusHigh_={}; sideFocusLow2_={};sideFocusHigh2_={}; @@ -105,14 +106,12 @@ class MusicalVocalDepth final { attention_+=(desired>attention_?attentionAttack_:attentionRelease_)* (desired-attention_); // Feed the SAME already-prepared six-wall/late-room engines with - // a gentle 165-670Hz center-body component. Prior P9.9 enhanced + // a smooth, narrow-enough 330Hz center-body component. Prior P9.9 enhanced // the DIRECT virtual loudspeaker only, while room/reverb observed // original x0/x1: this could make the boosted singer sound dry. // No new reflections, resonator, feedback, extra output or delay. - const float warm=warmHigh2_.run(roomWarmHigh_, - warmHigh1_.run(roomWarmHigh_,mid))- - warmLow2_.run(roomWarmLow_, - warmLow1_.run(roomWarmLow_,mid)); + const float warm=roomWarm2_.run(roomWarmCoeff_, + roomWarm1_.run(roomWarmCoeff_,mid)); roomWarmSignal_=attention_*warm; // 210-880Hz body is explicitly reinforced, not cut. Most focus is // at 760-3350Hz. No upper-air shelf, de-esser or narrow 4-8k peak. @@ -169,24 +168,45 @@ class MusicalVocalDepth final { return v; } }; + struct Coeff {float b0=0.f,b1=0.f,b2=0.f,a1=0.f,a2=0.f;}; + struct Biquad { + float z1=0.f,z2=0.f; + float run(const Coeff& c,float x) noexcept { + const float y=c.b0*x+z1; + z1=c.b1*x-c.a1*y+z2; + z2=c.b2*x-c.a2*y; + return y; + } + }; + static Coeff bandpass(double rate,double hz,double q) noexcept { + constexpr double pi=3.1415926535897932384626433832795; + const double w=2.*pi*hz/rate; + const double alpha=std::sin(w)/(2.*q); + const double inv=1./(1.+alpha); + return {static_cast(alpha*inv),0.f, + static_cast(-alpha*inv), + static_cast(-2.*std::cos(w)*inv), + static_cast((1.-alpha)*inv)}; + } // body(210-880), focus(760-3350), directional early-side(680-3900), - // center-late relief(1350-3800), and warm-band room sends(165-670). + // center-late relief(1350-3800), and 330Hz Q1.4 room-body sends. // These are bounded linear mixing weights, // not claimed vocal-estimation confidence or EQ dB targets. static constexpr std::array,4> profiles_{{ {{0.f,0.f,0.f,0.f,0.f,0.f}}, // Venue EXACT - {{.095f,.165f,.080f,.095f,.68f,.28f}}, // Signature room-body - {{.040f,.062f,.030f,.038f,.27f,.11f}}, // Live Studio subtle - {{.070f,.115f,.065f,.070f,.47f,.19f}} // Cinema powerful, clear + {{.095f,.165f,.080f,.095f,.48f,.22f}}, // Signature room-body + {{.040f,.062f,.030f,.038f,.22f,.095f}}, // Live Studio subtle + {{.070f,.115f,.065f,.070f,.34f,.15f}} // Cinema powerful, clear }}; LP midBodyLow_{},midBodyHigh_{},midFocusLow_{},midFocusHigh_{}; LP midFocusLow2_{},midFocusHigh2_{}; - LP warmLow1_{},warmLow2_{},warmHigh1_{},warmHigh2_{}; + Coeff roomWarmCoeff_{}; + Biquad roomWarm1_{},roomWarm2_{}; LP sideFocusLow_{},sideFocusHigh_{},sideFocusLow2_{},sideFocusHigh2_{}; LP firstLow_{},firstHigh_{},firstLow2_{},firstHigh2_{}; LP tailLow_{},tailHigh_{},tailLow2_{},tailHigh2_{}; float bodyLow_=0.f,bodyHigh_=0.f,focusLow_=0.f,focusHigh_=0.f; - float roomWarmLow_=0.f,roomWarmHigh_=0.f,roomWarmSignal_=0.f; + float roomWarmSignal_=0.f; float widthLow_=0.f,widthHigh_=0.f,lateLow_=0.f,lateHigh_=0.f; float attack_=0.f,release_=0.f,attentionAttack_=0.f; float attentionRelease_=0.f,gainSlew_=0.f; From 353694e0313af4bf1b899d4794712c95bcbcc9ec Mon Sep 17 00:00:00 2001 From: Ari Sulistiono Date: Mon, 16 Nov 2026 21:55:46 +0700 Subject: [PATCH 6/9] feat(sonku): operator-approved 2.7m default Orbit and bolder musical room voicing, guard native preset ACK --- .github/workflows/p1-windows.yml | 6 +- CMakeLists.txt | 9 ++ ...KU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md | 13 +++ engine/builtin_fx/SonKuSpatialProcessor.h | 10 ++- .../sonku/SonKuP99DefaultOrbitStage.h | 53 +++++++++++ .../sonku/SonKuP99MusicalVocalDepth.h | 6 +- site/preview-v2/assets/mixer-native-sonku.js | 22 ++++- tests/sonku_p90_native_juce_v11_test.cpp | 42 +++++++++ tests/sonku_p98_gui_contract_test.cjs | 11 ++- tests/sonku_p99_default_orbit_source_test.cpp | 89 +++++++++++++++++++ tests/sonku_p99_gui_contract_test.cjs | 37 ++++++++ tests/sonku_p99_vocal_depth_source_test.cpp | 10 ++- 12 files changed, 292 insertions(+), 16 deletions(-) create mode 100644 engine/builtin_fx/sonku/SonKuP99DefaultOrbitStage.h create mode 100644 tests/sonku_p99_default_orbit_source_test.cpp diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 2300e7776..ab831cf7d 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -727,6 +727,8 @@ jobs: node tests/sonku_p99_gui_contract_test.cjs g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic tests/sonku_p99_vocal_depth_source_test.cpp -o /tmp/sonku-p99-unit /tmp/sonku-p99-unit + g++ $PRESET_FLAGS -DSONKU_P98_SCENE_VOICING_RESEARCH=1 -DSONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1 tests/sonku_p99_default_orbit_source_test.cpp -o /tmp/sonku-p99-default-orbit + /tmp/sonku-p99-default-orbit g++ $PRESET_FLAGS -DSONKU_P98_SCENE_VOICING_RESEARCH=1 -DSONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1 tests/sonku_p98_integrated_scene_test.cpp -o /tmp/sonku-p99-integrated /tmp/sonku-p99-integrated > /tmp/sonku-p99-integrated.csv python3 scripts/verify_sonku_p99_vocal_depth.py /tmp/sonku-p98-scene-candidate.csv /tmp/sonku-p99-integrated.csv @@ -815,7 +817,7 @@ jobs: if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $targets += 'ARMixSonKuP96DistanceTests' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $targets += 'ARMixSonKuP97StageTests' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $targets += 'ARMixSonKuP98VoicingTests' } - if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { $targets += 'ARMixSonKuP99VocalDepthTests' } + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { $targets += @('ARMixSonKuP99VocalDepthTests','ARMixSonKuP99DefaultOrbitTests') } cmake --build build --config Release --parallel 2 --target $targets if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } if (-not (Test-Path -LiteralPath 'build/ARMixConsole_artefacts/Release/AR MIX Studio.exe' -PathType Leaf)) { @@ -826,7 +828,7 @@ jobs: if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $tests += '|96DistanceBassAndTrebleRetention' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-p96-p97-*' -or $env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $tests += '|97BassVocalExternalAirSafety' } if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-*') { $tests += '|98SceneVoicingVenueLock' } - if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { $tests += '|99AdaptiveVocalDepthVenueLock' } + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p98-p99-*') { $tests += '|99AdaptiveVocalDepthVenueLock|99NewDefaultOrbitNative' } $tests += ')$' ctest --test-dir build -C Release --output-on-failure -R $tests if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } diff --git a/CMakeLists.txt b/CMakeLists.txt index 14a799d3c..bcded28a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -936,6 +936,15 @@ if(BUILD_TESTING) target_compile_features(ARMixSonKuP99VocalDepthTests PRIVATE cxx_std_20) add_test(NAME NativeSonKuP99AdaptiveVocalDepthVenueLock COMMAND ARMixSonKuP99VocalDepthTests) + add_executable(ARMixSonKuP99DefaultOrbitTests + tests/sonku_p99_default_orbit_source_test.cpp) + target_compile_features(ARMixSonKuP99DefaultOrbitTests PRIVATE cxx_std_20) + # Exactly the same nested P9 physical/native core + # flags as its P95/P96/P97/P98/P99 integrated build. + target_compile_definitions(ARMixSonKuP99DefaultOrbitTests PRIVATE + $) + add_test(NAME NativeSonKuP99NewDefaultOrbitNative + COMMAND ARMixSonKuP99DefaultOrbitTests) endif() juce_add_console_app(ARMixSonKuP90NativeTests PRODUCT_NAME "ArSonMix SonKu P90 JUCE v11 State Tests") diff --git a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md index 4eecd0051..2f62bd421 100644 --- a/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md +++ b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md @@ -54,3 +54,16 @@ See background on direct/reverberant balance and C50/C80 clarity: https://pmc.nc The first warm-band attempt (difference of 165Hz and 670Hz second-order low-passes) made an apparent +47% direct ER320 input, but **failed full-graph P9.8/P9.9 86Hz regression at 0.929×**. This is an important counterexample: extra low-mid energy may cancel sub/bass because of filter phase and existing six-wall paths. The test was **not relaxed**. Replaced this imperfect difference response with a pair of stable, centered 330Hz Q1.4 biquads whose lower-octave magnitude rolls off strongly, and reduced sends so LF remains within the existing approved bound. The verification harness still rejects any decrease below 96% at 86Hz and any peak above the previously approved bounds. No claim that boosted ER input by itself proves a better final acoustic output. Always check complete KEMAR+room+limiter PCM and listener A/B. + + +## 2026-11-16 operator screenshot → P9.9 Default Orbit Stage + +The operator provided a screenshot of **CUSTOM · MANUAL** with ORBIT (not STATIC), CLOCKWISE, 12.0 s revolution, 127° speaker angle, 100% spatial mix, +5.1 dB display gain, Large 28.8×28.8m, 2.7m source distance, elevation 0°, HRTF ear-height align 0°, HEAD YAW 0°, Reflections 100%, Reverb 77%. Input provided a visual speaker placement mid-orbit; this does NOT reveal a persisted initial azimuth. Start azimuth is explicitly set to **FRONT 0°** for a deterministic new orbit, and gain **1.8 linear** renders approximately +5.1dB as in the screenshot. The screenshot does not expose the native `sceneVoicing` byte: choose **typed Signature ID1** instead of neutral ID0, otherwise the P9.9 center-body/room coupling would never activate. + +- New `ORBIT STAGE · DEFAULT` (GUI id `orbitStage`) is an **additional opt-in P9.9 preset**, not a rewrite of existing `music`, `studio`, `wide`, `deep` (approved Venue), or `orbit`. +- The authoritative C++ `DefaultOrbitStage::settings()` is installed by `SonKuSpatialProcessor` only for brand-new opt-in P9.9 inserts. Native v12 state and ACK are unchanged; saved `.smix` / v11-v12 restore and operator Custom states are never silently changed. UI label matches the native readback and is unavailable to P9.8-only binaries. +- Previously, `sameSettings()` ignored `sceneVoicing` (and HRTF elevation trim): a pure scene-ID change could be silently treated as a no-op. Now both typed parameters participate in native command deduplication. This is required for presets to change the **real DSP**, not merely their visible names. +- This **user-guided stronger Signature** steps the limited P9.9 weights from `{.095,.165,.080,.095,.48,.22}` to `{.112,.200,.105,.108,.55,.25}` (body, focus, directional early, late-mid relief, 330Hz early-room feed, late-room feed). These are bounded *mixing coefficients*, not extra dB, no independent stem extractor. Live Studio and Cinema are unchanged. Venue/neutral remains exactly zero-weight. +- Acceptance: independently test exact new factory numbers, native JUCE NEW insert save/reopen, no default migration for old sessions, 1s native orbit = +30° at 44.1/48k, scene-only queued edits actually transmit, safe peaks, early 330Hz body, 1.8k articulation, 7.6k sibilance cap; full original P9.8/P9.9 static 24-case Venue PCM bit-exact tests must still pass. Real level-matched headphone listening remains required; do not release because numeric tests alone pass. + +Screenshot application footer reads `NATIVE IMMERSIVE · SCENE VOICING · VENUE LOCKED`, not `MUSICAL VOCAL DEPTH · REAL STAGE`; it appears to be a P9.8-capable binary rather than P9.9. Do not represent any P9.9 improvements as already auditioned on that screenshot without matching executable build SHA and native capability. diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h index 68ebc006a..1e8b8f074 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -1,6 +1,9 @@ // SPDX-License-Identifier: AGPL-3.0-only #pragma once #include "sonku/SonKuSpatialCore.h" +#if defined(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH) && ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH +#include "sonku/SonKuP99DefaultOrbitStage.h" +#endif #include "FxSpsc.h" #include "../core/RealtimeNativeFxControl.h" #include @@ -19,7 +22,12 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, : juce::AudioProcessor(BusesProperties() .withInput("Input",juce::AudioChannelSet::stereo(),true) .withOutput("Output",juce::AudioChannelSet::stereo(),true)) { -#if defined(ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE) && ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE +#if defined(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH) && ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH + // Approved operator settings as a NEW P9.9 factory Orbit default. + // Existing .smix restore/accepted realtime state is never remapped. + // Identical shared settings() are exercised in source and JUCE tests. + accepted_=armix::sonku::p99::DefaultOrbitStage::settings(); +#elif defined(ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE) && ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE // NEW inserts only. Restore from an existing .smix uses its saved // settings verbatim; no automatic remapping of operator sessions. // Signature reference is the operator's immersive 3.1m / full first diff --git a/engine/builtin_fx/sonku/SonKuP99DefaultOrbitStage.h b/engine/builtin_fx/sonku/SonKuP99DefaultOrbitStage.h new file mode 100644 index 000000000..c9df250b8 --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP99DefaultOrbitStage.h @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "SonKuSpatialCore.h" + +// P9.9 PRIVATE factory default. A type-safe ONE-place native reference +// for brand-new 8D-SonKu inserts only. Do NOT migrate operator .smix or +// alter approved Venue/Signature P9.8 checkpoints and their PCM. +// Values are transcribed from 2026-11-16 operator screenshot: +// ORBIT/CLOCKWISE, 12s, 127°, 100% MIX, +5.1dB (1.8 linear), +// Large 28.8m room, 2.7m, 100% ER, 77% late. The screenshot does not +// disclose the hidden v12 sceneVoicing byte or orbit starting phase; +// explicitly choose active Signature ID1 and FRONT 0° so the new private +// vocal-room algorithm actually runs and playback starts deterministically. +namespace armix::sonku::p99 { +struct DefaultOrbitStage final { + static constexpr float startAzimuth=0.f; + static constexpr float revolutionSeconds=12.f; + static constexpr float spreadDegrees=127.f; + static constexpr float outputGain=1.8f; + static constexpr float sourceDistanceMeters=2.7f; + static constexpr float reflections=1.f; + static constexpr float reverb=.77f; + static constexpr int voicing=1; // typed v12 Signature; Venue is 0 + static constexpr int room=3; // Large 28.8 x 28.8 + static Settings settings() noexcept { + Settings s{}; + s.renderMode=9; + s.sceneVoicing=voicing; + s.startAzimuthDegrees=startAzimuth; + s.moving=true; + s.clockwise=true; + s.revolutionSeconds=revolutionSeconds; + s.stereoSpreadDegrees=spreadDegrees; + s.spatialMix=1.f; + s.outputTrim=outputGain; + s.spacePreset=room; + s.sourceDistanceMeters=sourceDistanceMeters; + s.roomAmount=reflections; + s.ambience=reverb; +#if defined(SONKU_P72_NATIVE_XYZ_RT) && SONKU_P72_NATIVE_XYZ_RT + s.directElevationDegrees=0.f; +#endif +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + s.hrtfElevationTrimDegrees=0.f; +#endif +#if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH + s.musicCompatibleLowFrequency=false; + s.headYawDegrees=0.f; +#endif + return s; + } +}; +} // namespace armix::sonku::p99 diff --git a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h index b2142cacf..d8542d7aa 100644 --- a/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -58,7 +58,9 @@ class MusicalVocalDepth final { active_=false; } // ID 0 = completely unmodified approved Venue or Custom/Live Orbit. - // Signature offers the clearest front-stage; Cinema preserves LF body; + // Signature / Default Orbit: a clearly audible but bounded +15-25% + // step beyond initial conservative P9.9, not broadband output gain. + // Cinema preserves LF body; // Studio is deliberately a lower-delta, natural room. Stereo source(float left,float right,int scene,bool enabled) noexcept { active_=enabled && scene>=1 && scene<=3; @@ -194,7 +196,7 @@ class MusicalVocalDepth final { // not claimed vocal-estimation confidence or EQ dB targets. static constexpr std::array,4> profiles_{{ {{0.f,0.f,0.f,0.f,0.f,0.f}}, // Venue EXACT - {{.095f,.165f,.080f,.095f,.48f,.22f}}, // Signature room-body + {{.112f,.200f,.105f,.108f,.55f,.25f}}, // P9.9+ Signature vivid room {{.040f,.062f,.030f,.038f,.22f,.095f}}, // Live Studio subtle {{.070f,.115f,.065f,.070f,.34f,.15f}} // Cinema powerful, clear }}; diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index fb6694351..0454314a0 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -41,6 +41,12 @@ const roomMaxDistance=[10,3.1,6.7,10]; // 62% late, 82° spread, +7dB). Scene values are deliberate starting points, // not acoustic measurements. No background mutation of existing .smix. const factoryPresets=Object.freeze({ + // 2026-11-16 operator-accepted full scene (source of truth in P9.9 + // native DefaultOrbitStage). Only opt-in P9.9 exposes this preset; + // existing sessions remain manual until their operator selects it. + orbitStage:Object.freeze({moving:true,clockwise:true,startAzimuthDegrees:0, + revolutionSeconds:12,stereoSpreadDegrees:127,spatialMix:1,outputTrim:1.8, + spacePreset:3,sourceDistanceMeters:2.7,roomAmount:1,ambience:.77,sceneVoicing:1}), music:Object.freeze({moving:true,clockwise:true,startAzimuthDegrees:0, revolutionSeconds:6.5,stereoSpreadDegrees:82,spatialMix:1,outputTrim:1.9, spacePreset:3,sourceDistanceMeters:3.1,roomAmount:1,ambience:.62,sceneVoicing:1}), @@ -57,7 +63,9 @@ const factoryPresets=Object.freeze({ revolutionSeconds:8.5,stereoSpreadDegrees:82,spatialMix:1,outputTrim:1.75, spacePreset:3,sourceDistanceMeters:6.5,roomAmount:1,ambience:.83,sceneVoicing:0}) }); -const matchFactoryPreset=s=>Object.entries(factoryPresets).find(([id,p])=> +const matchFactoryPreset=(s,p99Enabled=false)=>Object.entries(factoryPresets).find(([id,p])=> + // Older v11/P9.8 binaries cannot misrepresent the P9.9-only preset. + (id!=="orbitStage" || (p99Enabled && s.sceneVoicing===1)) && s.renderMode===9 && Object.keys(p).every(k=> (k==="sceneVoicing" && s[k]===undefined) || Math.abs(Number(s[k])-Number(p[k]))<.00002))?.[0]||"CUSTOM"; @@ -133,6 +141,7 @@ root.innerHTML=[ 'SPATIAL AUDIO', '