diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 0962b87c1..3a8a0e5bd 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -723,6 +723,31 @@ 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_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 + # A separate branded insert may share this native core, + # but its FULL PCM must remain bit-identical to P9.8 + # unless that instance explicitly opts into P9.9. + # Prove all 24 front/rear/rate/scene cases, not a grep. + g++ $PRESET_FLAGS -DSONKU_P98_SCENE_VOICING_RESEARCH=1 -DSONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH=1 -DSONKU_P99_SHARED_CORE_UNOPTED_TEST=1 tests/sonku_p98_integrated_scene_test.cpp -o /tmp/sonku-p99-unopted-shared-core + /tmp/sonku-p99-unopted-shared-core > /tmp/sonku-p99-unopted-shared-core.csv + python3 scripts/verify_sonku_p99_shared_core_isolation.py /tmp/sonku-p98-scene-candidate.csv /tmp/sonku-p99-unopted-shared-core.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 fi @@ -760,6 +785,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 +806,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 +824,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','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)) { @@ -807,6 +835,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|99NewDefaultOrbitNative' } $tests += ')$' ctest --test-dir build -C Release --output-on-failure -R $tests if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } @@ -831,6 +860,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 +872,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..bcded28a6 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,22 @@ 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) + 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") target_sources(ARMixSonKuP90NativeTests PRIVATE @@ -938,6 +965,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_CROSS_THREAD_RECONCILIATION_20261116.md b/docs/SONKU_P99_CROSS_THREAD_RECONCILIATION_20261116.md new file mode 100644 index 000000000..63c155406 --- /dev/null +++ b/docs/SONKU_P99_CROSS_THREAD_RECONCILIATION_20261116.md @@ -0,0 +1,43 @@ +# SonKu P9.9 — cross-thread reconciliation and integration contract (2026-11-16) + +This is a deliberately **non-merging** reconciliation of independently active developer threads. This branch is a draft, not public release/main, and this document **does not authorize a force push, PR retarget, cherry-pick of entire files, auto-merge or rewrite of other threads**. + +## Live GitHub topology checked + +| Work | PR | Head at audit | Base / status | Ownership | +| --- | --- | --- | --- | --- | +| Approved Venue P9.7 | #728 | `fda0eef669e0a59575c489e149662c1bf878c998` | P9.6 draft | Immutable approved audio checkpoint | +| Signature/Cinema/Studio P9.8 | #729 | `4a9e5b2c455818c7a0dc8507ec2b7863be215033` | P9.7 draft | SonKu typed scenes 0–3; original v12 | +| Orbit default / warm vocal-room P9.9 | #730 | `94255ba476d1896cbd54904a87f2b9927851a360` before this reconciliation | P9.8 draft; native Windows 13/13 green | SonKu native audio and GUI | +| ImmerSIB concert / room cohesion | #732 | `c32345f9f638dfb837c60ec84405a5ef315631ac` | Separate ImmerSIB #722 branch; draft; GitHub reported mergeable=false | Product-owned static scene, private voicings 4/5 | +| ImmerSIB single engine | #722 | `b693618cabe9c13e8756633c1d64607b9254cde6` | P9.1/P9.2 draft | Separate product, ONE shared native SonKu PCM core | +| Native floating FX ownership | #731 | `61d64cd76ca56d51a8dcd4d621eea49ac4ca7819` | main, draft | Owner of `NativeFxWin32Owner.h`, `NativeOwnedFloatingWindow.h`, editor lifecycle | +| Factory reset | #708 | `a97462c2730f3e0feae1b9e8982c2784e81ea9a6` | main, draft, non-mergeable at audit | Native session / mixer recovery | +| Guitar FX redesign | #668 | `0a4209b06352f6cc6c0aca27ce99f3615eacd6f5` | main draft | JUCE guitar visuals, independent acceptance | + +Main was `37985f02caecd93b22f853183888d81e18dc6736` at audit. `main` is an ancestor of SonKu P9.9, but P9.9 includes **353 commits, 166 file changes compared to main**, most from older stacked research stages. Applying the entire P9.9 branch as a replacement for main or rebasing/merging other branches blindly is **not** a responsible integration. ImmerSIB #732 is divergent from P9.9, with independently developed SonKu voicing/header changes. Do not discard either. + +## Confirmed API and sonic conflicts + +1. On P9.9 the base class `SonKuSpatialProcessor` was mistakenly `final`, while ImmerSIB's `ImerSipP92Processor` derives from it. **Corrected only P9.9**: base now has a product-specific protected initial-scene constructor, queued-scene admission hook, and unpublished-state adoption with control-side validation and native ACK preservation. The derived product and its identity/state/editor are not copied into the SonKu branch. +2. The P9.9 `SonKuSpatialCore` originally activated its vocalist center/330Hz room stage merely because the project-wide compile flag was ON and a scene was ID 1/2/3. **Corrected**: a branded product sharing the same core is neutral by default; only the **8D-SonKu** native insert explicitly opts in *per instance* before prepare. This is not a second renderer, a new persistent state field, or a listener guess. Other products keep their scene DSP unmodified even in the same compiled application. +3. ImmerSIB #732 has native scene IDs **4/5** and different `SonKuP98SceneVoicing.h` / `SonKuSpatialCore.h` files, while SonKu #730 only has neutral/Signature/Studio/Cinema **0–3**. These remain separate until an explicitly reviewed additive integration preserves **all** IDs and the two product contracts. Do **not** raise SonKu ID validation to 5 without the actual ImmerSIB implementation/tests. +4. FX editor #731 changes `CMakeLists.txt`, `src/Main.cpp`, and native window ownership. Those ownership changes must be replayed with a real three-way merge when integrating, **not** overwritten by the SonKu versions of those shared files. The two native window headers in #732 currently match #731 blob SHA, but future updates must be inspected again. +5. P9.9's **ORBIT STAGE · DEFAULT** (127°, 12s, 2.7m, 100% ER, 77% late, +5.1dB) remains for **new SonKu instances only**. Existing .smix sessions, ImmerSIB's factory, legacy v11/v12 restore, and the P9.7 10m Venue are untouched. + +## Objective gates added before any integration + +- SonKu P9.9 actual private DSP remains **opted in** in its real native processor, the full integrated scene test and factory Orbit source test. +- A second copy of the **same full KEMAR + directional six-wall + late-room + limiter** test is built with P9.9 compile flag **ON but per-instance opt-in OFF**. The gate compares every complete output row and PCM hash to P9.8 native reference at **44.1/48k, front/rear, all six scenes = 24 cases**, with **zero tolerance**: `scripts/verify_sonku_p99_shared_core_isolation.py`. This is the shared-engine protection for ImmerSIB/other products, not a cosmetic capability check. +- Native JUCE test actually instantiates a branded derived processor, verifies own initial static scene, rejects forbidden moving scenes, checks applied edit ACK/readback, allows control-side unpublished state adoption, and rejects publication-time overwrite. Existing 13 Windows CTests remain active. +- Venue scene=0/ROOM OFF/MIX0 continue their exact P9.8 PCM hash gates, including all independent P9.7 approval fixtures. +- No additional audio latency, heap allocation in the PCM callback, extra HRTF, or duplicated convolution pipeline introduced. + +## Safe future integration order (not executed here) + +1. Keep separate reviewed source checkpoints. Do not merge P9.9 in isolation from its P9.5/P9.6/P9.7/P9.8 ancestry. The release decision needs owner headphone/ASIO A/B approval and a single explicit coherent integration plan. +2. Integrate **#731** native floating editor lifetime/ownership by three-way code merge of `src/Main.cpp` and `CMakeLists.txt`, preserving its tested ownership and source-specific closing/reopen behavior; avoid overwriting from old SonKu snapshot. +3. Reconcile **#722/#732** independently as ImmerSIB's product-owned branch. Forward-port the typed voicing IDs 4/5, IMRS v7 restore constraints, authorized static-scene constructor, audio-gate and GUI assets deliberately; verify no loss of SonKu IDs 0–3, no new PCM authority, and no accidental P9.9 change to ImmerSIB presets. +4. Only after integrated Windows JUCE/Chromium/PCM and product-specific session regressions pass, and owner explicitly approves acoustic candidate, decide main release. Keep draft PRs and their SHAs as reviewable provenance. + +**This reconciliation intentionally changes only P9.9 branch-owned native API compatibility and opt-in guards.** No writes to main, #731, #732, #722, #708, Guitar FX, checkpoint Venue, or shipped installer. Any cross-product *compile* with combined #732 is not yet proven because those PR branches are divergent and their scene IDs/headers still require a manual three-way integration. 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..2f62bd421 --- /dev/null +++ b/docs/SONKU_P99_MUSICAL_VOCAL_DEPTH_FAT_20261116.md @@ -0,0 +1,69 @@ +# 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. **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 two biquad 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** 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 + +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 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. + + +## 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..e1b3b20e3 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 @@ -10,7 +13,9 @@ // Built-in insert only; JUCE VST3 packaging is a separate adapter/quality gate. // Existing FX instance owns bypass, MIDI scratch, ChannelId, PDC and retirement. namespace armix::builtin_fx { -class SonKuSpatialProcessor final : public juce::AudioProcessor, +// Non-final native DSP owner intentionally supports *restricted* branded +// inserts sharing ONE PCM graph, without sharing their product defaults. +class SonKuSpatialProcessor : public juce::AudioProcessor, public armix::mixer::RealtimeNativeFxControl { public: static constexpr const char* catalogIdentity="armix.builtin.8d-sonku.v1"; @@ -19,7 +24,13 @@ 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(); + p99ForSonKuProduct_=true; // explicit only for real 8D-SonKu +#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 @@ -70,6 +81,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, constexpr auto profile=armix::sonku::SonKuReflectionProfile::DirectionalKemar; #else constexpr auto profile=armix::sonku::SonKuReflectionProfile::Lightweight; +#endif +#if defined(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH) && ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH + // Set once, OFF the callback: branded product instances inherit + // P9.8 core without unrequested P9.9 vocal processing. + if(p99ForSonKuProduct_)core_.optInP99ForSonKuInsert(); #endif ready_=core_.prepare(rate,profile); observedAzimuthDegrees_.store(accepted_.startAzimuthDegrees,std::memory_order_relaxed); @@ -151,7 +167,7 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, // is permitted only after corresponding completion/readback. bool queueSettings(const armix::sonku::Settings& next,std::uint64_t requestId) noexcept { return ready_&&requestId&&armix::sonku::valid(next) - &&queue_.push(Edit{requestId,next}); + &&admitQueuedScene(next)&&queue_.push(Edit{requestId,next}); } bool pollCompletion(Completion& done) noexcept { if(!complete_.pop(done))return false; @@ -438,9 +454,42 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, void setStateInformation(const void* data,int size) override { (void)restoreUnpublishedState(data,size); } +protected: + // Product-specific admission is a CONTROL-thread operation; the audio + // callback still owns the same core, edit queue and applied ACK. + virtual bool admitQueuedScene( + const armix::sonku::Settings&) const noexcept {return true;} + + // Branded insert constructor never borrows SonKu's newly approved + // ORBIT STAGE default or P9.9 sonic character. A derived product + // explicitly supplies its own scene and may adopt P9.9 separately. + explicit SonKuSpatialProcessor(const armix::sonku::Settings& initial) + : juce::AudioProcessor(BusesProperties() + .withInput("Input",juce::AudioChannelSet::stereo(),true) + .withOutput("Output",juce::AudioChannelSet::stereo(),true)), + accepted_(initial) {} + + // Only unpublished native instances may restore their own branded + // state; never overwrite an active PCM graph or queued transaction. + bool adoptUnpublishedScene(const armix::sonku::Settings& next) noexcept { + if(published_ || !armix::sonku::valid(next) || + !admitQueuedScene(next) || + !queue_.empty() || !complete_.empty())return false; + if(ready_ && !core_.setSettings(next))return false; + accepted_=next; +#if defined(ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT + audioSettings_=next; +#endif + observedAzimuthDegrees_.store(next.startAzimuthDegrees, + std::memory_order_relaxed); + return true; + } private: struct Edit {std::uint64_t requestId=0;armix::sonku::Settings settings{};}; armix::sonku::SonKuSpatialCore core_{}; +#if defined(ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH) && ARMIX_SONKU_EXPERIMENTAL_P99_VOCAL_DEPTH + bool p99ForSonKuProduct_=false; // no shared-core vocal leak +#endif FxSpsc queue_{}; FxSpsc complete_{}; armix::sonku::Settings accepted_{}; 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 new file mode 100644 index 000000000..d8542d7aa --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP99MusicalVocalDepth.h @@ -0,0 +1,219 @@ +// 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.); + // 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. + 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 + attentionRelease_=alpha(.85);// ~187 ms + gainSlew_=static_cast(1.-std::exp(-1./(rate*.055))); + reset(); + return true; + } + void reset() noexcept { + midBodyLow_={};midBodyHigh_={};midFocusLow_={};midFocusHigh_={}; + midFocusLow2_={};midFocusHigh2_={}; + roomWarm1_={};roomWarm2_={}; + roomWarmSignal_=0.f; + sideFocusLow_={};sideFocusHigh_={}; + sideFocusLow2_={};sideFocusHigh2_={}; + firstLow_={};firstHigh_={};firstLow2_={};firstHigh2_={}; + tailLow_={};tailHigh_={};tailLow2_={};tailHigh2_={}; + centerEnvelope_=sideEnvelope_=attention_=0.f; + gains_={}; + active_=false; + } + // ID 0 = completely unmodified approved Venue or Custom/Live Orbit. + // 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; + const auto target=profiles_[active_?scene:0]; + for(std::size_t i=0;i0.f?attentionRelease_:attentionAttack_)* + (0.f-attention_); + roomWarmSignal_=0.f; + 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); + // 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. + 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_); + // Feed the SAME already-prepared six-wall/late-room engines with + // 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=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. + 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 + // 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=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}; + } + // 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=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}; + } +private: + struct LP { + float v=0.f; + float run(float coeff,float x) noexcept { + v+=coeff*(x-v); + 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 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 + {{.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 + }}; + LP midBodyLow_{},midBodyHigh_{},midFocusLow_{},midFocusHigh_{}; + LP midFocusLow2_{},midFocusHigh2_{}; + 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 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; + 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..fcb3524e0 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 @@ -196,6 +202,13 @@ class SonKuSpatialCore final { public: static constexpr int taps=hrir::taps; static constexpr int updateInterval=16; +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + // Control thread, before prepare: explicitly authorize P9.9 on THIS + // SonKu insert, not all products sharing this exact native core. + // Separate branded processors (e.g. ImmerSIB) remain P9.8 until they + // independently adopt its P9.9 voicing. No extra PCM graph or state ABI. + void optInP99ForSonKuInsert() noexcept { p99ForSonKuInsert_=true; } +#endif bool prepare(double rate, SonKuReflectionProfile profile= SonKuReflectionProfile::Lightweight) noexcept { ready_=false; @@ -241,6 +254,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 +340,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 +409,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 +847,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(p99ForSonKuInsert_ && 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 if(p99ForSonKuInsert_){ + // 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){ + 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 @@ -894,8 +948,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){ @@ -1014,6 +1068,21 @@ class SonKuSpatialCore final { const auto air=p98Voicing_.early(reflection.left,reflection.right); reflection.left=air.left;reflection.right=air.right; } +#endif +#if defined(SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH) && SONKU_P99_MUSICAL_VOCAL_DEPTH_RESEARCH + if(p99ForSonKuInsert_ && p90World && settings_.spatialMix>0.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 +1502,10 @@ 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_{}; + bool p99ForSonKuInsert_=false; // per-instance, never serialized +#endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95::MusicalPresence p95Presence_{}; #endif 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/scripts/verify_sonku_p99_shared_core_isolation.py b/scripts/verify_sonku_p99_shared_core_isolation.py new file mode 100644 index 000000000..43592058f --- /dev/null +++ b/scripts/verify_sonku_p99_shared_core_isolation.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +"""Exact cross-product PCM isolation gate for P9.9 (private). + +The SAME SonKuSpatialCore and full KEMAR+6-wall+late-room graph are built +twice. The reference has P9.8 enabled and P9.9 absent. The candidate has +P9.9 compiled into the binary but does NOT opt its instance in. Every +output case MUST retain its full PCM hash and band meters bit-for-bit. +No JS capability surrogate, disabled native test, approximate tolerance or +claimed vocal stem extraction. +""" +import sys +from pathlib import Path + + +def rows(path): + entries = {} + for line in Path(path).read_text(encoding="utf-8").splitlines(): + if not line.startswith("P98_SCENE,"): + continue + fields = line.split(",") + assert len(fields) == 10, (path, line) + key = tuple(fields[1:5]) + assert key not in entries, (path, key) + entries[key] = line + assert len(entries) == 24, (path, len(entries)) + return entries + + +def main(): + assert len(sys.argv) == 3, "usage: reference.csv unopted.csv" + reference, unopted = map(rows, sys.argv[1:3]) + assert reference.keys() == unopted.keys(), "scene inventory changed" + for key, expected in reference.items(): + got = unopted[key] + assert got == expected, ( + f"SHARED_CORE_P99_UNREQUESTED_PCM_MUTATION {key}\n" + f"P98 reference: {expected}\nP99 unopted: {got}" + ) + print("SHARED_CORE_P99_UNOPTED_PCM_BIT_EXACT", ",".join(key)) + print("P99_CROSS_PRODUCT_SHARED_CORE_ISOLATION_24_CASES_PASSED") + + +if __name__ == "__main__": + main() 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..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', '