diff --git a/.github/workflows/sonku-p88-windows-field.yml b/.github/workflows/sonku-p88-windows-field.yml new file mode 100644 index 000000000..0ba8459fb --- /dev/null +++ b/.github/workflows/sonku-p88-windows-field.yml @@ -0,0 +1,314 @@ +name: SonKu P8.8 listener-height and distance native mixer portable FAT x64 +# Private JUCE app; no release. Native v9 A/B: P8.2/P8.4/P8.5/P8.6/P8.7/P8.8. +on: + pull_request: + paths: + - '.github/workflows/sonku-p88-windows-field.yml' + workflow_dispatch: +permissions: + contents: read +concurrency: + group: sonku-p88-field-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true +jobs: + preflight: + name: Isolated fast PCM and GUI preflight + runs-on: ubuntu-latest + timeout-minutes: 8 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + - name: Strict P8.4 PCM timbre and spatial source qualification + run: | + set -euo pipefail + FLAGS="-std=c++20 -O2 -Wall -Wextra -Werror -pedantic -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 -DSONKU_P72_NATIVE_XYZ_RT=1 -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 -DSONKU_P80_TRANSPARENT_BASS_RESEARCH=1 -DSONKU_P82_MULTIBAND_ROOM_RESEARCH=1 -DSONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 -DSONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1" + g++ $FLAGS tests/sonku_p84_fused_single_core_test.cpp -o /tmp/p84-native + /tmp/p84-native | tee /tmp/p84-source.log + grep -q '^PASS P84 SINGLE CORE:' /tmp/p84-source.log + g++ $FLAGS tests/sonku_p84_spatial_impulse_evidence_test.cpp -o /tmp/p84-spatial + /tmp/p84-spatial | tee /tmp/p84-spatial.log + grep -q '^PASS P84 SPATIAL SOURCE:' /tmp/p84-spatial.log + g++ $FLAGS tests/sonku_p84_live_v5_modes_source_test.cpp -o /tmp/p84-live-mode + /tmp/p84-live-mode | tee /tmp/p84-live-mode.log + grep -q '^PASS P84 V5 NATIVE SOURCE:' /tmp/p84-live-mode.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 tests/sonku_p85_world_locked_source_test.cpp -o /tmp/p85-source + /tmp/p85-source | tee /tmp/p85-source.log + grep -q '^PASS P85 WORLD LOCK:' /tmp/p85-source.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 tests/sonku_p86_horizontal_focus_native_source_test.cpp -o /tmp/p86-source + /tmp/p86-source | tee /tmp/p86-source.log + grep -q '^PASS P86 HORIZONTAL FOCUS:' /tmp/p86-source.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 -DSONKU_P87_MUSIC_BODY_RESEARCH=1 tests/sonku_p87_musical_air_body_source_test.cpp -o /tmp/p87-source + /tmp/p87-source | tee /tmp/p87-source.log + grep -q '^PASS P87 MUSICAL AIR BODY:' /tmp/p87-source.log + g++ $FLAGS -DSONKU_P85_WORLD_COHERENCE_RESEARCH=1 -DSONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 -DSONKU_P87_MUSIC_BODY_RESEARCH=1 -DSONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1 tests/sonku_p88_height_distance_source_test.cpp -o /tmp/p88-source + /tmp/p88-source | tee /tmp/p88-source.log + grep -q '^PASS P88 HEIGHT DISTANCE:' /tmp/p88-source.log + - name: Native JS and source GUI capability checks + run: | + set -euo pipefail + node --check site/preview-v2/assets/mixer-native-sonku.js + python - <<'PY' + import re + from pathlib import Path + for path in ("engine/builtin_fx/SonKuSpatialProcessor.h", + "engine/builtin_fx/sonku/SonKuSpatialCore.h"): + depth=0 + for line in Path(path).read_text().splitlines(): + if re.match(r'^\s*#\s*(?:if|ifdef|ifndef)\b',line): + depth+=1 + elif re.match(r'^\s*#\s*endif\b',line): + depth-=1 + assert depth>=0,(path,"excess endif") + assert depth==0,(path,"missing endif",depth) + print("P88_NATIVE_HEADER_PREPROCESSOR_BALANCED") + PY + grep -q 'r.schemaVersion===9' site/preview-v2/assets/mixer-native-sonku.js + grep -q 'skHrtfAlign' site/preview-v2/assets/mixer-native-sonku.js + node tests/sonku_p73_gui_contract_test.js + grep -q "'FIELD_PREVIEW_FULL_CTEST_NOT_RUN'" scripts/m3e_fat_evidence_gate.mjs + python -m unittest discover -s tests -p native_peq_assembly_test.py + - name: 44.1 and 48 kHz prepared PCM source regression + run: | + set -euo pipefail + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + tests/sonku_p72_realtime_xyz_test.cpp -o /tmp/sonku-p75-pcm + /tmp/sonku-p75-pcm + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + tests/sonku_p75_stereo_integrity_test.cpp -o /tmp/sonku-p75-music + /tmp/sonku-p75-music + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + -DSONKU_P80_TRANSPARENT_BASS_RESEARCH=1 \ + tests/sonku_p80_tonal_room_evidence_test.cpp -o /tmp/sonku-p80-evidence + /tmp/sonku-p80-evidence | tee /tmp/sonku-p80-acoustic-evidence.csv + grep -q '^PASS P8:' /tmp/sonku-p80-acoustic-evidence.csv + g++ -std=c++20 -O2 -Wall -Wextra -Werror -pedantic \ + -DSONKU_P7_MEASURED_ELEVATION_RESEARCH=1 \ + -DSONKU_P71_DIRECT_XYZ_RESEARCH=1 \ + -DSONKU_P72_NATIVE_XYZ_RT=1 \ + -DSONKU_P75_MUSIC_SAFE_RESEARCH=1 \ + -DSONKU_P80_TRANSPARENT_BASS_RESEARCH=1 \ + -DSONKU_P82_MULTIBAND_ROOM_RESEARCH=1 \ + tests/sonku_p82_sixsurface_multiband_room_test.cpp -o /tmp/sonku-p82-room + /tmp/sonku-p82-room | tee /tmp/sonku-p82-room-evidence.csv + grep -q '^PASS P8.2:' /tmp/sonku-p82-room-evidence.csv + windows-field: + name: Actual full Windows JUCE executable and verified portable field ZIP + needs: preflight + runs-on: windows-2022 + timeout-minutes: 55 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + persist-credentials: false + - name: Verify immutable PR head and physical candidate identity + shell: pwsh + env: + EXPECTED_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + run: | + $actual = (& git rev-parse HEAD).Trim() + if ($LASTEXITCODE -ne 0 -or $actual -ne $env:EXPECTED_SHA -or $actual -notmatch '^[0-9a-f]{40}$') { + throw "SONKU_P83_SOURCE_MISMATCH:$actual" + } + Write-Host "SONKU_P84_EXACT_SOURCE=$actual" + - uses: actions/checkout@v4 + with: + repository: juce-framework/JUCE + ref: 8.0.15 + path: third_party/JUCE + persist-credentials: false + - name: Obtain pinned WebView2 compilation SDK + shell: pwsh + run: | + nuget install Microsoft.Web.WebView2 -Version 1.0.3485.44 -OutputDirectory .deps -NonInteractive + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Configure full native app with research XYZ explicit ON + shell: pwsh + run: | + 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" ` + -DARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_MUSIC_SAFE=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P82_ROOM=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=ON ` + -DARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=ON ` + -DBUILD_TESTING=ON + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $cache = Get-Content -LiteralPath build/CMakeCache.txt -Raw + if ($cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_MUSIC_SAFE:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P8_TRANSPARENT_BASS:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P82_ROOM:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT:BOOL=ON' -or + $cache -notmatch 'ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT:BOOL=ON') { + throw "SONKU_P83_RESEARCH_NOT_ENABLED" + } + $tests = (& ctest --test-dir build -C Release --show-only=json-v1 | Out-String | ConvertFrom-Json) + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $required = @('NativeSonKuP72AtomicXyzLiveEditSource', + 'NativeSonKuP72JuceV3XyzLiveAckV1V2Restore', + 'NativeSonKuSessionV1V2AndAudioAppliedAck', + 'NativeSonKuP75MusicStereoPhaseNoNullAndChunkParity', + 'NativeSonKuP80TransparentBassStereoPhaseAndRoomDiagnostic', + 'NativeSonKuP82SixWallThreeBandRoomTimingDecayAndParity', + 'NativeSonKuP83RealtimeModeSourceAndMusicIntegrity', + 'NativeSonKuP83JuceV4AudioAckLegacyRestoreAndHeadYaw', + 'NativeSonKuP84SingleCoreMusicFidelityAndWorldYaw', + 'NativeSonKuP84JuceV5AudioAckLegacySafeRestore', + 'NativeSonKuP85WorldCoherentMidYawSourceAndFidelity', + 'NativeSonKuP85JuceV6AudioAckLegacySafeRestore', + 'NativeSonKuP86SixWallHorizontalFocusAndMusicIntegrity', + 'NativeSonKuP86JuceV7AudioAckAndV6Restore', + 'NativeSonKuP87MusicalAirBodyP86DryParityAndFdnBass', + 'NativeSonKuP87JuceV8AudioAppliedAckV7Restore', + 'NativeSonKuP88MeasuredEarHeightAndDistanceDrr', + 'NativeSonKuP88JuceV9AppliedAckAndV8Restore') + $available = @($tests.tests | ForEach-Object { $_.name }) + foreach ($test in $required) { + if ($test -notin $available) { throw "SONKU_P82_MISSING_CTEST:$test" } + } + - name: Fail fast — compile and execute real JUCE v5 state + PCM ACK first + shell: pwsh + run: | + cmake --build build --config Release --parallel 2 --target ARMixSonKuP88NativeTests + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + ctest --test-dir build -C Release --output-on-failure -R '^NativeSonKuP88JuceV9AppliedAckAndV8Restore$' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Compile actual ARMixConsole Windows GUI and focused real JUCE tests + shell: pwsh + run: | + cmake --build build --config Release --parallel 2 --target ` + ARMixConsole ARMixSonKuP72SourceTests ARMixSonKuP72NativeTests ARMixSonKuNativeStateTests ARMixSonKuP75MusicIntegrityTests ARMixSonKuP80TonalEvidenceTests ARMixSonKuP82RoomTests ARMixSonKuP83LiveSourceTests ARMixSonKuP83NativeTests ARMixSonKuP84LiveSourceTests ARMixSonKuP84NativeTests ARMixSonKuP85WorldSourceTests ARMixSonKuP85NativeTests ARMixSonKuP86FocusSourceTests ARMixSonKuP86NativeTests ARMixSonKuP87MusicSourceTests ARMixSonKuP87NativeTests ARMixSonKuP88SourceTests ARMixSonKuP88NativeTests + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $exe = 'build/ARMixConsole_artefacts/Release/AR MIX Studio.exe' + if (-not (Test-Path -LiteralPath $exe -PathType Leaf)) { throw "SONKU_P83_NO_GUI_EXE" } + if ((Get-Item -LiteralPath $exe).Length -lt 4MB) { throw "SONKU_P83_WRONG_GUI_TARGET" } + - name: Scoped native XYZ state, callback ACK and legacy restoration + shell: pwsh + run: | + ctest --test-dir build -C Release --output-on-failure ` + -R '^NativeSonKu(P72AtomicXyzLiveEditSource|P72JuceV3XyzLiveAckV1V2Restore|SessionV1V2AndAudioAppliedAck|P75MusicStereoPhaseNoNullAndChunkParity|P80TransparentBassStereoPhaseAndRoomDiagnostic|P82SixWallThreeBandRoomTimingDecayAndParity|P83RealtimeModeSourceAndMusicIntegrity|P83JuceV4AudioAckLegacyRestoreAndHeadYaw|P84SingleCoreMusicFidelityAndWorldYaw|P84JuceV5AudioAckLegacySafeRestore|P85WorldCoherentMidYawSourceAndFidelity|P85JuceV6AudioAckLegacySafeRestore|P86SixWallHorizontalFocusAndMusicIntegrity|P86JuceV7AudioAckAndV6Restore|P87MusicalAirBodyP86DryParityAndFdnBass|P87JuceV8AudioAppliedAckV7Restore|P88MeasuredEarHeightAndDistanceDrr|P88JuceV9AppliedAckAndV8Restore)$' + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Package real native portable mixer, never an installer + shell: pwsh + run: | + & ./scripts/package_native_windows.ps1 -BuildDir build -OutputDir dist + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + python scripts/factoryfx_release_bundle.py stage --lock config/factoryfx-approved-releases.json --output dist --best-effort + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + - name: Record exact experiment and physical qualification pending + shell: pwsh + run: | + $path = 'dist/BUILD_PROVENANCE.json' + $p = Get-Content -LiteralPath $path -Raw -Encoding utf8 | ConvertFrom-Json + $sha = (& git rev-parse HEAD).Trim() + if ($p.sourceCommit -ne $sha) { throw "SONKU_P83_ARTIFACT_SHA_MISMATCH" } + $p.fatStatus = 'FIELD_PREVIEW_FULL_CTEST_NOT_RUN' + $p | Add-Member -NotePropertyName sonkuExperiment -NotePropertyValue @{ + enabled = $true + nativeXYZ = $true + musicSafeStereo = $true + p8TransparentBass = $true + p82MultibandRoom = $true + p83NativeSpeakers = $false + p84FusedNative = $true + p85WorldLockedMid = $true + p86HorizontalFocus = $true + p87MusicalAirBody = $true + p88PerceptualAlignment = $true + p84RenderModes = @('MusicBedP82','MusicSpatialP84','MusicSpatialP85','MusicSpatialP86','MusicSpatialP87','MusicSpatialP88') + p83HeadYaw = 'DETERMINISTIC_MANUAL_NO_SENSOR' + p84FusionDifferenceHighpassHz = 750 + p84MeasuredHrirContrast = 0.12 + legacyP83V4Migration = 'OLD_SPEAKER_TO_P82' + p83AudioAppliedAck = $true + p83RealtimeModeCrossfade = '12ms_OUT_AND_IN_NATIVE_SINGLE_PCM_GRAPH' + p82RoomBandsHz = @(250,4800) + p82MaterialCalibration = 'ORIGINAL_ILLUSTRATIVE_NOT_MEASURED_RIR' + p82Rt60StudioSeconds = @(0.717,0.392,0.231) + p82Rt60ChamberSeconds = @(0.933,0.802,0.483) + p82Rt60HallSeconds = @(1.716,1.219,0.650) + p8LowBandCrossoverHz = 220 + musicSafeAlgorithm = 'MEASURED_CENTER_MID_PLUS_UNCONDITIONAL_STEREO_SIDE_RESEARCH' + stateSchema = 9 + fullWindowsExecutable = $true + publicRelease = $false + physicalAsioQualified = $false + dearVrPerceptualParityProven = $false + qualification = 'SONKU_P88_SCOPED_NATIVE_PCM_JUCE_18_CTESTS_HEADPHONE_FAT_PENDING' + licenseRedistributionApproval = $false + mitKemarNoticeSha256 = (Get-FileHash -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Algorithm SHA256).Hash.ToLowerInvariant() + fieldFatGuideSha256 = (Get-FileHash -LiteralPath docs/SONKU_P88_PERCEPTUAL_HEIGHT_DISTANCE_20261115.md -Algorithm SHA256).Hash.ToLowerInvariant() + } -Force + $p | ConvertTo-Json -Depth 20 | Set-Content -LiteralPath $path -Encoding utf8 + - name: Independent GUI PE, approved resources, provenance and ZIP verification + shell: pwsh + run: | + & ./scripts/verify_native_windows_artifact.ps1 -OutputDir dist + if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $p = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json + if (-not $p.sonkuExperiment.enabled -or + -not $p.sonkuExperiment.musicSafeStereo -or + -not $p.sonkuExperiment.p8TransparentBass -or + -not $p.sonkuExperiment.p82MultibandRoom -or + -not $p.sonkuExperiment.p84FusedNative -or + -not $p.sonkuExperiment.p85WorldLockedMid -or + -not $p.sonkuExperiment.p86HorizontalFocus -or + -not $p.sonkuExperiment.p87MusicalAirBody -or + -not $p.sonkuExperiment.p88PerceptualAlignment -or + $p.sonkuExperiment.stateSchema -ne 9 -or $p.sonkuExperiment.publicRelease) { + throw 'SONKU_P88_WRONG_FIELD_ARTIFACT' + } + - name: Include mandatory MIT KEMAR notice and physical FAT guide + shell: pwsh + run: | + # Standard distribution allowlist was verified above. Field-only notice. + Copy-Item -LiteralPath docs/THIRD_PARTY_8D_SONKU_HRTF.md -Destination dist/THIRD_PARTY_8D_SONKU_HRTF.md + Copy-Item -LiteralPath docs/SONKU_P88_PERCEPTUAL_HEIGHT_DISTANCE_20261115.md -Destination dist/SONKU_P88_FIELD_FAT.md + $p = Get-Content -LiteralPath dist/BUILD_PROVENANCE.json -Raw | ConvertFrom-Json + $checks = @{ + 'THIRD_PARTY_8D_SONKU_HRTF.md' = [string]$p.sonkuExperiment.mitKemarNoticeSha256 + 'SONKU_P88_FIELD_FAT.md' = [string]$p.sonkuExperiment.fieldFatGuideSha256 + } + foreach ($item in $checks.GetEnumerator()) { + $file = Join-Path dist $item.Key + if ($item.Value -notmatch '^[0-9a-f]{64}$' -or + -not (Test-Path -LiteralPath $file -PathType Leaf)) { + throw "SONKU_P83_FIELD_NOTICE_MISSING:$($item.Key)" + } + $actual = (Get-FileHash -LiteralPath $file -Algorithm SHA256).Hash.ToLowerInvariant() + if ($actual -ne $item.Value) { throw "SONKU_P83_FIELD_NOTICE_HASH_MISMATCH:$($item.Key)" } + } + if (Test-Path -LiteralPath dist/Studio) { throw 'SONKU_FIELD_USER_DATA_MUST_NOT_SHIP' } + Write-Host 'SONKU_P88_FIELD_READY: GUI EXE + verified MIT notice + FAT guide' + - uses: actions/upload-artifact@v4 + name: Upload isolated SonKu Windows x64 field candidate + with: + name: ArSonMix-SonKu-P88-Height-Distance-Windows-x64-${{ github.run_id }} + path: dist/ + if-no-files-found: error + retention-days: 21 + compression-level: 0 diff --git a/CMakeLists.txt b/CMakeLists.txt index b63ab361c..1c8d10566 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -74,6 +74,13 @@ if(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT AND NOT ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) message(FATAL_ERROR "P8.7 music body requires P8.6 horizontal focus research") endif() +# Listener-calibrated HRTF elevation independent of physical source XYZ. +option(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + "Private P8.8 HRTF vertical alignment and source distance research" OFF) +if(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT AND + NOT ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) + message(FATAL_ERROR "P8.8 needs private P8.7 music-body research") +endif() set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -284,7 +291,9 @@ target_compile_definitions(ARMixConsole PRIVATE $<$:ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=1> $<$:SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1> $<$:ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=1> - $<$:SONKU_P87_MUSIC_BODY_RESEARCH=1>) + $<$:SONKU_P87_MUSIC_BODY_RESEARCH=1> + $<$:ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=1> + $<$:SONKU_P88_PERCEPTUAL_ALIGNMENT_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. @@ -645,6 +654,55 @@ if(BUILD_TESTING) SONKU_P87_MUSIC_BODY_RESEARCH=1) add_test(NAME NativeSonKuP87JuceV8AudioAppliedAckV7Restore COMMAND ARMixSonKuP87NativeTests) + if(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) + add_executable(ARMixSonKuP88SourceTests + tests/sonku_p88_height_distance_source_test.cpp) + target_compile_features(ARMixSonKuP88SourceTests PRIVATE cxx_std_20) + target_compile_definitions(ARMixSonKuP88SourceTests PRIVATE + SONKU_P7_MEASURED_ELEVATION_RESEARCH=1 + SONKU_P71_DIRECT_XYZ_RESEARCH=1 + SONKU_P72_NATIVE_XYZ_RT=1 + SONKU_P75_MUSIC_SAFE_RESEARCH=1 + SONKU_P80_TRANSPARENT_BASS_RESEARCH=1 + SONKU_P82_MULTIBAND_ROOM_RESEARCH=1 + SONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 + SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1 + SONKU_P85_WORLD_COHERENCE_RESEARCH=1 + SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 + SONKU_P87_MUSIC_BODY_RESEARCH=1 + SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1) + add_test(NAME NativeSonKuP88MeasuredEarHeightAndDistanceDrr + COMMAND ARMixSonKuP88SourceTests) + juce_add_console_app(ARMixSonKuP88NativeTests + PRODUCT_NAME "ArSonMix SonKu P88 JUCE v9 State Tests") + target_sources(ARMixSonKuP88NativeTests PRIVATE + tests/sonku_p88_native_juce_v9_test.cpp) + target_compile_features(ARMixSonKuP88NativeTests PRIVATE cxx_std_20) + target_link_libraries(ARMixSonKuP88NativeTests PRIVATE + juce::juce_audio_processors juce::juce_recommended_config_flags) + target_compile_definitions(ARMixSonKuP88NativeTests PRIVATE + ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P84_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT=1 + ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT=1 + SONKU_P7_MEASURED_ELEVATION_RESEARCH=1 + SONKU_P71_DIRECT_XYZ_RESEARCH=1 + SONKU_P72_NATIVE_XYZ_RT=1 + SONKU_P75_MUSIC_SAFE_RESEARCH=1 + SONKU_P80_TRANSPARENT_BASS_RESEARCH=1 + SONKU_P82_MULTIBAND_ROOM_RESEARCH=1 + SONKU_P83_PHYSICAL_SPEAKER_RESEARCH=1 + SONKU_P84_SINGLE_CORE_FUSION_RESEARCH=1 + SONKU_P85_WORLD_COHERENCE_RESEARCH=1 + SONKU_P86_HORIZONTAL_FOCUS_RESEARCH=1 + SONKU_P87_MUSIC_BODY_RESEARCH=1 + SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH=1) + add_test(NAME NativeSonKuP88JuceV9AppliedAckAndV8Restore + COMMAND ARMixSonKuP88NativeTests) + endif() endif() endif() endif() diff --git a/docs/SONKU_P88_PERCEPTUAL_HEIGHT_DISTANCE_20261115.md b/docs/SONKU_P88_PERCEPTUAL_HEIGHT_DISTANCE_20261115.md new file mode 100644 index 000000000..c1f3edb01 --- /dev/null +++ b/docs/SONKU_P88_PERCEPTUAL_HEIGHT_DISTANCE_20261115.md @@ -0,0 +1,36 @@ +# SonKu P8.8 — Perceptual Ear Height Calibration and True Distance Cues +Private headphone FAT, 2026-11-15. **No merge to main, no public release.** + +## Owner report (screenshot + ears) + +P8.7, 28.8m LARGE, 7.3m source distance, **-7.4° physical elevation**, 100% early reflections, 100% reverb, yaw 0°, 24° speaker angle (orbit may be ON), 100% spatial, +2.5dB output: still near and consistently above ear/head. Moving physical elevation slightly down helped a bit, not enough. P8.6 speaker was more focused; P8.7 added air/bass; preserve both. Not a request to automatically reset controls. + +## Exact source proof + +1. Source geometry uses `sourceHeight = earHeight 1.45m + distance*sin(elevation)`. At 7.3m / -7.4°, **source height ≈0.51m, only 1cm above allowed room floor safety boundary**. More negative physical elevation is not physically possible in that room. The physical Z projection is correctly signed; native measured 3D HRIR interpolation is actually invoked when elevation is nonzero. +2. The KEMAR HRIR bank is **generic, not individualized**. Correct physical 0/-7.4° can be *perceived* as too high for a particular listener/headphone. Spectral peaks/notches from pinna and headphone transfer determine vertical perception, not ILD/ITD alone. Objective HRIR horizontal calibration cannot prove subjective height. +3. P8.7 deliberately uses `targetDirectDistance=1/(1+0.13*(r-1.6))` to preserve direct musical clarity. At 7.3m this gives ≈0.574 (~-4.8dB), while physical inverse-distance 1.6/7.3≈0.219 (~-13.2dB). The deliberately strong direct component can produce proximity despite distant UI setting. More importantly, original transparent stereo music LF is returned with **zero source-distance attenuation** even with ROOM ON. A distant high-band HRTF with an invariant headphone LF can feel near/in-head. +4. The room's horizontal four-wall, suppressed floor/ceiling and P8.7 direct air/FDN music-body are not broken by simply moving SOURCE ELEVATION. A 100% reverb user setting can mask direction, but automatically lowering it would rewrite the owner's scene and defeat A/B. + +## External literature, not copied code + +- Wang et al., Applied Acoustics (2025): spectral contrast and notches alter median-plane height localization, with up/down confusions in dynamic HRTF render: https://www.sciencedirect.com/science/article/pii/S0003682X24005759 . +- Auditory localization practical review (2024): generic HRTFs lead to elevation and externalization errors: https://pmc.ncbi.nlm.nih.gov/articles/PMC11267622/ . +- Hassager et al. pinna filtering: direct vs reflected spectral features and ear coherence matter for externalization: https://doi.org/10.1016/j.apacoust.2020.107257 . +- 2026 frontal BRIR study: DRR, spatial reflection level/direction and head rotation together contribute to externalization, not overall wet level alone: https://pmc.ncbi.nlm.nih.gov/articles/PMC13451706/ . + +## P8.8 experiment — explicit opt-in mode 7 + +- Separate **SOURCE ELEVATION (physical XYZ)** from **EAR HEIGHT ALIGN · HRTF (perceptual KEMAR spectral lookup)**. The new trim is -30° .. +20° with default 0° and a combined measured lookup limited to -40° .. 60°. A trim of -12° at physical 0° gives the exact same direct KEMAR FIR as physical -12° with trim 0 in P8.7, **without lowering speaker geometry, floor reflection image, direct geometric distance or listener position**. This is user calibration, **not** an automatic guaranteed perceptual fix. +- Moderate P8.8-only source-distance law for direct high-band: `1/(1+0.27*(r-1.6))` = 0.394 at 7.3m (~-8.1 dB). Unlike P8.7 ~0.574, spatial direct is ~3.3 dB further back. No newly amplified six-wall ER, no diffuse reverb gain increase, no 1/r hard attenuation. +- Gentle P8.8-only distance effect on original stereo LF: `1/(1+0.10*(r-1.6))` = 0.637 at 7.3m, retaining musical low-body while removing old invariant head-locked LF near cue. The P8.7 existing FDN LF room-body and direct-air stay in place unchanged. +- Keep world/head yaw, MID/SIDE, fused two direct FIRs, four horizontal reflection pressures, floor 24%, ceiling 15%, ER 76%, tail 38%, P8.7 +1.9dB bounded direct air shelf, late LF body and all user controls. No extra FIR, audio callback, samples, heap or locks. +- **Mode 7, native schema v9**, readback/typed ACK. One new 4-byte float appended to old 59-byte state, total **63 bytes**. v1..v8 old sessions retain mode and do not acquire perceptual trim. The rejected P8.3 modes 1/2 remain blocked. The trim is inactive in legacy modes even if saved in a P8.8 session. Public default build flag `ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT` is OFF. + +## Qualification + +- Native core tests at 44.1/48k: P8.8 ROOM OFF trim0 exactly P8.7 at azimuth 0/90/180 and yaw 0/60/180 for correlated + anti-phase, 64/128 parity. P8.8 physical0 trim-12 has **bit-exact direct ROOM OFF PCM** versus P8.7 physical-12 trim0; physical source heights must differ. +- 7.3m LARGE no wet: P8.8 farther direct and LF pressure than P8.7, finite peak/output. User 100% ER/reverb wet tests at effective elevations -20,-10,0,+10, same 64/128. +- Real JUCE v9 test: native audio-applied ACK, 63-byte state and v8 P8.7 mode6 no-trim restoration; v7 P8.6 mode5, v6 P8.5 mode4, v5 P8.4 mode3; forbidden P8.3. Check GUI capability tied to native v9 and approved embedded Pages resources. Linux source tests **do not replace** native Windows/ASIO/headphone FAT. +- Listening: choose **STATIC not ORBIT** to establish direction, speaker angle ~60° and azimuth FRONT; SOURCE ELEVATION **0° (physical ear height)**, EAR HEIGHT ALIGN trim **0°, -5°, -10°, -15°, -20°** A/B. Set distance 1.6/3/7.3m. Compare ROOM OFF first (vertical HRTF) then LARGE reverb 25/47/100% (DRR and floor/ceiling impression). Then rotate yaw ±60/90/180 and world speaker azimuth. Compare P8.7 with P8.8 trim0 and matched loudness. If none of the generic KEMAR spectral positions reproduces ear-level localization, **do not keep blindly shifting downward**: next valid step is individualized HRTF/headphone EQ calibration or alternate public HRIR subjects. +- This is a **controlled headphone FAT candidate**. A more negative HRTF lookup does NOT guarantee perceptually lower sound for every user and may alter timbre or front/back accuracy. Do not call P8.8 a qualified fix, dearVR match or measured personal HRTF. diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h index 4d90e08b7..0d467bd90 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -161,7 +161,11 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, #if defined(ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P85_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P86_NATIVE_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + out.writeInt(9); // v8 59-byte state + 4-byte HRTF trim +#else out.writeInt(8); // same 59-byte layout; modes 0/3/4/5/6 +#endif #else out.writeInt(7); // 59-byte layout; mode 5, old sessions intact #endif @@ -198,13 +202,20 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, out.writeInt(accepted_.renderMode); out.writeByte(accepted_.musicCompatibleLowFrequency?1:0); out.writeFloat(accepted_.headYawDegrees); +#endif +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + out.writeFloat(accepted_.hrtfElevationTrimDegrees); #endif } bool restoreUnpublishedState(const void* data,int size) { if(published_||!data|| #if defined(ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT) && ARMIX_SONKU_EXPERIMENTAL_NATIVE_XYZ_RT #if defined(ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P83_NATIVE_RT +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + (size!=30&&size!=46&&size!=50&&size!=59&&size!=63)|| +#else (size!=30&&size!=46&&size!=50&&size!=59)|| +#endif #else (size!=30&&size!=46&&size!=50)|| #endif @@ -228,6 +239,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, &&version!=7 #if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT &&version!=8 +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + &&version!=9 +#endif #endif #endif #endif @@ -247,6 +261,9 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, ||(version==7&&size!=59) #if defined(ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P87_NATIVE_RT ||(version==8&&size!=59) +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + ||(version==9&&size!=63) +#endif #endif #endif #endif @@ -317,11 +334,18 @@ class SonKuSpatialProcessor final : public juce::AudioProcessor, if(version==8 && next.renderMode!=0 && next.renderMode!=3 && next.renderMode!=4 && next.renderMode!=5 && next.renderMode!=6)return false; if(version==8 && next.musicCompatibleLowFrequency)return false; +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + if(version==9 && next.renderMode!=0 && next.renderMode!=3 && next.renderMode!=4 && next.renderMode!=5 && next.renderMode!=6 && next.renderMode!=7)return false; + if(version==9 && next.musicCompatibleLowFrequency)return false; +#endif #endif #endif #endif #endif } +#endif +#if defined(ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT) && ARMIX_SONKU_EXPERIMENTAL_P88_NATIVE_RT + if(version>=9)next.hrtfElevationTrimDegrees=in.readFloat(); #endif // v1 OFF, v2 original scene; experimental v3 includes direct // elevation, and is rejected by ordinary public v2 builds. diff --git a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h index 24eae3a90..b4cd1be1d 100644 --- a/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h +++ b/engine/builtin_fx/sonku/SonKuP83SpeakerScene.h @@ -16,6 +16,9 @@ enum class Mode : std::uint8_t { ,MusicSpatialP86=5 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH ,MusicSpatialP87=6 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + ,MusicSpatialP88=7 +#endif #endif #endif #endif @@ -33,6 +36,9 @@ inline bool valid(Mode m) noexcept { || m==Mode::MusicSpatialP86 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH || m==Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + || m==Mode::MusicSpatialP88 +#endif #endif #endif #endif diff --git a/engine/builtin_fx/sonku/SonKuSpatialCore.h b/engine/builtin_fx/sonku/SonKuSpatialCore.h index 675d2c1c1..774a92285 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -72,6 +72,9 @@ struct Settings { int renderMode = 0; bool musicCompatibleLowFrequency = false; float headYawDegrees = 0.f; // deterministic world/head separation +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + float hrtfElevationTrimDegrees=0.f; // spectral only, never room XYZ +#endif #endif }; inline bool valid(const Settings& s) noexcept { @@ -94,7 +97,11 @@ inline bool valid(const Settings& s) noexcept { #if defined(SONKU_P85_WORLD_COHERENCE_RESEARCH) && SONKU_P85_WORLD_COHERENCE_RESEARCH #if defined(SONKU_P86_HORIZONTAL_FOCUS_RESEARCH) && SONKU_P86_HORIZONTAL_FOCUS_RESEARCH #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + s.renderMode<=7 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5 && s.renderMode!=6 && s.renderMode!=7) || !s.musicCompatibleLowFrequency) && +#else s.renderMode<=6 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5 && s.renderMode!=6) || !s.musicCompatibleLowFrequency) && +#endif #else s.renderMode<=5 && ((s.renderMode!=3 && s.renderMode!=4 && s.renderMode!=5) || !s.musicCompatibleLowFrequency) && #endif @@ -106,6 +113,12 @@ inline bool valid(const Settings& s) noexcept { #endif #else s.renderMode<=2 && +#endif +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + std::isfinite(s.hrtfElevationTrimDegrees) && + s.hrtfElevationTrimDegrees>=-30.f && s.hrtfElevationTrimDegrees<=20.f && + (s.renderMode!=7 || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40.f && + s.directElevationDegrees+s.hrtfElevationTrimDegrees<=60.f)) && #endif p83::validYaw(s.headYawDegrees) && (s.renderMode!=2 || (s.stereoSpreadDegrees>=20.f && @@ -206,6 +219,9 @@ class SonKuSpatialCore final { smoothedMix_=settings_.spatialMix; smoothedTrim_=settings_.outputTrim; smoothedDistanceGain_=1.f; +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + smoothedBassDistance_=1.f; +#endif smoothedRoomLevel_=1.f; smoothedBassShelf_=0.f; smoothedErPresence_=1.f; @@ -456,6 +472,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP86 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + && p83Mode_!=p83::Mode::MusicSpatialP88 +#endif #endif #endif #endif @@ -492,6 +511,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP86 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP88 +#endif #endif #endif #endif @@ -504,19 +526,43 @@ class SonKuSpatialCore final { const bool horizontalFocus=p83Mode_==p83::Mode::MusicSpatialP86 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP88 +#endif #endif ; #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH - const bool musicalBody=p83Mode_==p83::Mode::MusicSpatialP87; + const bool musicalBody=p83Mode_==p83::Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP88 +#endif + ; #endif #endif // Deliberate music-monitor compensation: real distance perception // still comes from direct/reflected ratio and high-frequency cues, // while the direct field is not attenuated by the full physical 1/r. // 1.6m=1; 8m~0.55 instead of 0.20. No pow/exp on the PCM callback. + // P8.8: meaningful source-distance cue at 7+ m, no huge diffuse tail. const float targetDistance=roomEnabled? - 1.f/(1.f+0.13f*(settings_.sourceDistanceMeters-1.6f)):1.f; + 1.f/(1.f+ +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + (p83Mode_==p83::Mode::MusicSpatialP88?0.27f:0.13f)* +#else + 0.13f* +#endif + (settings_.sourceDistanceMeters-1.6f)):1.f; + // Original low-frequency direct return ignored distance; P8.8 + // attenuates it gently while preserving stereo LF weight. +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + const float targetBassDistance=roomEnabled&& + p83Mode_==p83::Mode::MusicSpatialP88? + 1.f/(1.f+0.10f*(settings_.sourceDistanceMeters-1.6f)):1.f; +#endif for(int i=0;i(azimuth), - researchElevationDegrees_, + spectralElevation, std::abs(sampleRate_-44100.)<=.1,destination); return; } @@ -836,6 +899,9 @@ class SonKuSpatialCore final { && p83Mode_!=p83::Mode::MusicSpatialP86 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH && p83Mode_!=p83::Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + && p83Mode_!=p83::Mode::MusicSpatialP88 +#endif #endif #endif #endif @@ -868,6 +934,9 @@ class SonKuSpatialCore final { p83Mode_==p83::Mode::MusicSpatialP86 || #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH p83Mode_==p83::Mode::MusicSpatialP87 || +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + p83Mode_==p83::Mode::MusicSpatialP88 || +#endif #endif #endif #endif @@ -887,6 +956,9 @@ class SonKuSpatialCore final { || p83Mode_==p83::Mode::MusicSpatialP86 #if defined(SONKU_P87_MUSIC_BODY_RESEARCH) && SONKU_P87_MUSIC_BODY_RESEARCH || p83Mode_==p83::Mode::MusicSpatialP87 +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + || p83Mode_==p83::Mode::MusicSpatialP88 +#endif #endif #endif )?static_cast(p83::toHead(static_cast(degrees_),p83HeadYaw_)) @@ -960,6 +1032,9 @@ class SonKuSpatialCore final { SonKuMusicalReverb reverb_{}; SonKuStereoIntegrity integrity_{}; float smoothedMix_=1.f,smoothedTrim_=0.75f; +#if defined(SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH) && SONKU_P88_PERCEPTUAL_ALIGNMENT_RESEARCH + float smoothedBassDistance_=1.f; +#endif float smoothedDistanceGain_=1.f,smoothedRoomLevel_=1.f; float smoothedBassShelf_=0.f,limiterGain_=1.f; float smoothedErPresence_=1.f,smoothedTailPresence_=1.f; diff --git a/site/preview-v2/assets/mixer-native-sonku.js b/site/preview-v2/assets/mixer-native-sonku.js index 7901d7343..3ba04ab29 100644 --- a/site/preview-v2/assets/mixer-native-sonku.js +++ b/site/preview-v2/assets/mixer-native-sonku.js @@ -14,8 +14,9 @@ const elevationLimits=s=>{ const distance=s.sourceDistanceMeters; const height=roomHeights[s.spacePreset]; if(!Number.isFinite(distance)||!height)return {min:0,max:0}; - const bottom=Math.max(-40,Math.asin(Math.max(-1,Math.min(1,(.5-1.45)/distance)))*180/Math.PI); - const top=Math.min(60,Math.asin(Math.max(-1,Math.min(1,(height-.5-1.45)/distance)))*180/Math.PI); + const spectralOffset=s.renderMode===7?(s.hrtfElevationTrimDegrees??0):0; + const bottom=Math.max(-40-spectralOffset,Math.asin(Math.max(-1,Math.min(1,(.5-1.45)/distance)))*180/Math.PI); + const top=Math.min(60-spectralOffset,Math.asin(Math.max(-1,Math.min(1,(height-.5-1.45)/distance)))*180/Math.PI); // Keep a 0.1 degree safety margin for C++ float boundary rounding. return {min:Math.ceil((bottom+0.001)*10)/10, max:Math.floor((top-0.001)*10)/10}; @@ -53,8 +54,13 @@ const valid=s=>s && Number.isFinite(s.startAzimuthDegrees) && 1.45+s.sourceDistanceMeters*Math.sin(s.directElevationDegrees*Math.PI/180)<= roomHeights[s.spacePreset]-.5)) && (s.renderMode===undefined || ( - Number.isInteger(s.renderMode)&&s.renderMode>=0&&s.renderMode<=6 && + Number.isInteger(s.renderMode)&&s.renderMode>=0&&s.renderMode<=7 && typeof s.musicCompatibleLowFrequency==="boolean" && + (s.hrtfElevationTrimDegrees===undefined || ( + Number.isFinite(s.hrtfElevationTrimDegrees) && + s.hrtfElevationTrimDegrees>=-30 && s.hrtfElevationTrimDegrees<=20 && + (s.renderMode!==7 || (s.directElevationDegrees+s.hrtfElevationTrimDegrees>=-40 && + s.directElevationDegrees+s.hrtfElevationTrimDegrees<=60)))) && Number.isFinite(s.headYawDegrees)&&Math.abs(s.headYawDegrees)<=360 && (s.renderMode!==2 || (s.stereoSpreadDegrees>=20&&s.stereoSpreadDegrees<=120)))); const backend=()=>window.__JUCE__?.backend; @@ -170,6 +176,8 @@ root.innerHTML=[ '', '', + '', '', '