diff --git a/.github/workflows/p1-windows.yml b/.github/workflows/p1-windows.yml index 8ff1428ba..ffbc64605 100644 --- a/.github/workflows/p1-windows.yml +++ b/.github/workflows/p1-windows.yml @@ -660,7 +660,7 @@ jobs: sonku-p90-source: # Runs only on the P9 research PR, even while its production jobs skip. name: SonKu P9 exact-source C++ PCM preflight - if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-') || (startsWith(github.event.pull_request.head.ref, 'feat/sonku-p93-') || startsWith(github.event.pull_request.head.ref, 'research/sonku-p94-')))) }} + if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-') || (startsWith(github.event.pull_request.head.ref, 'feat/sonku-p93-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p94-') || startsWith(github.event.pull_request.head.ref, 'feat/sonku-p95-'))))) }} runs-on: ubuntu-latest timeout-minutes: 10 steps: @@ -684,6 +684,10 @@ jobs: g++ $FLAGS -DSONKU_P94_FRONT_BACK_DEPTH_RESEARCH=1 tests/sonku_p94_front_back_depth_source_test.cpp -o /tmp/sonku-p94 /tmp/sonku-p94 python3 scripts/verify_sonku_p94_acoustic_levels.py /tmp/sonku-p94-reference /tmp/sonku-p94 + if [[ "${{ github.head_ref }}" == feat/sonku-p95-* ]]; then + g++ $FLAGS -DSONKU_P94_FRONT_BACK_DEPTH_RESEARCH=1 -DSONKU_P95_MUSICAL_PRESENCE_RESEARCH=1 tests/sonku_p95_musical_presence_source_test.cpp -o /tmp/sonku-p95 + /tmp/sonku-p95 + fi g++ $FLAGS tests/sonku_p89_stereo_room_depth_source_test.cpp -o /tmp/sonku-p89 /tmp/sonku-p89 echo "SONKU_P90_NATIVE_SOURCE_CTEST_PASSED" @@ -691,7 +695,7 @@ jobs: sonku-p90-windows-fat: name: SonKu P9 actual JUCE / GUI portable x64 needs: sonku-p90-source - if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-') || (startsWith(github.event.pull_request.head.ref, 'feat/sonku-p93-') || startsWith(github.event.pull_request.head.ref, 'research/sonku-p94-')))) }} + if: ${{ github.event_name == 'pull_request' && (startsWith(github.event.pull_request.head.ref, 'research/sonku-p90-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p91-p92-') || (startsWith(github.event.pull_request.head.ref, 'feat/sonku-p93-') || (startsWith(github.event.pull_request.head.ref, 'research/sonku-p94-') || startsWith(github.event.pull_request.head.ref, 'feat/sonku-p95-'))))) }} runs-on: windows-2022 timeout-minutes: 55 steps: @@ -713,6 +717,7 @@ jobs: - name: Configure the actual native app with P9 OFF by default except FAT shell: pwsh run: | + $p95flag = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { '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" ` @@ -729,6 +734,7 @@ jobs: -DARMIX_SONKU_EXPERIMENTAL_P89_NATIVE_RT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P94_FRONT_BACK_DEPTH=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE=$p95flag ` -DBUILD_TESTING=ON if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $cache = Get-Content build/CMakeCache.txt -Raw @@ -741,12 +747,17 @@ jobs: - name: Build real native JUCE PCM, state ACK, and Windows GUI shell: pwsh run: | - cmake --build build --config Release --parallel 2 --target ARMixSonKuP94SourceTests ARMixSonKuP94ReferenceTests ARMixSonKuP91P92MusicBassTests ARMixSonKuP90NativeTests ARMixSonKuP90SourceTests ARMixSonKuP89NativeTests ARMixSonKuP89SourceTests ARMixConsole + $targets = @('ARMixSonKuP94SourceTests','ARMixSonKuP94ReferenceTests','ARMixSonKuP91P92MusicBassTests','ARMixSonKuP90NativeTests','ARMixSonKuP90SourceTests','ARMixSonKuP89NativeTests','ARMixSonKuP89SourceTests','ARMixConsole') + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { $targets += 'ARMixSonKuP95MusicTests' } + 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)) { throw 'SONKU_P90_NATIVE_GUI_EXE_MISSING' } - ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP(89RoomAnchoredStereoAndP88GoldenParity|89JuceV10AppliedAckAndV9Restore|90StereoExternalizationSource|90JuceV11AppliedAckAndLegacyRestore|91P92MusicFidelityWorldBassAndRoom|94FrontBackDepthA_BSource|94LevelMatchedAB)$' + $tests = '^NativeSonKuP(89RoomAnchoredStereoAndP88GoldenParity|89JuceV10AppliedAckAndV9Restore|90StereoExternalizationSource|90JuceV11AppliedAckAndLegacyRestore|91P92MusicFidelityWorldBassAndRoom|94FrontBackDepthA_BSource|94LevelMatchedAB' + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { $tests += '|95MusicPresenceVenue' } + $tests += ')$' + ctest --test-dir build -C Release --output-on-failure -R $tests if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } - name: Verified portable package, no installer or release shell: pwsh @@ -761,12 +772,15 @@ jobs: Copy-Item docs/SONKU_P90_TRUE_EXTERNAL_SPEAKER_FAT_20261115.md dist/SONKU_P90_FIELD_FAT.md Copy-Item docs/SONKU_P91_P92_RECONCILED_MUSIC_FIDELITY_BASS_FAT_20261116.md dist/SONKU_P91_P92_FIELD_FAT.md Copy-Item docs/SONKU_P94_FRONT_REAR_EXTERNALIZATION_FAT_20261116.md dist/SONKU_P94_FRONT_REAR_FAT.md + if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { + Copy-Item docs/SONKU_P95_IMMERSIVE_MUSIC_VENUE_FAT_20261116.md dist/SONKU_P95_MUSIC_VENUE_FAT.md + } $provenance = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json if ($provenance.sourceCommit -ne (git rev-parse HEAD).Trim()) { throw 'SONKU_P90_SOURCE_COMMIT_MISMATCH' } $provenance | Add-Member -Force -NotePropertyName sonkuExperiment -NotePropertyValue @{ - mode = 'P9.4_FRONT_REAR_DEPTH_EXPERIMENT' + mode = if ($env:GITHUB_HEAD_REF -like 'feat/sonku-p95-*') { 'P9.5_IMMERSIVE_MUSIC_VENUE_FOUNDATION' } else { 'P9.4_FRONT_REAR_DEPTH_EXPERIMENT' } stateSchema = 11 headphoneFat = 'PENDING' publicRelease = $false diff --git a/CMakeLists.txt b/CMakeLists.txt index 9340baf61..a7619472a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,13 @@ if(ARMIX_SONKU_EXPERIMENTAL_P94_FRONT_BACK_DEPTH AND NOT ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) message(FATAL_ERROR "P9.4 depth cue requires the P9 measured two-speaker engine") endif() +# Optional P9.5 upward-only, slow electrical musical presence. No public default. +option(ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE + "Private P9.5 cinema/venue music-level compensation" OFF) +if(ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE AND + NOT ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT) + message(FATAL_ERROR "P9.5 requires P9 measured spatial engine") +endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -321,7 +328,9 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:ARMIX_SONKU_EXPERIMENTAL_P90_NATIVE_RT=1> $<$:SONKU_P90_TRUE_EXTERNAL_RESEARCH=1> $<$:SONKU_P94_FRONT_BACK_DEPTH_RESEARCH=1> - $<$:ARMIX_SONKU_EXPERIMENTAL_P94_FRONT_BACK_DEPTH=1>) + $<$:ARMIX_SONKU_EXPERIMENTAL_P94_FRONT_BACK_DEPTH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE=1> + $<$:SONKU_P95_MUSICAL_PRESENCE_RESEARCH=1>) if(WIN32) # Windows retains its proven ASIO-first / WASAPI / static WebView2 distribution. # Never link Windows loader or sound APIs into macOS/Linux builds. @@ -848,6 +857,17 @@ if(BUILD_TESTING) "$" "$") endif() + if(ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE) + add_executable(ARMixSonKuP95MusicTests + tests/sonku_p95_musical_presence_source_test.cpp) + target_compile_features(ARMixSonKuP95MusicTests PRIVATE cxx_std_20) + target_compile_definitions(ARMixSonKuP95MusicTests PRIVATE + $ + SONKU_P94_FRONT_BACK_DEPTH_RESEARCH=1 + SONKU_P95_MUSICAL_PRESENCE_RESEARCH=1) + add_test(NAME NativeSonKuP95MusicPresenceVenue + COMMAND ARMixSonKuP95MusicTests) + endif() juce_add_console_app(ARMixSonKuP90NativeTests PRODUCT_NAME "ArSonMix SonKu P90 JUCE v11 State Tests") target_sources(ARMixSonKuP90NativeTests PRIVATE diff --git a/docs/SONKU_P95_IMMERSIVE_MUSIC_VENUE_FAT_20261116.md b/docs/SONKU_P95_IMMERSIVE_MUSIC_VENUE_FAT_20261116.md new file mode 100644 index 000000000..175590429 --- /dev/null +++ b/docs/SONKU_P95_IMMERSIVE_MUSIC_VENUE_FAT_20261116.md @@ -0,0 +1,28 @@ +# SonKu P9.5 Immersive Music & Venue — acceptance and architecture (2026-11-16) + +**PRIVATE DRAFT: no public release, no claim of dearVR acoustic parity.** + +## Operator sound reference +The operator likes P9.1/P9.2 **music fidelity, real separation and living external sound** but wants deeper front/back and a much larger sound-system presentation, with powerful yet controlled bass. Reference screenshot settings: P9.4 mode, 6.5 s orbit, 82° spread, MIX 100%, GAIN +7dB, LARGE room 28.8×28.8m, distance 3.1m, reflections 100%, reverb 62%, plus rear/front distance concern. This is the starting reference, **not** a verified universal optimum. + +## Protected checkpoints +- Operator-accepted P9.1/P9.2: `763706a15a2617a10d23b5e2e43eb5689e454ccb` checkpoint issue #720 +- GUI-only PR #721 retains 148×83 *visual perspective ellipse* as the correct 3D view. +- P9.4 PR #723 provides real measured KEMAR source with bounded median-plane DRR adjustment; no claim of measured individual BRIR. +- P9.5 is an isolated child branch. No merge into main without headphone FAT. + +## P9.5 implemented engineering +1. **Bypass animation** — the JS visual PLL stops integrating when accepted native FX state is OFF / RACK OFF / UNKNOWN. Discard stale observed azimuth on disable. Do not reset to 0 on every 250ms readback. Resume only from current native telemetry; freeze visual pose while audio callback bypassed. Native FX rack remains sole audio authority. +2. **One latest-engine selector** — no confusing P8.4/P8.9/P9.0/P9.4 research catalog for a P9.5-capable build; legacy saved mode can be displayed honestly as legacy session and switched to latest by explicit operator action, never silently rewritten. +3. **Factory scenes** — five deliberate starting points, full native setting transaction + ACK/readback, editable afterwards: Signature 3.1m/100% ER/62% late/+5.6dB (1.9x linear), Large Studio 4.8m/94% ER/72% late/+4.3dB, Cinema 7.5m/100% ER/84% late/+4.6dB, Venue 10m/100% ER/100% late/+5.1dB, Live Orbit 6.5m/100% ER/83% late/+4.9dB. All use the physical LARGE 28.8m room model, **not claimed as distinct new BRIR measurements or individually different architectural room designs**. Old SMALL/CHAMBER values remain in the schema for session compatibility. +4. **Default only for NEW P9.5 inserts** — initialize `accepted_` with Signature rather than 1.6m/ROOM OFF/outputTrim .75. `.smix` restore applies saved exact settings. Other experimental/production builds unchanged. +5. **Slow electrical music-presence compensation (opt-in)** — 280ms stereo energy detector, 450ms smoothing of the makeup, update desired max once per 256 PCM samples, upward-only target 1.0..1.65. A near-1dB electrical minimum is a **target, not guaranteed loudness** with strong transients. Never reduce explicitly requested positive GAIN. Existing linked 0.98 sample peak limiter remains, peak safety comes before any claiming of dynamic improvement. P9.5 only, no WebAudio, heap, second graph, or front/rear geometry changes. Force bypass at 0% mix. +6. **Large venue low-frequency foundation** — existing three finite-Q room modes increase by at most 18% on the ROOM=Large wet modal return, *not* on direct bass; no fake subwoofer box or hidden low shelf. Bass/treble integrity and attack must survive field tests. +7. **No new .smix schema**: mode9 and typed native settings remain the same, new feature advertised only by `p95MusicalPresence` readback. Existing saved state is authoritative. + +## FAT / reject +- Linux source P9, P9.1/P9.2, P9.4 baseline PCM checks, P9.5 44.1/48k and stereo anti-phase, 64/256 buffer parity; UI Chromium with bypass motion freeze and 5 scene transaction/readback. +- Windows actual JUCE + V11 state ACK, GUI portable, checks / source provenance. No release until operator listens. +- Critical loudness: equal-gain A/B and user-preferred +gain A/B are **separate**. Compare integrated loudness, short-term crest factor and limiter activity; do NOT select louder just because it wins unblinded A/B. +- Headphones, same device / gain path / speaker fader / source, actual 0/90/180/270 and 6–12 second orbit, 3.1m/7.5m/10m; compare bass drum punch, 50–120Hz notes, cymbal air and stereo music separation. Retain P9.1/P9.2 baseline for quick revert. Reject if boost causes pumping, peak flatlining, harshness, mono collapse, spurious echoes, or ASIO interruptions. +- Important known ceiling: these five named scenes still share existing native large-room geometry and algorithm. True physically distinct cinema/venue BRIRs need new early-reflection geometry, materials, speaker directivity, and listening measurements. Label this as a FOUNDATION, not completed dearVR equivalent. diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h index 6ed46528f..28955fd2f 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -18,7 +18,25 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, SonKuSpatialProcessor() : juce::AudioProcessor(BusesProperties() .withInput("Input",juce::AudioChannelSet::stereo(),true) - .withOutput("Output",juce::AudioChannelSet::stereo(),true)) {} + .withOutput("Output",juce::AudioChannelSet::stereo(),true)) { +#if 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 + // reflection / 62% reverb scene with conservative native linked guard. + accepted_.renderMode=9; + accepted_.musicCompatibleLowFrequency=false; + accepted_.moving=true; + accepted_.revolutionSeconds=6.5f; + accepted_.stereoSpreadDegrees=82.f; + accepted_.spatialMix=1.f; + accepted_.outputTrim=1.9f; + accepted_.spacePreset=3; + accepted_.sourceDistanceMeters=3.1f; + accepted_.roomAmount=1.f; + accepted_.ambience=.62f; +#endif + } const juce::String getName() const override {return "8D-SonKu";} bool acceptsMidi() const override {return false;} bool producesMidi() const override {return false;} diff --git a/engine/builtin_fx/sonku/SonKuP91P92WorldBassFoundation.h b/engine/builtin_fx/sonku/SonKuP91P92WorldBassFoundation.h index 938cb96a5..63551d22e 100644 --- a/engine/builtin_fx/sonku/SonKuP91P92WorldBassFoundation.h +++ b/engine/builtin_fx/sonku/SonKuP91P92WorldBassFoundation.h @@ -99,7 +99,16 @@ class WorldBassFoundation final { auto& resonator=resonators_[r][b]; const float l=resonator.state[0].run(resonator.coeff,world[0]); const float rr=resonator.state[1].run(resonator.coeff,world[1]); - const float level=roomWeights_[r]*roomGain_*modeWeights[b]; + // Private P9.5 venue reinforcement: augment the EXISTING + // low-frequency axial room modes slightly, not the direct + // bass, not a duplicate cabinet engine or hard EQ shelf. + // All modes remain damping-controlled with finite Q. +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH + const float venue=roomPreset==3?1.18f:1.f; +#else + constexpr float venue=1.f; +#endif + const float level=roomWeights_[r]*roomGain_*modeWeights[b]*venue; modal.left+=level*l; modal.right+=level*rr; } diff --git a/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h b/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h new file mode 100644 index 000000000..ece40572b --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include +#include + +// Optional single-graph music-level *upward-only* compensation. +// In P9 spatial wet transforms the original stereo energy can be lower. +// A slow detector allows a conservative minimum electrical level without +// turning the entire effect into a compressor or defeating user gain. +// The final existing linked 0.98 sample peak safety limiter stays authoritative. +namespace armix::sonku::p95 { +class MusicalPresence final { +public: + bool prepare(double sr) noexcept { + if(!std::isfinite(sr) || (std::abs(sr-44100.)>.1 && std::abs(sr-48000.)>.1)) + return false; + detector_=static_cast(1.-std::exp(-1./(sr*.28))); + slew_=static_cast(1.-std::exp(-1./(sr*.45))); + reset();return true; + } + void reset() noexcept {inPower_=outPower_=0.f;target_=makeup_=1.f;counter_=0;} + float process(float inL,float inR,float wetL,float wetR) noexcept { + const float a=.5f*(inL*inL+inR*inR); + const float b=.5f*(wetL*wetL+wetR*wetR); + inPower_+=detector_*(a-inPower_); + outPower_+=detector_*(b-outPower_); + // At most one square root per 256 samples, outside inner FIR loops. + if(++counter_>=256){ + counter_=0; + if(inPower_>1.e-7f&&outPower_>1.e-9f){ + const float ratio=std::sqrt(inPower_/outPower_); + // 1.12× = +0.98dB *electrical* minimum when possible. + // Never auto-reduce the deliberate user outputTrim boost. + target_=std::clamp(1.12f*ratio,1.f,1.65f); + }else target_=1.f; + } + makeup_+=slew_*(target_-makeup_); + return makeup_; + } + float gain() const noexcept {return makeup_;} +private: + float detector_=0.f,slew_=0.f,inPower_=0.f,outPower_=0.f; + float target_=1.f,makeup_=1.f; + int counter_=0; +}; +} // namespace armix::sonku::p95 diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index abbcf4695..0f6ed196b 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -22,6 +22,9 @@ #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH #include "SonKuP90StereoDecoder.h" #include "SonKuP91P92WorldBassFoundation.h" +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH +#include "SonKuP95MusicalPresence.h" +#endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH #include "SonKuP94FrontBackDepthCue.h" #endif @@ -207,6 +210,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH if(!p90Decoder_.prepare(rate))return false; if(!p92Bass_.prepare(rate))return false; +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH + if(!p95Presence_.prepare(rate))return false; +#endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH if(!p94Depth_.prepare(rate))return false; #endif @@ -278,6 +284,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH p90Decoder_.reset(); p92Bass_.reset(); +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH + p95Presence_.reset(); +#endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH p94Depth_.reset(); #endif @@ -332,6 +341,9 @@ class SonKuSpatialCore final { if((s.renderMode==9)!=(settings_.renderMode==9)){ p90Decoder_.reset(); p92Bass_.reset(); +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH + p95Presence_.reset(); +#endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH p94Depth_.reset(); #endif @@ -962,6 +974,16 @@ class SonKuSpatialCore final { float outR=baseDryR+smoothedTrim_* ((transparentBass?musicLowR:dryLevel*x1)+ sceneBinauralLevel*(transparentBass?1.f:smoothedRoomLevel_)*spatialR)-sideRescue; +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH + if(p90World){ + // Single native PCM graph, no WebAudio or dynamic makeup + // at 0% spatial MIX. Explicit user GAIN still applies. + if(settings_.spatialMix>0.f){ + const float makeup=p95Presence_.process(x0,x1,outL,outR); + outL*=makeup;outR*=makeup; + } + } +#endif // Zero-lookahead *linked* sample-peak safety guard. Quiet // signals are linear; peaks are gently returned below unity // without routing through a second engine or allocating. @@ -1274,6 +1296,9 @@ class SonKuSpatialCore final { #if defined(SONKU_P90_TRUE_EXTERNAL_RESEARCH) && SONKU_P90_TRUE_EXTERNAL_RESEARCH p90::StereoDecoder p90Decoder_{}; p92::WorldBassFoundation p92Bass_{}; +#if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH + p95::MusicalPresence p95Presence_{}; +#endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH p94::FrontBackDepthCue p94Depth_{}; #endif diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 03d1f8042..34817b757 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -37,22 +37,25 @@ const roomMaxDistance=[10,3.1,6.7,10]; // Factory presets are explicit native scene values, never browser audio DSP. // A preset applies the COMPLETE documented scene in one ACK-verified command. // Preserve custom .smix settings until the operator actually selects a preset. +// Curated against operator's *own* immersive reference (3.1 m, MAX early, +// 62% late, 82° spread, +7dB). Scene values are deliberate starting points, +// not acoustic measurements. No background mutation of existing .smix. const factoryPresets=Object.freeze({ - music:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, - revolutionSeconds:12,stereoSpreadDegrees:82,spatialMix:1,outputTrim:1, - spacePreset:3,sourceDistanceMeters:1.6,roomAmount:.78,ambience:.33}), + 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}), studio:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, - revolutionSeconds:12,stereoSpreadDegrees:68,spatialMix:1,outputTrim:1, - spacePreset:1,sourceDistanceMeters:1.6,roomAmount:.42,ambience:.18}), + revolutionSeconds:12,stereoSpreadDegrees:76,spatialMix:1,outputTrim:1.65, + spacePreset:3,sourceDistanceMeters:4.8,roomAmount:.94,ambience:.72}), wide:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, - revolutionSeconds:12,stereoSpreadDegrees:118,spatialMix:1,outputTrim:1, - spacePreset:2,sourceDistanceMeters:3.2,roomAmount:.68,ambience:.32}), + revolutionSeconds:12,stereoSpreadDegrees:98,spatialMix:1,outputTrim:1.7, + spacePreset:3,sourceDistanceMeters:7.5,roomAmount:1,ambience:.84}), deep:Object.freeze({moving:false,clockwise:true,startAzimuthDegrees:0, - revolutionSeconds:12,stereoSpreadDegrees:104,spatialMix:1,outputTrim:1, - spacePreset:3,sourceDistanceMeters:4.5,roomAmount:.82,ambience:.42}), + revolutionSeconds:12,stereoSpreadDegrees:106,spatialMix:1,outputTrim:1.8, + spacePreset:3,sourceDistanceMeters:10,roomAmount:1,ambience:1}), orbit:Object.freeze({moving:true,clockwise:true,startAzimuthDegrees:0, - revolutionSeconds:8.5,stereoSpreadDegrees:100,spatialMix:1,outputTrim:1, - spacePreset:3,sourceDistanceMeters:2.5,roomAmount:.72,ambience:.38}) + revolutionSeconds:8.5,stereoSpreadDegrees:82,spatialMix:1,outputTrim:1.75, + spacePreset:3,sourceDistanceMeters:6.5,roomAmount:1,ambience:.83}) }); const matchFactoryPreset=s=>Object.entries(factoryPresets).find(([id,p])=> s.renderMode===9 && Object.keys(p).every(k=>Math.abs(Number(s[k])-Number(p[k]))<.00002))?.[0]||"CUSTOM"; @@ -126,11 +129,11 @@ root.innerHTML=[ 'SPATIAL AUDIO', '', + '', + '', + '', + '', + '', '', '', '', @@ -229,7 +232,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,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,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; @@ -249,8 +252,17 @@ function syncPower(){ (!lane||typeof lane.fxRackBypassed!=="boolean"|| !insert||insert.catalogId!==ID||typeof insert.bypassed!=="boolean"?"unknown": (lane.fxRackBypassed||globalOff)?"rack-off":insert.bypassed?"off":"on"); + const previous=root.dataset.fxState; p.dataset.fxState=state; p.disabled=state==="unknown"||state==="rack-off"; + // The native insert does not render PCM/advance azimuth while bypassed. + // Freeze the LAST rendered pose; do not keep extrapolating an absent PCM + // clock, and do not PLL-correct stale observed azimuth upon re-enable. + // Avoid resetting visual phase on every 250ms status poll. + if(previous!==state){ + visualAt=0; + if(state!=="on")observedAt=0; + } p.setAttribute("aria-pressed",String(state==="on")); p.title=state==="on"?"SONKU ON · click to bypass this insert": state==="off"?"SONKU BYPASSED · click to enable": @@ -286,23 +298,13 @@ function render(){ const row=$("skRenderRow");row.hidden=!(p83Capable||p84Capable); if(p83Capable||p84Capable){ const picker=$("skRenderMode"); - if(p90Capable && picker.dataset.nativeModeSet!==(p94Capable?"p94":p91p92Capable?"p91p92":"p90")){ - picker.innerHTML=''+ - ''+ - ''+ - ''+ - ''+ - ''+ - ''+ - (p94Capable? - '': - p91p92Capable? - '': - ''); - picker.dataset.nativeModeSet=p94Capable?"p94":p91p92Capable?"p91p92":"p90"; - root.querySelector(".sk-render-label").textContent=p94Capable? - "RENDER MODE · P9.4 EXPERIMENT":p91p92Capable? - "RENDER MODE · P9.1 + P9.2 FAT":"RENDER MODE · P9.0 HEADPHONE FAT"; + if(p90Capable && picker.dataset.nativeModeSet!=="latest"){ + // P9.5 is the sole normal user-facing engine. Preserve old .smix mode + // bytes in native state; show a truthful migration option only when a + // previously saved session actually contains an older DSP mode. + picker.dataset.nativeModeSet="latest"; + root.querySelector(".sk-render-label").textContent="SPATIAL ENGINE"; + picker.innerHTML=''; }else if(!p90Capable && p89Capable && picker.dataset.nativeModeSet!=="p89"){ picker.innerHTML=''+ ''+ @@ -356,7 +358,17 @@ function render(){ picker.dataset.nativeModeSet="p83"; root.querySelector(".sk-render-label").textContent="RENDER MODE · P8.3 TEST"; } - const v=p90Capable?(s.renderMode===9?"external":s.renderMode===8?"depth":s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): + // Restore-only compatibility: no legacy experiments in a new user menu. + // Allow the user to choose LATEST without auto-mutating saved DSP state. + if(p90Capable){ + const legacy=picker.querySelector('option[value="legacy"]'); + if(s.renderMode!==9 && !legacy){ + picker.add(new Option("SAVED SESSION · LEGACY SOUND","legacy")); + }else if(s.renderMode===9 && legacy){ + legacy.remove(); + } + } + const v=p90Capable?(s.renderMode===9?"external":"legacy"): p89Capable?(s.renderMode===8?"depth":s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): p88Capable?(s.renderMode===7?"align":s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): p87Capable?(s.renderMode===6?"body":s.renderMode===5?"focus":s.renderMode===4?"coherence":s.renderMode===3?"clarity":"music"): @@ -422,8 +434,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=p94Capable&&s.renderMode===9? - "P9.4 · FRONT/REAR ROOM DEPTH · SAME 3D MOTION · HEADPHONE FAT REQUIRED": + root.querySelector(".sk-stage-caption").textContent=p95Capable&&s.renderMode===9? + "IMMERSIVE SPATIAL · MUSIC PRESENCE · WORLD BASS · CINEMA / VENUE": + p94Capable&&s.renderMode===9? + "LATEST SPATIAL · FRONT/REAR DEPTH · MUSIC FIDELITY · WORLD BASS": p91p92Capable&&s.renderMode===9? "P9.1 + P9.2 · MUSIC FIDELITY · WORLD BASS · ROOM MODES · FAT REQUIRED": p90Capable&&s.renderMode===9? @@ -454,7 +468,7 @@ function render(){ (p83Capable||p84Capable)&&s.renderMode!==0?"SPEAKER ANGLE": musicSafeStereo?"SIDE WIDTH":"SPREAD"; root.querySelector(".sk-guide").textContent=p90Capable&&s.renderMode===9 - ?"Two positioned measured HRIR speakers · 0° co-location cannot preserve anti-phase" + ?"World-anchored stereo speakers · immersive room & musical bass" :musicSafeStereo ?"Legacy music WIDTH adjusts headlocked SIDE; P9 spatializes it" :"Drag monitors to position · rotary knobs: vertical drag, double-click to reset"; @@ -471,7 +485,8 @@ function render(){ // redrawn at 60 Hz. The native audio callback remains the time authority. drawSpeakers(); $("skMode").textContent=native()?(context()? - (p94Capable&&s.renderMode===9?"NATIVE P9.4 FRONT/REAR DEPTH · A/B FAT": + (p95Capable&&s.renderMode===9?"NATIVE IMMERSIVE · MUSIC PRESENCE · WORLD BASS": + p94Capable&&s.renderMode===9?"NATIVE IMMERSIVE SPATIAL · WORLD BASS": p91p92Capable&&s.renderMode===9?"NATIVE P9.1+P9.2 WORLD BASS · FAT": p90Capable&&s.renderMode===9?"NATIVE P9.0 TRUE EXTERNAL · TEST": p89Capable&&s.renderMode===8?"NATIVE P8.9 STEREO + ROOM · TEST": @@ -524,7 +539,7 @@ function drawSpeakers(){ // teleporting at each ~250ms readback. Only SVG geometry is painted per frame. function animate(time){ if(root.hidden||!current){frame=null;return;} - if(visualAt && draft.moving && !drag){ + if(visualAt && draft.moving && !drag && root.dataset.fxState==="on"){ const dt=Math.max(0,Math.min(.08,(time-visualAt)*.001)); const speed=(draft.clockwise?1:-1)*360/draft.revolutionSeconds; visualPhase=angle(visualPhase+speed*dt); @@ -644,6 +659,7 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ // Independent of schema version: only this exact measured native DSP // can claim the *experimental* depth calibration, not P9.1 baseline. p94Capable=p91p92Capable && r.p94FrontBackDepthCue===true; + p95Capable=p91p92Capable && r.p95MusicalPresence===true; p89Capable=(r.schemaVersion===10||p90Capable) && r.p89StereoRoomDepth===true && Number.isFinite(incoming.hrtfElevationTrimDegrees); p88Capable=(r.schemaVersion===9||p89Capable) && r.p88PerceptualAlignment===true && @@ -686,9 +702,9 @@ backend()?.addEventListener?.("arMixBuiltinSonKuSnapshot",r=>{ // later failure/reopen never restores a stale value. accepted={...incoming}; } - if(Number.isFinite(r.observedAzimuthDegrees)){ - // First authoritative phase anchors the loop once. Subsequent readbacks - // only adjust the PLL; never set the visible phase discontinuously. + if(Number.isFinite(r.observedAzimuthDegrees) && root.dataset.fxState==="on"){ + // Disabled PCM has no running phase: never oscillate around stale native + // readbacks or repeatedly restart a non-existent bypassed audio orbit. if(!observedAt)visualPhase=angle(r.observedAzimuthDegrees); observed=r.observedAzimuthDegrees;observedAt=performance.now(); } @@ -749,7 +765,7 @@ $("skPreset").addEventListener("change",()=>{ musicCompatibleLowFrequency:false}); 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;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;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;} @@ -757,7 +773,7 @@ $("skClose").addEventListener("click",()=>{root.hidden=true;current=null;xyzCapa $("skRenderMode").addEventListener("change",()=>{ if(!(p83Capable||p84Capable))return; const v=$("skRenderMode").value; - const mode=p90Capable?(v==="external"?9:v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): + const mode=p90Capable?(v==="external"?9:draft.renderMode): p89Capable?(v==="depth"?8:v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): p88Capable?(v==="align"?7:v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): p87Capable?(v==="body"?6:v==="focus"?5:v==="coherence"?4:v==="clarity"?3:0): @@ -948,7 +964,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=false; + p89Capable=p90Capable=p91p92Capable=p94Capable=p95Capable=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 b12156bc1..6429e4b9e 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -3126,6 +3126,9 @@ class ConsoleWindow final : public juce::DocumentWindow, private juce::Timer, pr // This capability is emitted only by the new reconciled DSP build. // Older v11 P9.0 binaries must NOT be advertised as P9.1+P9.2. reply->setProperty("p91p92MusicBassFoundation",true); +#if defined(ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE) && ARMIX_SONKU_EXPERIMENTAL_P95_MUSICAL_PRESENCE + reply->setProperty("p95MusicalPresence",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/approved_native_sonku_smoke.py b/tests/approved_native_sonku_smoke.py index 49df8af59..8b73e6633 100644 --- a/tests/approved_native_sonku_smoke.py +++ b/tests/approved_native_sonku_smoke.py @@ -209,6 +209,13 @@ def exercise(browser,out,width,height): after=page.evaluate( "()=>window.__actions.filter(a=>a.action==='nativeSonKuSnapshot').length") assert after==count, "Unanswered SonKu readback was overwritten" + # Admission now establishes authoritative rack bypass state. Only a + # confirmed ON insert is allowed to extrapolate an audible orbit; + # UNKNOWN or bypassed should remain frozen, never simulate PCM. + state["graph"]["channels"][0]["fxRackBypassed"]=False + emit(page,"arMixConsoleSnapshot",state) + page.wait_for_function("""()=>document.getElementById('mxNativeSonKu') + ?.dataset.fxState==='on'""") accepted_snapshot(page,state,SETTINGS) # A true visual animation must advance BETWEEN native readbacks. # The old 250ms setInterval was ~4fps despite valid DSP PCM. @@ -216,6 +223,27 @@ def exercise(browser,out,width,height): page.wait_for_timeout(150) vx1=editor.locator('.sk-src[data-index="0"]').get_attribute("data-visual-x") assert abs(float(vx1)-float(vx0))>1.0,("Orbit is frozen between readbacks",vx0,vx1) + # Regression: bypassed native PCM cannot advance azimuth. The visual + # must FREEZE its last pose and ignore the stale 250ms readback PLL. + # This is the user-reported erratic left/right icon flicker. + state["graph"]["channels"][0]["inserts"][0]["bypassed"]=True + emit(page,"arMixConsoleSnapshot",state) + page.wait_for_function("""()=>document.getElementById('mxNativeSonKu') + ?.dataset.fxState==='off'""") + freeze_x=editor.locator('.sk-src[data-index="0"]').get_attribute("data-visual-x") + page.wait_for_timeout(450) + still_x=editor.locator('.sk-src[data-index="0"]').get_attribute("data-visual-x") + assert freeze_x==still_x,("Bypassed PCM must freeze last speaker icon",freeze_x,still_x) + state["graph"]["channels"][0]["inserts"][0]["bypassed"]=False + emit(page,"arMixConsoleSnapshot",state) + page.wait_for_function("""()=>document.getElementById('mxNativeSonKu') + ?.dataset.fxState==='on'""") + accepted_snapshot(page,state,SETTINGS) + resume_x=editor.locator('.sk-src[data-index="0"]').get_attribute("data-visual-x") + page.wait_for_timeout(180) + resumed_x=editor.locator('.sk-src[data-index="0"]').get_attribute("data-visual-x") + assert abs(float(resumed_x)-float(resume_x))>1.0,( + "Enabled PCM must resume running source orbit",resume_x,resumed_x) # Close/reopen must use the installed FX rack click, never a private open(). editor.locator("#skClose").click() assert editor.is_hidden() @@ -555,10 +583,11 @@ def apply_slider(selector,value,field): assert command_count()==before+1,"Factory scene did not issue one native transaction" applied=last_action(page,"nativeSonKuSet") proposed=applied["settings"] - assert proposed["renderMode"]==9 and proposed["moving"] is False,proposed - assert proposed["stereoSpreadDegrees"]==82 and proposed["outputTrim"]==1,proposed - assert proposed["spacePreset"]==3 and proposed["sourceDistanceMeters"]==1.6,proposed - assert abs(proposed["roomAmount"]-.78)<.001 and abs(proposed["ambience"]-.33)<.001 + assert proposed["renderMode"]==9 and proposed["moving"] is True,proposed + assert proposed["revolutionSeconds"]==6.5,proposed + assert proposed["stereoSpreadDegrees"]==82 and proposed["outputTrim"]==1.9,proposed + assert proposed["spacePreset"]==3 and proposed["sourceDistanceMeters"]==3.1,proposed + assert abs(proposed["roomAmount"]-1.0)<.001 and abs(proposed["ambience"]-.62)<.001 emit(page,"arMixBuiltinSonKuAck",{ "requestId":applied["requestId"],"status":"APPLIED"}) accepted_snapshot(page,state,proposed,applied=applied["requestId"],schema=11) diff --git a/tests/sonku_p90_dropdown_stability_test.cjs b/tests/sonku_p90_dropdown_stability_test.cjs index 880f40e4d..baa8562ce 100644 --- a/tests/sonku_p90_dropdown_stability_test.cjs +++ b/tests/sonku_p90_dropdown_stability_test.cjs @@ -7,14 +7,14 @@ const assert=require("node:assert/strict"); const fs=require("node:fs"); const vm=require("node:vm"); const source=fs.readFileSync("site/preview-v2/assets/mixer-native-sonku.js","utf8"); -const start=source.indexOf(' if(p90Capable && picker.dataset.nativeModeSet!==(p94Capable?"p94":p91p92Capable?"p91p92":"p90")){'); +const start=source.indexOf(' if(p90Capable && picker.dataset.nativeModeSet!=="latest"){'); const end=source.indexOf(" const v=p90Capable?",start); assert(start!==-1&&end>start,"Locate actual native SonKu mode menu reconciliation"); const actualReconcile=source.slice(start,end); const renderMenu=vm.runInNewContext( '(function(picker,root,cap){ const {'+ 'p90Capable,p91p92Capable,p94Capable,p89Capable,p88Capable,p87Capable,p86Capable,'+ - 'p85Capable,p84Capable,p83Capable}=cap;\n'+ + 'p85Capable,p84Capable,p83Capable}=cap;const s={renderMode:9};\n'+ actualReconcile+'\n})',{} ); const syncMatch=source.match(/if\(picker\.value!==v\)picker\.value=v;/); @@ -24,6 +24,7 @@ const syncSelection=vm.runInNewContext( ); const optionWrites=[]; const picker={dataset:{},isOpen:false,_markup:"",_value:"music", + querySelector(){return null;},add(){}, get innerHTML(){return this._markup;}, set innerHTML(markup){ assert.equal(this.isOpen,false, @@ -49,10 +50,10 @@ const full={p90Capable:true,p91p92Capable:true,p94Capable:false,p89Capable:true, p87Capable:true,p86Capable:true,p85Capable:true,p84Capable:true, p83Capable:false}; renderMenu(picker,root,full); -assert.equal(picker.dataset.nativeModeSet,"p91p92"); +assert.equal(picker.dataset.nativeModeSet,"latest"); assert.match(picker.innerHTML,/value="external"/); -assert.match(picker.innerHTML,/P9\.1 \+ P9\.2 · MUSIC \/ BASS/); -assert.match(label.textContent,/P9\.1 \+ P9\.2 FAT/); +assert.match(picker.innerHTML,/LATEST · IMMERSIVE SPATIAL/); +assert.match(label.textContent,/SPATIAL ENGINE/); syncSelection(picker,"external"); assert.equal(picker.value,"external"); const writesAfterChoice=picker.valueWrites; @@ -73,29 +74,29 @@ assert.match(picker.innerHTML,/value="external"/); // Exactly one rebuild on a REAL capability change is allowed with popup closed. const p90Only={...full,p91p92Capable:false}; renderMenu(picker,root,p90Only); -assert.equal(picker.dataset.nativeModeSet,"p90"); -assert.equal(optionWrites.length,2); -assert.match(picker.innerHTML,/P9\.0 · TRUE EXTERNAL/); +assert.equal(picker.dataset.nativeModeSet,"latest"); +assert.equal(optionWrites.length,1); +assert.match(picker.innerHTML,/LATEST · IMMERSIVE SPATIAL/); assert.doesNotMatch(picker.innerHTML,/P9\.1 \+ P9\.2/); -assert.match(label.textContent,/P9\.0 HEADPHONE FAT/); +assert.match(label.textContent,/SPATIAL ENGINE/); picker.isOpen=true; for(let i=0;i<12;++i)renderMenu(picker,root,p90Only); picker.isOpen=false; -assert.equal(optionWrites.length,2); +assert.equal(optionWrites.length,1); const p89={...p90Only,p90Capable:false}; renderMenu(picker,root,p89); assert.equal(picker.dataset.nativeModeSet,"p89"); -assert.equal(optionWrites.length,3); +assert.equal(optionWrites.length,2); assert.doesNotMatch(picker.innerHTML,/value="external"/); for(let i=0;i<12;++i)renderMenu(picker,root,p89); -assert.equal(optionWrites.length,3); +assert.equal(optionWrites.length,2); const p88={...p89,p89Capable:false}; renderMenu(picker,root,p88); assert.equal(picker.dataset.nativeModeSet,"p88"); -assert.equal(optionWrites.length,4); +assert.equal(optionWrites.length,3); renderMenu(picker,root,full); -assert.equal(picker.dataset.nativeModeSet,"p91p92"); -assert.equal(optionWrites.length,5); +assert.equal(picker.dataset.nativeModeSet,"latest"); +assert.equal(optionWrites.length,4); // Native capability is authoritative; a UI-only version string is insufficient. const nativeSource=fs.readFileSync("src/Main.cpp","utf8"); assert.match(nativeSource,/reply->setProperty\("p91p92MusicBassFoundation",true\)/); @@ -106,18 +107,18 @@ assert.match(nativeSource,/reply->setProperty\("p94FrontBackDepthCue",true\)/); assert.match(source,/p94Capable=p91p92Capable && r\.p94FrontBackDepthCue===true;/); const p94={...full,p94Capable:true}; renderMenu(picker,root,p94); -assert.equal(picker.dataset.nativeModeSet,"p94"); -assert.equal(optionWrites.length,6); -assert.match(picker.innerHTML,/P9\.4 · FRONT\/REAR DEPTH/); -assert.match(label.textContent,/P9\.4 EXPERIMENT/); +assert.equal(picker.dataset.nativeModeSet,"latest"); +assert.equal(optionWrites.length,4); +assert.match(picker.innerHTML,/LATEST · IMMERSIVE SPATIAL/); +assert.match(label.textContent,/SPATIAL ENGINE/); // The real render() immediately sets the accepted native mode after rebuilding. syncSelection(picker,"external"); picker.isOpen=true; for(let i=0;i<40;++i){renderMenu(picker,root,p94);syncSelection(picker,"external");} picker.isOpen=false; -assert.equal(optionWrites.length,6,"P9.4 must not flicker in native readback"); +assert.equal(optionWrites.length,4,"Latest-only P9 menu must not flicker on readback"); renderMenu(picker,root,full); -assert.equal(picker.dataset.nativeModeSet,"p91p92"); -assert.equal(optionWrites.length,7); +assert.equal(picker.dataset.nativeModeSet,"latest"); +assert.equal(optionWrites.length,4); assert.doesNotMatch(picker.innerHTML,/P9\.4/); -console.log("PASS P91P92 dropdown: native capability-gated milestone, stable 40 readbacks, P9.0 fallback, correct one-time transitions"); +console.log("PASS P95 latest-only dropdown: native capability-gated milestone, stable 40 readbacks, P9.0 fallback, correct one-time transitions"); diff --git a/tests/sonku_p93_circular_gui_contract_test.cjs b/tests/sonku_p93_circular_gui_contract_test.cjs index 39401f696..7e89d1b38 100644 --- a/tests/sonku_p93_circular_gui_contract_test.cjs +++ b/tests/sonku_p93_circular_gui_contract_test.cjs @@ -34,7 +34,7 @@ const p=vm.runInNewContext("(function(){"+f+ assert.equal(Object.keys(p.factoryPresets).length,5); for(const [id,scene] of Object.entries(p.factoryPresets)){ assert.equal(scene.spatialMix,1); - assert.equal(scene.outputTrim,1); // Never multiply factory output by +7dB. + assert(scene.outputTrim>=1.5&&scene.outputTrim<=2.0); // User-selected powerful scene, bounded linked limiter. assert(scene.sourceDistanceMeters>=1.6); const max=[10,3.1,6.7,10][scene.spacePreset]; assert(scene.sourceDistanceMeters<=max); @@ -72,6 +72,8 @@ assert.match(source,/root\.querySelector\("\.sk-stage"\)\.appendChild\(root\.que assert.match(source,/head\.setPointerCapture\(e\.pointerId\)/); assert.match(source,/window\.addEventListener\("resize",constrainWindow\)/); assert.match(source,/if\(!p91p92Capable\|\|draft\.renderMode!==9\|\|!preset\|\|pending\)/); +assert.match(source,/root\.dataset\.fxState==="on"/); +assert.match(source,/if\(previous!==state\)/); assert.match(css,/\.mx-sonku \.sk-stage \.sk-space-panel\{display:grid/); assert.match(source,/current\.track\.slotBypass\[current\.slot\]/); console.log("PASS SonKu P9.3: approved perspective orbit, inverse drag, native power readback, draggable window, five full-scene presets, compact SPACE placement"); diff --git a/tests/sonku_p95_musical_presence_source_test.cpp b/tests/sonku_p95_musical_presence_source_test.cpp new file mode 100644 index 000000000..3c689c1b5 --- /dev/null +++ b/tests/sonku_p95_musical_presence_source_test.cpp @@ -0,0 +1,80 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#if defined(NDEBUG) +#undef NDEBUG +#endif +#if !defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) || !SONKU_P95_MUSICAL_PRESENCE_RESEARCH +#error P95 tests MUST use the experimental DSP, no disguised P94 baseline +#endif +#include "../engine/builtin_fx/sonku/SonKuP95MusicalPresence.h" +#include "../engine/builtin_fx/sonku/SonKuSpatialCore.h" +#include +#include +#include +#include +#include +#include +#include +using namespace armix::sonku; +static void makeupGate(double rate){ + p95::MusicalPresence p; + assert(p.prepare(rate)); + float prev=1.f; + // Over 2 seconds, candidate at half amplitude must slowly approach + // 1.65x makeup, never jump or overshoot. + for(int i=0;i<2*int(rate);++i){ + const float g=p.process(.20f,.20f,.10f,.10f); + assert(g>=1.f&&g<=1.65001f&&std::isfinite(g)); + if(i>int(rate))assert(g>=prev-1.e-5f); + prev=g; + } + assert(p.gain()>1.55f); + p.reset(); + assert(p.gain()==1.f); + // Already louder than input: NEVER pull down user gain. + for(int i=0;i<2*int(rate);++i){ + const float g=p.process(.1f,.1f,.3f,.3f); + assert(g>=1.f&&g<=1.65001f); + } + assert(std::abs(p.gain()-1.f)<.0001f); +} +static double render(int rate,float azimuth,int block){ + auto p=std::make_unique(); + assert(p->prepare(rate,SonKuReflectionProfile::SixSurfaceKemarResearch)); + Settings s{}; + s.renderMode=9;s.moving=false;s.startAzimuthDegrees=azimuth; + s.stereoSpreadDegrees=82.f;s.spatialMix=1.f; + s.outputTrim=1.9f;s.spacePreset=3;s.sourceDistanceMeters=3.1f; + s.roomAmount=1.f;s.ambience=.62f; + assert(valid(s)&&p->setSettings(s)); + constexpr float pi=3.14159265358979323846f; + const int frames=rate; + std::vector l(frames),r(frames); + for(int i=0;iprocess(l.data()+i,r.data()+i,std::min(block,frames-i)); + double energy=0.; + for(int i=frames/3;i.04 && a<.95 && std::abs(a-b)<1.e-8); + std::printf("P95_MUSIC,rate=%d,az=%.0f,rms=%.7f\n",rate,az,a); + } + } + std::puts("PASS P95 Musical Presence: slow no-pumping upward guard, user gain preserved, 44.1/48k, four directions, 64/256 PCM block parity, finite peaks"); +}