diff --git a/.github/workflows/imersip-p92-single-engine.yml b/.github/workflows/imersip-p92-single-engine.yml index 57e2b790a..3a3de5625 100644 --- a/.github/workflows/imersip-p92-single-engine.yml +++ b/.github/workflows/imersip-p92-single-engine.yml @@ -101,6 +101,8 @@ jobs: -DSONKU_P96_DISTANCE_REINFORCEMENT_RESEARCH \ -DSONKU_P97_STAGE_IMPACT_RESEARCH \ -DSONKU_P98_SCENE_VOICING_RESEARCH \ + -DSONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH=1 \ + -DSONKU_IMMERSIB_PCM_DIAGNOSTICS=1 \ tests/immersib_p98_native_sonic_gate.cpp -o /tmp/immersib-p98 /tmp/immersib-p98 windows: @@ -155,6 +157,7 @@ jobs: -DARMIX_SONKU_EXPERIMENTAL_P96_DISTANCE_REINFORCEMENT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P97_STAGE_IMPACT=ON ` -DARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING=ON ` + -DARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM=ON ` -DBUILD_TESTING=ON if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } $tests = (& ctest --test-dir build -C Release --show-only=json-v1 | Out-String | ConvertFrom-Json) diff --git a/CMakeLists.txt b/CMakeLists.txt index a3442e604..026dd018a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,6 +124,14 @@ if(ARMIX_SONKU_EXPERIMENTAL_P97_STAGE_IMPACT AND NOT ARMIX_SONKU_EXPERIMENTAL_P96_DISTANCE_REINFORCEMENT) message(FATAL_ERROR "P9.7 requires the P9.6 sound-reinforced world-speaker engine") endif() +# Brand-scoped P9.9 room/vocal adaptation. OFF by default for every +# normal build and every non-ImmerSIB product. +option(ARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM + "Private ImmerSIB vocal room-coupling on P9.8 Warm scenes only" OFF) +if(ARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM AND + NOT ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING) + message(FATAL_ERROR "ImmerSIB P9.9 vocal-room candidate requires P9.8 warm voicing") +endif() # Typed native v12 voicing of Signature/Cinema/Studio: P9.7 Venue remains immutable. option(ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING "Private P9.8 scene bass/voice/air voicing; preserve approved P9.7 Venue" OFF) @@ -372,7 +380,8 @@ 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_IMMERSIB_P99_VOCAL_ROOM_RESEARCH=1>) if(WIN32) # Windows retains its proven ASIO-first / WASAPI / static WebView2 distribution. @@ -938,6 +947,10 @@ if(BUILD_TESTING) SONKU_P98_SCENE_VOICING_RESEARCH=1 ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING=1) endif() + if(ARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM) + target_compile_definitions(ARMixImerSipP92NativeTests PRIVATE + SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH=1) + endif() if(ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING) add_executable(ARMixImmerSIBP98NativeSonicGate tests/immersib_p98_native_sonic_gate.cpp) @@ -945,7 +958,8 @@ if(BUILD_TESTING) get_target_property(IMMERSIB_NATIVE_P98_DEFINES ARMixImerSipP92NativeTests COMPILE_DEFINITIONS) target_compile_definitions(ARMixImmerSIBP98NativeSonicGate - PRIVATE ${IMMERSIB_NATIVE_P98_DEFINES}) + PRIVATE ${IMMERSIB_NATIVE_P98_DEFINES} + SONKU_IMMERSIB_PCM_DIAGNOSTICS=1) add_test(NAME NativeImmerSIBP98VenueGoldenAndScenePreservation COMMAND ARMixImmerSIBP98NativeSonicGate) endif() diff --git a/config/spatial_audio_authority.json b/config/spatial_audio_authority.json index f1f626409..a80a3821b 100644 --- a/config/spatial_audio_authority.json +++ b/config/spatial_audio_authority.json @@ -66,7 +66,7 @@ "presetId": 2, "name": "Live Concert — nearfield vocal clarity candidate", "speakerSpreadDeg": 112, - "distanceMeters": 3, + "distanceMeters": 2, "spacePreset": 3, "earlyRoom": 1.36, "lateRoom": 0.84, @@ -77,12 +77,13 @@ "outputGainDb": 5.10545 }, "imersipAuditionPresetIds": { - "2": "Live Concert — 3.0m, 112°, Early136%, Late84%, vocal-detail4, trim1.8", - "3": "Royal Concert Hall — 3.2m, 106°, Early155%, Late78%, detail4", - "4": "Arena Thunder — 3.7m, 124°, Early145%, Late86%, impact5", - "5": "Front Row Power — 1.4m, 104°, Early126%, Late70%, detail4", - "6": "Symphonic Palace — 2.7m, 118°, Early160%, Late80%, detail4", - "7": "Velvet Cinema — 2.8m, 108°, Early142%, Late82%, Cinema3" + "2": "Live Concert — 2.0m, 112°, Early136%, Late84%, vocal-detail4, trim1.8", + "3": "Royal Concert Hall — 2.2m, 106°, Early155%, Late78%, detail4", + "4": "Arena Thunder — 2.5m, 124°, Early145%, Late86%, impact5", + "5": "Front Row Power — 1.3m, 104°, Early126%, Late70%, detail4", + "6": "Symphonic Palace — 1.9m, 118°, Early160%, Late80%, detail4", + "7": "Velvet Cinema — 1.8m, 108°, Early142%, Late82%, Cinema3", + "8": "Concert Front Row XL — 1.5m, 134°, Early170%, Late94%, detail4, +4.4dB" }, "ownerScreenshotObservation": { "speakerSpreadDeg": 150, @@ -140,23 +141,54 @@ "nativeRenderMode": 9, "featureFlag": "ARMIX_SONKU_EXPERIMENTAL_P98_SCENE_VOICING", "releaseQualified": false, + "immersibP99VocalRoom": { + "product": "ImmerSIB", + "featureFlag": "ARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM", + "perInstanceOptIn": "ImerSipP92Processor only, never generic SonKu/IMRS", + "donorApprovedMainCommit": "cdee12c6f71b35b75ddb9ba3da9a98999b60d119", + "donorExactBlob": "d8542d7aa333d689eea9637fc9f5f122c468277a", + "adapterBlob": "0aee9e1154f6052db02a8e8dfdb696ef4462aa10", + "scope": "sceneVoicing4/5 only, room ON, MIX>0, explicit product opt-in, 42% Detail / 34% Impact of already approved P9.9 Profile1", + "routing": "P9.8 source delta captured BEFORE P9.9 and applied to original 32%/12% feeds; P9.9 center 330Hz feeds separately enter existing six-wall/late engines once", + "safety": "no new FX ID/session bytes/HRIR/dry stem/second engine/heap/FFT, neutral Venue and non-opted SonKu bit-exact", + "status": "DRAFT, synthetic PCM and Windows FAT plus matched-volume headphone audition pending" + }, "acousticSourceBlobSha1": { - "engine/builtin_fx/sonku/SonKuSpatialCore.h": "25517a03b6b128a7b0d45436e5e7a1421ff855ce", + "engine/builtin_fx/sonku/SonKuSpatialCore.h": "adb44388544cf2378a282afb14cc4c4a48f2a149", "engine/builtin_fx/sonku/SonKuP91P92WorldBassFoundation.h": "63551d22e8dff672fe136131c32d28b568bb3170", "engine/builtin_fx/sonku/SonKuP94FrontBackDepthCue.h": "f0f88088c68ef6865d64c240c4c87accaf136070", - "engine/builtin_fx/sonku/SonKuP95MusicalPresence.h": "ece40572b04d4b586a61c56cf1fd1f77c1f295e7", + "engine/builtin_fx/sonku/SonKuP95MusicalPresence.h": "f458d520c9ca6c75b1b961d220e15abd64b07497", "engine/builtin_fx/sonku/SonKuP96DistanceReinforcement.h": "a32fb6e6fdd431901323d4278c51991607c02d84", "engine/builtin_fx/sonku/SonKuP97StageImpact.h": "5384fd3cc67c31f0a8038b315856d20933249b5b", - "engine/builtin_fx/sonku/SonKuP98SceneVoicing.h": "90bab191a62601021c4a7a77d64e0e4d408d3011", + "engine/builtin_fx/sonku/SonKuP98SceneVoicing.h": "5ec8d135d54e846c3f8d86d80202c29de67b724f", "engine/builtin_fx/sonku/SonKuEarlyReflections.h": "5a6a9b48cfdc60729f130c61110c8d8590b20f35", "engine/builtin_fx/sonku/SonKuSourcePlacement3D.h": "9afb959bed292626c3097c2a382208ce8798e90c" }, + "ownerFrontRowXLCohesionCandidate": { + "status": "development_only_requires_headphone_AB", + "screenshotPresetId": 8, + "screenshotPresetName": "Concert Front Row XL", + "revisedListeningPresetDistanceMeters": 1.5, + "revision": "owner_2026_11_17_front_row_grandeur_and_exact_preset_identity", + "revisedListeningRangeMeters": [1.1, 2.5], + "note": "Historical screenshot observed 1.0m; new owner request changes candidate to 1.1m. visibleControls remains original evidence.", + "visibleControls": {"room": 3, "stageDegrees": 147, "distanceMeters": 1, "earlyPercent": 180, "latePercent": 60, "spatialMixPercent": 100, "earAlignDegrees": 0, "headYawDegrees": 0, "outputGainDb": 2.5}, + "unobservableScreenshotState": "sceneVoicing is hidden in Custom; candidate explicitly selects Detail Warm id4, verify vs actual saved IMRS state for exact listening parity", + "hypothesesUnderTest": ["original dry-side spectrum in room differs from warm direct HRIR feed", "upward P9.5 makeup plus linked peak guard may modulate mastered music"], + "candidateChanges": "warm voicings 4/5 only: 32 percent already-processed source delta fed to existing early reflections; 12 percent to existing late reverb; adaptive makeup ceiling 1.10 rather than 1.65 while warm/room on", + "diagnostics": "offline-only native test captures P9.5 makeup and linked limiter reduction; changes do not prove subjective vocal segregation or absence of pumping", + "goldenConstraint": "Venue P9.7 profile0 and SonKu voicings 0..3 remain PCM-identical and immutable", + "lateralHighAir": "P9.8 voicings 4/5 only: first-image KEMAR early lateral >5.2kHz gains 0.18/0.14; no extra dry upper-mid, delays or second DSP", + "newFrontRowXLAudition": {"presetId": 8, "stageDegrees": 134, "distanceMeters": 1.5, "earlyRoom": 1.70, "lateRoom": 0.94, "outputGainDb": 4.4, "voicing": 4, "goal": "larger diffuse envelopment than original 60 percent late scene while keeping source in the nearfield", "historicalScreenshotUnmodified": true, "operatorHeadphoneABRequired": true}, + "presetIdentityCorrection": "JUCE sends exact factory Settings when selecting named scene; subsequent edits mutate only changed axis of message-thread scene intent; names reconcile on native ACK, Custom only after genuine control edit; IMRS wire format unchanged", + "released": false + }, "productTuning": { "status": "nearfield_vocal_masking_candidate_owner_not_auditioned", "archivedP97VenueGolden": "10m / 106° / ER100% / late100% / trim1.8 / voicing0, PRIVATE test-only", "newFactoryRangeMeters": [ - 1, - 4 + 1.1, + 2.5 ], "newEarlyRoomRangePercent": [ 0, @@ -164,14 +196,14 @@ ], "reason": "Owner hears farfield presets as vague and 100% early room too weak; M/S masking relief is source-domain frequency-selective, not stem separation", "newDSPBlobSha1": { - "engine/builtin_fx/sonku/SonKuSpatialCore.h": "25517a03b6b128a7b0d45436e5e7a1421ff855ce", + "engine/builtin_fx/sonku/SonKuSpatialCore.h": "adb44388544cf2378a282afb14cc4c4a48f2a149", "engine/builtin_fx/sonku/SonKuEarlyReflections.h": "5a6a9b48cfdc60729f130c61110c8d8590b20f35", - "engine/builtin_fx/sonku/SonKuP98SceneVoicing.h": "90bab191a62601021c4a7a77d64e0e4d408d3011", + "engine/builtin_fx/sonku/SonKuP98SceneVoicing.h": "5ec8d135d54e846c3f8d86d80202c29de67b724f", "engine/builtin_fx/sonku/SonKuSourcePlacement3D.h": "9afb959bed292626c3097c2a382208ce8798e90c" }, - "legacyIMRS": "Old 4-10m restored scenes migrate source distance down to room-safe <=4m; no codec version or FX ID change", + "legacyIMRS": "Old 1.0m/4-10m saved scenes migrate to 1.1-2.5m preserving room/voicing/gain; no codec or FX ID change", "physicalHeadphoneABRequired": true, - "sceneBalance": "44.1k nearfield PCM showed Symphonic 3.6m was <.85 archival Venue energy; retargeted to 2.7m, Cinema to 2.8m without gain-only inflation.", + "sceneBalance": "Historical Symphonic 3.6m and Cinema 2.8m sounded vague; current nearfield uses Symphonic 1.9m / Cinema 1.8m without gain-only inflation.", "vocalBodyCorrection": { "status": "audition_candidate_not_owner_approved", "userEvidence": "Dua Lipa live concert playback: center vocal sounds thin, sharp, and unpleasant after previous 2.05kHz/5.2kHz voicing, despite PCM and Windows builds passing", diff --git a/docs/IMMERSIB_FRONT_ROW_XL_COHESION_20261116.md b/docs/IMMERSIB_FRONT_ROW_XL_COHESION_20261116.md new file mode 100644 index 000000000..cb1069eea --- /dev/null +++ b/docs/IMMERSIB_FRONT_ROW_XL_COHESION_20261116.md @@ -0,0 +1,151 @@ +# ImmerSIB Concert Front Row XL + vocal/room cohesion candidate (2026-11-16) + +## Source of truth and UX + +Owner's native JUCE screenshot shows a **Custom** scene with: LARGE 28.8 M, Stage Width **147°**, Source Distance **1.0 m**, Early Room **180%**, Late Room **60%**, Spatial Mix **100%**, Ear Align **0°**, Head Yaw **0°**, Master Gain **+2.5 dB**. + +These visible controls are added as typed preset **ID 8, Concert Front Row XL** (scene voicing **4 / Detail Warm**). An important limitation: the screenshot *does not display the hidden serialized scene voicing*. Choosing ID4 is a documented assumption, not proof of bit-identical sound to the actual saved Custom session. The original .smix / IMRS settings remain authoritative; no session format change and no migration of UI preset IDs. All six prior presets retain their values. + +No new GUI image was synthesized. ID8 reuses the existing Live Concert background because the screenshot visually shows the live venue. GUI artwork, layout and dimensions remain owned by the GUI thread. + +## Root-cause hypotheses, not promises + +1. P9.8 center-source body/presence is processed before the world-positioned KEMAR HRIRs, but the six-surface early reflections and diffuse late-room processors previously consumed unchanged stereo input. At high Early Room this can make direct spectral body and room spectral body perceptually inconsistent. +2. P9.5's upward-only adaptive makeup has a 1.65 maximum, followed by P9.7/P9.8 spectral makeup and an existing zero-lookahead 0.98 peak limiter with 80ms release. A strong mastered source can therefore modulate the entire output, even when the tone changes alone sound promising. +3. An independent true-vocal stem is unavailable: L+R center is NOT exclusively the singer, and L-R SIDE is not only instruments. Static spectral notches are not stem separation. + +Research motivating the experimental candidates: Arweiler & Buchholz, JASA 2011, DOI 10.1121/1.3609258 (spectral characteristics of early reflections); Bradley et al., JASA 2003, DOI 10.1121/1.1570439 (early reflection contribution to intelligibility); Prodi et al., JASA 2022, DOI 10.1121/10.0011403 (spatial perception and early/late balance). None of these papers validates arbitrary numerical mix coefficients for Dua Lipa concert material. + +## Narrow candidate changes + +- **Only mode 9, room enabled, and sceneVoicing 4/5**: reuse a modest fraction of the existing, pre-HRTF warm source delta in the genuine six-wall early-reflection feed (32%) and original late-reverb feed (12%). The room maintains its original direction/tap/geometry/late decay; no extra HRTF, delay, crossfeed, AI or vocal stem. +- **Only same warm scenes**: P9.5 upward makeup maximum **1.10× (~+0.83 dB)**, rather than 1.65×. The 280ms detector / 450ms slew is preserved and smooths switches. Previously accepted voicing 0–3 and golden P9.7 remain on the unchanged 1.65 path. +- **Existing linked peak guard retained**. An exact preset with +2.5dB does not guarantee no limiting on mastered peak-heavy music. Do not promise no pumping until real PCM gain-reduction and matched-loudness user FAT are done. +- **Offline diagnostics compile flag**: `SONKU_IMMERSIB_PCM_DIAGNOSTICS=1` for the ImmerSIB native acoustic gate only. Counts limiter-hit frames and sums makeup/gain reduction; not available in production callbacks. Do not read counters concurrently with live audio. + +## Required qualification + +- Native C++ at 44.1/48 kHz including all seven scenes, owner screenshot exact controls, original P9.7 Venue PCM hash, mono/anti-phase/finite/peak, adaptive makeup bound, original legacy voicing parity. +- Actual native JUCE parameter dispatch/readback, IMRS7/SONK12 session restore, preset dropdown and Windows build/portable artifact. +- A/B at **matched LUFS** on the exact permitted concert tracks: new ID8, prior custom IMRS, unchanged reference, and previous warm candidate. Track voice body/articulation, phase/coherence, ER high-frequency coloration and kick-triggered pumping. A green CI is not listener approval. + +## Status + +Development candidate on a branch stacked over draft PR #722. This document deliberately does not claim subjective listening approval, proof of isolated voice detection, calibrated true-peak, or physical-speaker parity. No production merge or release. + +## User revision 16 Nov: frontstage distance and reflected high-air + +The owner revised the desired distance to **1.1–2.5m**. This overrides +the previous 1.0m screenshot *only for the new listening candidate*; +that earlier screenshot remains recorded above as historical provenance. + +- P9.8 product GUI, typed presets, scene validation and IMRS v6/v7 + + older legacy migration share one 1.1–2.5m envelope, preserving room, + gain and voicing. Distances now: Live 2.0m, Royal 2.2m, Arena 2.5m, + Front Row 1.3m, Symphonic 1.9m, Cinema 1.8m, Front Row XL 1.1m. + Existing 1.0m/10m files load at the closest accepted bound; + session bytes, catalog IDs and the private P9.7 10m Venue fixture + remain unchanged. +- Only voicings 4 and 5 add a **small linear (>5.2kHz) lateral term** + to the existing, already directional KEMAR EARLY-reflection output: + gains 0.18 (Detail Warm) and 0.14 (Impact Warm) multiply the ear + difference of the highpassed early component. The early MID, direct + HRTF, late reverb, reflection wall geometry and delay are unchanged. + No artificial Haas delay, extra HRTF, singer stem, compressor, FFT, + parameter ID, or realtime memory allocation is introduced. +- This is **not a blanket HF increase**. Directional early image + energy can improve stage width and envelope fusion, but overly + bright/loud reflections increase metallic sibilance or mask vocals. + Inspect native PCM 7.4kHz lateral/1.5kHz impact and matched-volume + concert audition before approval. High-frequency side gain is a + deliberately small *candidate*, not a calibrated room model. + +Reference for broadband lateral early reflections and preserved envelope: +Lokki et al., JASA 129 EL223 (2011), doi:10.1121/1.3579145. +No research source proves any single numerical gain optimal for this +mastered concert recording. + +**Gate:** both 44.1/48k native tests, old Venue PCM hash, mono symmetry, +native JUCE state migration and source-only/ROOM OFF integrity. Keep +PR Draft, and reject/retune if the owner's headphone FAT hears harshness +or unchanged pumping. + +## 2026-11-17 listening follow-up: preserve named preset + Grand Front Row + +Owner A/B: **Live Concert already feels majestic**, but Concert Front Row +XL lacks the same hall envelopment. Screenshot: Live parameters display +112deg / 2.0m / ER136 / late84 / +5.1dB while combo incorrectly shows +`Custom` without a manual edit. Diagnosis: factory Live trim is exactly +`1.8f`, i.e. ~5.10545dB, but JUCE slider step `0.1dB` rounds to +5.1dB. The prior `sync(factory); submit(readControls());` loses +precision before the native ACK, and strict factory matching on restore +incorrectly displays Custom. + +**Fix in the existing native JUCE editor, no format change:** + +- Selecting a named preset enqueues its **exact typed factory scene**. + There is no readback through the rounded JUCE sliders during preset + selection. Native P9 PCM and ACK authority are unchanged. +- The editor keeps one control-thread `uiScene_` with exact values. A + slider updates **only its own typed axis**, preserving e.g. unedited + 1.8 gain when STAGE changes. A deliberate slider/ROOM edit sets Custom, + but programmatic `dontSendNotification` sync never does. +- After ACK, the selected name is retained; canonical recognition from + saved IMRS settings still works at editor creation. Existing binary + wire layout and preset IDs stay the same. Test all preset selections + after real native callback and JUCE 25Hz timer, plus one genuine manual + control edit and untouched-gain exactness. +- New **Concert Front Row XL** factory 8 is an audition candidate: + Large28.8, **134deg/1.5m/ER170%/Late94%/Mix100%/+4.4dB**, + Ear0/Yaw0, Warm Detail voicing 4. More diffuse hall return while + keeping a near-stage front image; the old screenshot 147deg/1.0m + (prior product candidate 1.1m)/ER180%/Late60%/+2.5dB stays archival. +- **Live Concert is unchanged**. P9.7 private Venue 10m golden PCM + remains immutable. No new HRIR, stereo delay, DSP path, runtime heap, + preset identity serialization, or louder-than-Live target. + +Acoustics rationale: early lateral energy informs apparent source width, +while late/reverberant energy informs listener envelopment. A roomier +front-row scene is preferable to uniformly increasing treble or direct +gain, but listening taste remains subjective. The test compares the +old and new Front Row PCM at 44.1/48k, anti-phase and limiter guards, +rather than claiming the numerical presets are perceptually proven. + +**Remaining acceptance:** real headphone, matched-loudness owner A/B +with the same live recording, check vocal presence, clarity, spacious +tails, cymbal harshness and compression pumping. Continue Draft until +audition and fully green Windows JUCE FAT. + +## 2026-11-17 — Isolated Vocal Room Enhancement from SonKu P9.9 + +**Donor:** byte-identical `SonKuP99MusicalVocalDepth.h` from the +listening-approved 8D-SonKu PR #733 (blob +`d8542d7aa333d689eea9637fc9f5f122c468277a`). +Do NOT copy full SonKu research branches or its Orbit Stage factory. + +**Candidate:** P9.8 ImmerSIB Warm IDs 4/5 only, private compile +option `ARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM` default OFF and +explicit per-instance ImerSipP92Processor opt-in. Use the donor's +center-attention algorithm, 210–880Hz musical body, carefully limited +presence, 330Hz Q1.4 vocal room coupling, directional early widening +and late masking relief. The adapter adds only 42% to Detail / 34% to +Impact, with 35ms strength slew, to avoid full P9.9 on top of existing +P9.8 body shaping. The 32%/12% P9.8 source/room coherence uses a +*pre-P9.9* source snapshot, preventing double feeding. P9.9 sends enter +the SAME real KEMAR/six-wall/late-room graph only once. No separate +reverb/feedback, artificial stereo delay, dry center overlay, FFT, +new GUI control, or allocation on the PCM callback. + +**Preserved:** accepted Live Concert room geometry/parameters, Front Row +XL tuning and display, native power/ACK and preset identity, 1.1–2.5m +slider, IMRS v7 and SONK v12 bytes, P9.5 makeup cap 1.10 and linked +.98 peak guard. SonKu P9.9 is still exclusively opt-in for its own +product; unopted SonKu, neutral Venue, ROOM OFF and MIX0 are bit-exact. +44.1/48k native PCM regression must verify warmer center 330Hz without +bass 86Hz or treble 7600Hz overboost, bounded overall power, anti-phase +integrity, true bypass, and both Windows JUCE and portable artifacts. + +**Audio acceptance:** real mastered concert listening with gain-matched +P9.8 comparison: coherent warm singer, preserved bass punch, no +piercing 2–4kHz, natural early/late room interaction, no audible pumping. +These hypotheses cannot be proved by synthetic PCM; keep PR Draft. diff --git a/engine/builtin_fx/ImerSipP92Editor.h b/engine/builtin_fx/ImerSipP92Editor.h index 287e74732..a8cfe056e 100644 --- a/engine/builtin_fx/ImerSipP92Editor.h +++ b/engine/builtin_fx/ImerSipP92Editor.h @@ -31,9 +31,14 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, preset_.onChange=[this]{ const int id=preset_.getSelectedId(); if(!imersipP92PresetById(id))return; - visualSceneId_=id; // Art changes only; audio still uses native SonKu. - sync(imersipP92Factory(id)); - submit(); + // A named preset queues its exact factory scene, never a + // rounded slider snapshot (e.g. 1.8 linear -> displayed +5.1dB). + const auto factory=imersipP92Factory(id); + isCustomIntent_=false; + visualSceneId_=id; + sync(factory); + preset_.setSelectedId(id,juce::dontSendNotification); + submit(factory); }; addAndMakeVisible(preset_); room_.setComponentID("imersip.room"); @@ -43,8 +48,10 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, room_.addItem("LARGE 28.8 M",4); room_.setLookAndFeel(&skin_); room_.onChange=[this]{ + uiScene_.spacePreset=std::clamp(room_.getSelectedId()-1,0,3); + isCustomIntent_=true; preset_.setSelectedId(1,juce::dontSendNotification); - submit(); + submit(uiScene_); }; addAndMakeVisible(room_); @@ -53,9 +60,9 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, const char* names[]={"STAGE WIDTH","DISTANCE","EARLY ROOM", "LATE ROOM","SPATIAL MIX","MASTER GAIN", "EAR ALIGN","HEAD YAW"}; - const double lower[]={30.,1.0,0.,0.,0.,-12.,-30.,-90.}; + const double lower[]={30.,imersipP92MinDistance(),0.,0.,0.,-12.,-30.,-90.}; #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH - const double upper[]={180.,4.,180.,100.,100.,6.,20.,90.}; + const double upper[]={180.,2.5,180.,100.,100.,6.,20.,90.}; #else const double upper[]={180.,7.4,100.,100.,100.,6.,20.,90.}; #endif @@ -69,9 +76,11 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, slider.setTextBoxStyle(juce::Slider::NoTextBox,false,0,0); slider.setRange(lower[i],upper[i],step[i]); slider.setLookAndFeel(&skin_); - slider.onValueChange=[this]{ + slider.onValueChange=[this,i]{ + applySliderEdit(i); + isCustomIntent_=true; preset_.setSelectedId(1,juce::dontSendNotification); - submit(); + submit(uiScene_); repaint(); }; addAndMakeVisible(slider); @@ -211,32 +220,27 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, place(power_,1032,483,44,44); } private: - armix::sonku::Settings readControls() const { - auto s=fx_.acceptedSettings(); - s.renderMode=9;s.moving=false;s.startAzimuthDegrees=0.f; -#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH - s.sceneVoicing=selectedVoicing_; -#endif - s.musicCompatibleLowFrequency=false; - s.spacePreset=std::clamp(room_.getSelectedId()-1,0,3); - s.stereoSpreadDegrees=static_cast(knobs_[0].getValue()); - s.sourceDistanceMeters=std::min( - static_cast(knobs_[1].getValue()), - imersipP92MaxDistance(s.spacePreset)); - s.roomAmount=static_cast(knobs_[2].getValue()*.01); - s.ambience=static_cast(knobs_[3].getValue()*.01); - s.spatialMix=static_cast(knobs_[4].getValue()*.01); - s.outputTrim=static_cast( - std::pow(10.,knobs_[5].getValue()/20.)); - s.hrtfElevationTrimDegrees= - static_cast(knobs_[6].getValue()); - s.headYawDegrees=static_cast(knobs_[7].getValue()); - return s; + // Message-thread editor model: a genuine edit updates only its axis. + // The native SPSC audio callback continues to own accepted PCM state. + void applySliderEdit(int axis) { + const float v=static_cast( + knobs_[static_cast(axis)].getValue()); + switch(axis) { + case 0: uiScene_.stereoSpreadDegrees=v;break; + case 1: uiScene_.sourceDistanceMeters=std::clamp(v, + imersipP92MinDistance(), + imersipP92MaxDistance(uiScene_.spacePreset));break; + case 2: uiScene_.roomAmount=v*.01f;break; + case 3: uiScene_.ambience=v*.01f;break; + case 4: uiScene_.spatialMix=v*.01f;break; + case 5: uiScene_.outputTrim=std::pow(10.f,v/20.f);break; + case 6: uiScene_.hrtfElevationTrimDegrees=v;break; + case 7: uiScene_.headYawDegrees=v;break; + default: jassertfalse;break; + } } void sync(const armix::sonku::Settings& s){ -#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH - selectedVoicing_=s.sceneVoicing; -#endif + uiScene_=s; room_.setSelectedId(s.spacePreset+1,juce::dontSendNotification); const double vals[]={s.stereoSpreadDegrees,s.sourceDistanceMeters, 100.*s.roomAmount,100.*s.ambience,100.*s.spatialMix, @@ -245,7 +249,9 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, for(int i=0;i<8;++i)knobs_[static_cast(i)].setValue( vals[i],juce::dontSendNotification); int preset=1; - for(const auto& factory:imersipP92Presets){ + // User edits remain Custom through ACK; a new editor may still + // recognize an exact factory state restored from old IMRS bytes. + if(!isCustomIntent_)for(const auto& factory:imersipP92Presets){ const int id=factory.id; const auto candidate=imersipP92Factory(id); if(s.spacePreset==candidate.spacePreset && @@ -267,8 +273,7 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, preset_.setSelectedId(preset,juce::dontSendNotification); repaint(); } - void submit() { - const auto wanted=readControls(); + void submit(const armix::sonku::Settings& wanted) { if(!validImerSipP92Scene(wanted)){ status_="INVALID ROOM / SOURCE GEOMETRY";repaint();return; } @@ -334,7 +339,8 @@ class ImerSipP92Editor final : public juce::AudioProcessorEditor, getWidth(),juce::roundToInt(34*compactScale))); } int visualSceneId_=2; // UI-only scene selection; not IMRS / PCM state. - int selectedVoicing_=0; // UI/control side; native SPSC owns the audio state. + bool isCustomIntent_=false; + armix::sonku::Settings uiScene_{}; // Exact control-side transaction. ImerSipP92Processor& fx_; ImerSipP92VisualSkin skin_; juce::ComboBox preset_{},room_{}; diff --git a/engine/builtin_fx/ImerSipP92Processor.h b/engine/builtin_fx/ImerSipP92Processor.h index 7aa4d895d..bb57cdd18 100644 --- a/engine/builtin_fx/ImerSipP92Processor.h +++ b/engine/builtin_fx/ImerSipP92Processor.h @@ -17,7 +17,12 @@ class ImerSipP92Processor final : public SonKuSpatialProcessor { static constexpr const char* catalogIdentity="armix.builtin.imersip.v1"; static constexpr const char* productDisplayName="ImmerSIB"; ImerSipP92Processor() - : SonKuSpatialProcessor(imersipP92Factory(2)) {} + : SonKuSpatialProcessor(imersipP92Factory(2)) { +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + // Distinct from 8D-SonKu P9.9 opt-in; original session ABI unchanged. + optInImmerSIBVocalRoom(); +#endif + } const juce::String getName() const override {return productDisplayName;} bool hasEditor() const override {return true;} juce::AudioProcessorEditor* createEditor() override; @@ -115,11 +120,10 @@ class ImerSipP92Processor final : public SonKuSpatialProcessor { !armix::sonku::valid(next) || next.renderMode!=9 || next.moving || next.musicCompatibleLowFrequency || next.startAzimuthDegrees!=0.f)return false; - // Existing IMRS v6/v7 sessions may contain far 10m scenes. - // Migrate distance only; preserve accepted voicing/room/gain. - // Keep legacy binary wire length and ID unchanged. - next.sourceDistanceMeters=std::min( - next.sourceDistanceMeters,imersipP92MaxDistance(next.spacePreset)); + // Legacy 1.0m / 4-10m sessions migrate to the new listening + // envelope. Keep voicing, room, gain, IMRS bytes and FX ID. + next.sourceDistanceMeters=std::clamp(next.sourceDistanceMeters, + imersipP92MinDistance(),imersipP92MaxDistance(next.spacePreset)); return validImerSipP92Scene(next) && adoptUnpublishedScene(next); } // Original IMRS v1-v5: read the actual previous format, fail closed @@ -151,8 +155,8 @@ class ImerSipP92Processor final : public SonKuSpatialProcessor { next.roomAmount=space; next.stereoSpreadDegrees=30.f+150.f*width; next.ambience=late; - next.sourceDistanceMeters=std::min(1.6f+5.8f*depth, - imersipP92MaxDistance(next.spacePreset)); + next.sourceDistanceMeters=std::clamp(1.6f+5.8f*depth, + imersipP92MinDistance(),imersipP92MaxDistance(next.spacePreset)); next.outputTrim=trim; next.hrtfElevationTrimDegrees=earAlign; // Bass Impact, AIR, Stereo Keep were P8-only enhancer axes. diff --git a/engine/builtin_fx/ImerSipP92Scene.h b/engine/builtin_fx/ImerSipP92Scene.h index a0eb44402..15256e277 100644 --- a/engine/builtin_fx/ImerSipP92Scene.h +++ b/engine/builtin_fx/ImerSipP92Scene.h @@ -26,10 +26,18 @@ inline armix::sonku::Settings imersipP92ReferenceScene() noexcept { s.outputTrim=1.f; // 0 dB, no P8 ImerSip shelf/limiter return s; } +inline float imersipP92MinDistance() noexcept { +#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH + return 1.1f; // bounded owner listening profile; no public P9.2 ABI change +#else + return 1.f; +#endif +} inline float imersipP92MaxDistance(int room) noexcept { // Six-wall geometry requires 2*(distance+.5)<=room width. #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH - return room==1?3.05f:4.f; // user-facing nearfield 1..4m + (void)room; + return 2.5f; // owner listening profile, all three valid venue geometries #else return room==1?3.05f:room==2?6.65f:7.4f; #endif @@ -38,6 +46,7 @@ inline bool validImerSipP92Scene(const armix::sonku::Settings& s) noexcept { return armix::sonku::valid(s) && s.renderMode==9 && !s.moving && !s.musicCompatibleLowFrequency && s.startAzimuthDegrees==0.f && + s.sourceDistanceMeters>=imersipP92MinDistance() && s.sourceDistanceMeters<=imersipP92MaxDistance(s.spacePreset); } // A single typed preset catalog drives the native UI, state recognition and @@ -55,7 +64,7 @@ struct ImerSipP92Preset { }; #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH // Archival P9.7 10m Venue remains a golden *private* PCM fixture, not a -// public preset. Current owner explicitly rejects sources beyond 4m. +// public preset. Current owner listening envelope is 1.1..2.5m. inline armix::sonku::Settings imersipP97VenueGoldenScene() noexcept { auto s=imersipP92ReferenceScene(); s.stereoSpreadDegrees=106.f;s.sourceDistanceMeters=10.f; @@ -64,13 +73,20 @@ inline armix::sonku::Settings imersipP97VenueGoldenScene() noexcept { } // Nearfield factory retains the same P9 world renderer, adds P9.8 // vocal masking relief, not stem extraction or extra Haas delays. -inline constexpr std::array imersipP92Presets{{ - {2,"Live Concert", 3,112.f,3.0f,1.36f,.84f,5.10545f,4}, - {3,"Royal Concert Hall", 3,106.f,3.2f,1.55f,.78f,5.57507f,4}, - {4,"Arena Thunder", 3,124.f,3.7f,1.45f,.86f,5.45f,5}, - {5,"Front Row Power", 3,104.f,1.4f,1.26f,.70f,5.60f,4}, - {6,"Symphonic Palace", 3,118.f,2.7f,1.60f,.80f,5.25f,4}, - {7,"Velvet Cinema", 3,108.f,2.8f,1.42f,.82f,4.60898f,3} +inline constexpr std::array imersipP92Presets{{ + {2,"Live Concert", 3,112.f,2.0f,1.36f,.84f,5.10545f,4}, + {3,"Royal Concert Hall", 3,106.f,2.2f,1.55f,.78f,5.57507f,4}, + {4,"Arena Thunder", 3,124.f,2.5f,1.45f,.86f,5.45f,5}, + {5,"Front Row Power", 3,104.f,1.3f,1.26f,.70f,5.60f,4}, + {6,"Symphonic Palace", 3,118.f,1.9f,1.60f,.80f,5.25f,4}, + {7,"Velvet Cinema", 3,108.f,1.8f,1.42f,.82f,4.60898f,3}, + // Original owner screenshot: 147deg/1.0m/ER180/Late60/+2.5dB. + // Retain it as historical provenance, not as the immutable P9.7 golden. + // XL's stage-front revision balances the DIRECT front vocal with a + // longer, stronger diffuse hall envelope (late94 vs old60), bounded + // early energy and a matched-gain A/B against accepted Live Concert. + // No algorithmic changes to Venue, room IR, HRIR or scene voicing. + {8,"Concert Front Row XL",3,134.f,1.5f,1.70f,.94f,4.40f,4} }}; #else // Historical P9.2 candidate stays reproducible when private P9.8 OFF. diff --git a/engine/builtin_fx/SonKuSpatialProcessor.h b/engine/builtin_fx/SonKuSpatialProcessor.h index 5902dbcab..258d5526f 100644 --- a/engine/builtin_fx/SonKuSpatialProcessor.h +++ b/engine/builtin_fx/SonKuSpatialProcessor.h @@ -415,6 +415,11 @@ class SonKuSpatialProcessor : public juce::AudioProcessor, (void)restoreUnpublishedState(data,size); } protected: +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + void optInImmerSIBVocalRoom() noexcept { + core_.optInImmerSIBVocalRoom(); // no change to SonKu default instance + } +#endif // Default SonKu accepts its full native settings schema; independent // product inserts override this for their restricted world-P9 scenes. virtual bool admitQueuedScene( diff --git a/engine/builtin_fx/sonku/SonKuImmerSIBVocalRoom.h b/engine/builtin_fx/sonku/SonKuImmerSIBVocalRoom.h new file mode 100644 index 000000000..0aee9e115 --- /dev/null +++ b/engine/builtin_fx/sonku/SonKuImmerSIBVocalRoom.h @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: AGPL-3.0-only +#pragma once +#include "SonKuP99MusicalVocalDepth.h" +#include +#include + +// ImmerSIB-only conservative adapter over the SAME approved P9.9 math. +// No second PCM/HRTF graph, no spectral duplicate, no stem inference. +// P9.8 warm ID4/5 map to donor's Signature P9.9 center/room logic, +// but blend a bounded fraction so existing P9.8 body is not doubled. +// A hard disengage (ROOM OFF/MIX0) returns original floats exactly. +namespace armix::sonku::p99 { +class ImmerSIBVocalRoom final { +public: + using Stereo=MusicalVocalDepth::Stereo; + bool prepare(double rate) noexcept { + if(!donor_.prepare(rate))return false; + // ~35ms smooth transition between warm profiles, not per-phoneme AGC. + strengthSlew_=static_cast(1.-std::exp(-1./(rate*.035))); + reset(); + return true; + } + void reset() noexcept {donor_.reset();strength_=0.f;} + Stereo source(float left,float right,int scene,bool enabled) noexcept { + const float goal=enabled?(scene==4?.42f:(scene==5?.34f:0.f)):0.f; + strength_+=strengthSlew_*(goal-strength_); + if(!enabled || goal==0.f) { + (void)donor_.source(0.f,0.f,0,false); + return {left,right}; + } + // Use donor Signature's accepted center attention, 210-880Hz + // warmth and 330Hz room coupling, but at ImmerSIB-safe weight. + const auto shaped=donor_.source(left,right,1,true); + return {left+strength_*(shaped.left-left), + right+strength_*(shaped.right-right)}; + } + Stereo roomEarlyFeed(float left,float right) const noexcept { + const auto r=donor_.roomEarlyFeed(left,right); + return {left+strength_*(r.left-left),right+strength_*(r.right-right)}; + } + Stereo roomLateFeed(float left,float right) const noexcept { + const auto r=donor_.roomLateFeed(left,right); + return {left+strength_*(r.left-left),right+strength_*(r.right-right)}; + } + Stereo early(float left,float right) noexcept { + const auto r=donor_.early(left,right); + return {left+strength_*(r.left-left),right+strength_*(r.right-right)}; + } + Stereo late(float left,float right) noexcept { + const auto r=donor_.late(left,right); + return {left+strength_*(r.left-left),right+strength_*(r.right-right)}; + } +private: + MusicalVocalDepth donor_{}; // exact main/P9.9 source, no forked EQ + float strengthSlew_=0.f,strength_=0.f; +}; +} // namespace armix::sonku::p99 diff --git a/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h b/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h index ece40572b..f458d520c 100644 --- a/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h +++ b/engine/builtin_fx/sonku/SonKuP95MusicalPresence.h @@ -19,7 +19,11 @@ class MusicalPresence final { 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 { + // Optional bounded ceiling lets ImmerSIB reject high automatic makeup on + // deliberately wet, already-positive-trim scenes. 1.65 is the exact legacy + // path; the existing 450ms slew also smooths scene transitions. + float process(float inL,float inR,float wetL,float wetR, + float maxMakeup=1.65f) noexcept { const float a=.5f*(inL*inL+inR*inR); const float b=.5f*(wetL*wetL+wetR*wetR); inPower_+=detector_*(a-inPower_); @@ -31,7 +35,7 @@ class MusicalPresence final { 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); + target_=std::clamp(1.12f*ratio,1.f,maxMakeup); }else target_=1.f; } makeup_+=slew_*(target_-makeup_); diff --git a/engine/builtin_fx/sonku/SonKuP98SceneVoicing.h b/engine/builtin_fx/sonku/SonKuP98SceneVoicing.h index 90bab191a..5ec8d135d 100644 --- a/engine/builtin_fx/sonku/SonKuP98SceneVoicing.h +++ b/engine/builtin_fx/sonku/SonKuP98SceneVoicing.h @@ -87,6 +87,16 @@ class SceneVoicing final { out[c]=gains_[4]==0.f?x[c]: x[c]+gains_[4]*(x[c]-earlyAir_[c]); } + // Slightly enrich only the ALREADY directional KEMAR early-image + // interaural high-air field (>5.2kHz). The original center (often + // vocal) remains unchanged. No separate HRTF, delay or stem guess. + if(gains_[11]!=0.f) { + const float lateralAir=.5f*((x[0]-earlyAir_[0])- + (x[1]-earlyAir_[1])); + const float spread=gains_[11]*lateralAir; + out[0]+=spread; + out[1]-=spread; + } return {out[0],out[1]}; } Stereo finish(float left,float right) noexcept { @@ -116,23 +126,23 @@ class SceneVoicing final { private: // channels: center-source, bass body, bass kick, vocal presence, // first-image air, final-ear air, SIDE presence masking relief, - // SIDE high-air field, MID chest body, SIDE harsh relief and EAR - // de-harsh. Prepared filters only; still no FFT, lookahead or stems. + // SIDE high-air field, MID chest body, SIDE harsh relief, EAR + // de-harsh and lateral EARLY-reflection air. Prepared filters only; still no FFT, lookahead or stems. // Signature is designed for high clarity AND physical music body. // Studio adjustment deliberately gentler than Cinema. Venue profile // is ALL ZEROS: its approved P9.7 acoustic graph is immutable. - static constexpr std::array,6> curves_{{ + static constexpr std::array,6> curves_{{ // Columns: upper-mid source; LF; kick; ear-presence; early air; // ear air; SIDE 2.05k; SIDE HF; center 285Hz body; - // SIDE 3.45k masking; EAR 3.45k fatigue control. - {{0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f}}, // Venue EXACT - {{.22f,.15f,.17f,.15f,.16f,.070f,0.f,0.f,0.f,0.f,0.f}}, // Signature - {{.035f,.045f,.055f,.045f,.04f,.020f,0.f,0.f,0.f,0.f,0.f}}, // Live Studio - {{.075f,.15f,.15f,.060f,.065f,.035f,0.f,0.f,0.f,0.f,0.f}}, // Cinema + // SIDE 3.45k masking; EAR 3.45k fatigue; EARLY lateral air. + {{0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f,0.f}}, // Venue EXACT + {{.22f,.15f,.17f,.15f,.16f,.070f,0.f,0.f,0.f,0.f,0.f,0.f}}, // Signature + {{.035f,.045f,.055f,.045f,.04f,.020f,0.f,0.f,0.f,0.f,0.f,0.f}}, // Live Studio + {{.075f,.15f,.15f,.060f,.065f,.035f,0.f,0.f,0.f,0.f,0.f,0.f}}, // Cinema // ImmerSIB-only: warmer front-center body and controlled upper // mids, not another 2k/5k treble boost. LF concert impact kept. - {{.09f,.11f,.11f,.035f,.025f,.000f,.19f,.015f,.36f,.23f,.13f}}, // Detail Warm - {{.08f,.22f,.20f,.030f,.025f,.000f,.16f,.015f,.29f,.20f,.12f}} // Impact Warm + {{.09f,.11f,.11f,.035f,.025f,.000f,.19f,.015f,.36f,.23f,.13f,.18f}}, // Detail Warm + {{.08f,.22f,.20f,.030f,.025f,.000f,.16f,.015f,.29f,.20f,.12f,.14f}} // Impact Warm }}; struct Coeff {float b0=0,b1=0,b2=0,a1=0,a2=0;}; struct Filter { @@ -161,7 +171,7 @@ class SceneVoicing final { Filter sidePresence1_{},sidePresence2_{},bodyCenter_{},sideEdge_{}; std::array earEdge_{}; float sideAirLow_=0.f; - std::array gains_{}; + std::array gains_{}; float bassAlpha_=0.f,airAlpha_=0.f,slew_=0.f; }; } // namespace armix::sonku::p98 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 25517a03b..adb443885 100644 --- a/engine/builtin_fx/sonku/SonKuSpatialCore.h +++ b/engine/builtin_fx/sonku/SonKuSpatialCore.h @@ -33,6 +33,9 @@ #endif #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH #include "SonKuP98SceneVoicing.h" +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH +#include "SonKuImmerSIBVocalRoom.h" +#endif #endif #if defined(SONKU_P94_FRONT_BACK_DEPTH_RESEARCH) && SONKU_P94_FRONT_BACK_DEPTH_RESEARCH #include "SonKuP94FrontBackDepthCue.h" @@ -115,7 +118,7 @@ inline bool valid(const Settings& s) noexcept { #if defined(SONKU_P83_PHYSICAL_SPEAKER_RESEARCH) && SONKU_P83_PHYSICAL_SPEAKER_RESEARCH s.roomAmount<=(s.renderMode==9?1.8f:1.f) && #else - // Pre-P8.3 Settings has no renderMode. Keep its legacy 0..1 range. + // Pre-P8.3 Settings has no renderMode. Its original range is 0..1. s.roomAmount<=1.f && #endif std::isfinite(s.ambience) && s.ambience>=0.f && s.ambience<=1.f && @@ -202,6 +205,20 @@ class SonKuSpatialCore final { public: static constexpr int taps=hrir::taps; static constexpr int updateInterval=16; +#if defined(SONKU_IMMERSIB_PCM_DIAGNOSTICS) && SONKU_IMMERSIB_PCM_DIAGNOSTICS + // Test-build only. Read after offline rendering; never cross RT threads. + struct DynamicsTrace { + std::uint64_t samples=0,limitedSamples=0; + double limiterReductionSum=0.,makeupGainSum=0.; + float minimumLimiterGain=1.f,currentMakeup=1.f; + }; + DynamicsTrace dynamicsTrace() const noexcept {return dynamicsTrace_;} +#endif +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + // An explicit runtime-only opt-in: no ImmerSIB scene ID in SonKu or IMRS state. + // Must be called before prepare(), never from the realtime callback. + void optInImmerSIBVocalRoom() noexcept {immersibP99Enabled_=true;} +#endif bool prepare(double rate, SonKuReflectionProfile profile= SonKuReflectionProfile::Lightweight) noexcept { ready_=false; @@ -246,6 +263,9 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH if(!p98Voicing_.prepare(rate))return false; +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + if(!immersibP99VocalRoom_.prepare(rate))return false; +#endif #endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH if(!p95Presence_.prepare(rate))return false; @@ -311,6 +331,9 @@ class SonKuSpatialCore final { sideBass_=0.f; #endif limiterGain_=1.f; +#if defined(SONKU_IMMERSIB_PCM_DIAGNOSTICS) && SONKU_IMMERSIB_PCM_DIAGNOSTICS + dynamicsTrace_={}; +#endif write_=0; remaining_=0; degrees_=wrapDegrees(settings_.startAzimuthDegrees); @@ -329,6 +352,9 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH p98Voicing_.reset(); +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + immersibP99VocalRoom_.reset(); +#endif #endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95Presence_.reset(); @@ -395,6 +421,9 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH p98Voicing_.reset(); +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + immersibP99VocalRoom_.reset(); +#endif #endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95Presence_.reset(); @@ -688,6 +717,12 @@ class SonKuSpatialCore final { const bool p90World=p83Mode_==p83::Mode::MusicSpatialP90; #else constexpr bool p90World=false; +#endif +#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH + const bool immersiveWarm=p90World && roomEnabled && + settings_.spatialMix>0.f && + (settings_.sceneVoicing==p98::SceneVoicing::ImmerSIBDetail || + settings_.sceneVoicing==p98::SceneVoicing::ImmerSIBImpact); #endif // Deliberate music-monitor compensation: real distance perception // still comes from direct/reflected ratio and high-frequency cues, @@ -831,6 +866,22 @@ 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_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + // Save P9.8 room-cohesion reference BEFORE enhancing the direct + // virtual-speaker source; don't send its spectral delta twice. + const float p98RoomSourceL=history_[0][write_]; + const float p98RoomSourceR=history_[1][write_]; + const bool vocalRoomOn=immersibP99Enabled_ && p90World && + roomEnabled && settings_.spatialMix>0.f && + (settings_.sceneVoicing==4 || settings_.sceneVoicing==5); + if(immersibP99Enabled_) { + const auto vocal=immersibP99VocalRoom_.source( + history_[0][write_],history_[1][write_], + settings_.sceneVoicing,vocalRoomOn); + history_[0][write_]=vocal.left; + history_[1][write_]=vocal.right; + } #endif float ears[2]{0.f,0.f}; for(int tap=0;tap5.2kHz lateral air. + // Preserve exact MID and original reflections' timing. + const auto e=immersibP99VocalRoom_.early( + reflection.left,reflection.right); + const auto l=immersibP99VocalRoom_.late(late.left,late.right); + reflection.left=e.left;reflection.right=e.right; + late.left=l.left;late.right=l.right; + } #endif float spatialL=directL+ smoothedErPresence_*calibratedEarly*reflection.left+ @@ -1096,7 +1185,19 @@ class SonKuSpatialCore final { // 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); + // Positively trimmed wet ImmerSIB scenes need less + // adaptive whole-mix lift; cap at +0.83dB, with the + // existing 450ms slew. Other voicings stay bit-exact. + const float makeup=p95Presence_.process(x0,x1,outL,outR, +#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH + immersiveWarm?1.10f:1.65f +#else + 1.65f +#endif + ); +#if defined(SONKU_IMMERSIB_PCM_DIAGNOSTICS) && SONKU_IMMERSIB_PCM_DIAGNOSTICS + dynamicsTrace_.currentMakeup=makeup; +#endif outL*=makeup;outR*=makeup; } } @@ -1125,6 +1226,14 @@ class SonKuSpatialCore final { const float immediate=peak>0.98f?0.98f/peak:1.f; limiterGain_=std::min(immediate, std::min(1.f,limiterGain_+limiterRelease_)); +#if defined(SONKU_IMMERSIB_PCM_DIAGNOSTICS) && SONKU_IMMERSIB_PCM_DIAGNOSTICS + ++dynamicsTrace_.samples; + if(limiterGain_<.999f)++dynamicsTrace_.limitedSamples; + dynamicsTrace_.minimumLimiterGain=std::min( + dynamicsTrace_.minimumLimiterGain,limiterGain_); + dynamicsTrace_.limiterReductionSum+=1.-limiterGain_; + dynamicsTrace_.makeupGainSum+=dynamicsTrace_.currentMakeup; +#endif left[i]=outL*limiterGain_; right[i]=outR*limiterGain_; } @@ -1404,6 +1513,9 @@ class SonKuSpatialCore final { #endif float smoothedDistanceGain_=1.f,smoothedRoomLevel_=1.f; float smoothedBassShelf_=0.f,limiterGain_=1.f; +#if defined(SONKU_IMMERSIB_PCM_DIAGNOSTICS) && SONKU_IMMERSIB_PCM_DIAGNOSTICS + DynamicsTrace dynamicsTrace_{}; +#endif float smoothedErPresence_=1.f,smoothedTailPresence_=1.f; std::array earBass_{}; #if defined(SONKU_P80_TRANSPARENT_BASS_RESEARCH) && SONKU_P80_TRANSPARENT_BASS_RESEARCH @@ -1442,6 +1554,10 @@ class SonKuSpatialCore final { #endif #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH p98::SceneVoicing p98Voicing_{}; +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + p99::ImmerSIBVocalRoom immersibP99VocalRoom_{}; + bool immersibP99Enabled_=false; // explicit per-instance; not serialized +#endif #endif #if defined(SONKU_P95_MUSICAL_PRESENCE_RESEARCH) && SONKU_P95_MUSICAL_PRESENCE_RESEARCH p95::MusicalPresence p95Presence_{}; diff --git a/tests/imersip_p92_authority_contract_test.py b/tests/imersip_p92_authority_contract_test.py index 910044c81..fa21fa456 100644 --- a/tests/imersip_p92_authority_contract_test.py +++ b/tests/imersip_p92_authority_contract_test.py @@ -84,8 +84,8 @@ def test_operator_scene_is_not_factory_default(self): self.assertGreater(candidate["distanceMeters"],1.6) self.assertGreater(candidate["outputGainDb"],screenshot["outputGainDb"]) self.assertIn("s.stereoSpreadDegrees=106.f;s.sourceDistanceMeters=10.f",scene) - self.assertIn("112.f,3.0f,1.36f,.84f,5.10545f,4",scene) - self.assertIn("180.,4.,180.,100.",read("engine/builtin_fx/ImerSipP92Editor.h")) + self.assertIn("112.f,2.0f,1.36f,.84f,5.10545f,4",scene) + self.assertIn("180.,2.5,180.,100.",read("engine/builtin_fx/ImerSipP92Editor.h")) self.assertIn("150.f,2.2f,1.f,.91f,4.8f",scene) self.assertIn('"Royal Concert Hall"',scene) self.assertNotIn("P9.2 Neutral A/B",read( diff --git a/tests/imersip_p92_catalog_contract_test.py b/tests/imersip_p92_catalog_contract_test.py index 548fce55d..72a4c3958 100644 --- a/tests/imersip_p92_catalog_contract_test.py +++ b/tests/imersip_p92_catalog_contract_test.py @@ -23,12 +23,39 @@ def test_single_pcm_authority_and_stable_catalog(self): self.assertIn(value,scene) self.assertIn("SonKuSpatialProcessor(imersipP92Factory(2))",p) self.assertIn("imersipP97VenueGoldenScene()",scene) - self.assertIn("next.sourceDistanceMeters=std::min(",p) - self.assertIn("const double upper[]={180.,4.,180.",source( + self.assertIn("next.sourceDistanceMeters=std::clamp(",p) + self.assertIn("const double upper[]={180.,2.5,180.",source( "engine/builtin_fx/ImerSipP92Editor.h")) self.assertIn("sidePresence2_.run",source( "engine/builtin_fx/sonku/SonKuP98SceneVoicing.h")) - self.assertIn("inline constexpr std::array",scene) + self.assertIn("inline constexpr std::array",scene) # legacy + self.assertIn("inline constexpr std::array",scene) # P9.8 + self.assertIn("imersipP92MinDistance()",scene) + self.assertIn("134.f,1.5f,1.70f,.94f,4.40f,4",scene) + self.assertIn('"Concert Front Row XL"',scene) + # Named scenes bypass quantized JUCE slider roundtrip. + ui=source("engine/builtin_fx/ImerSipP92Editor.h") + self.assertIn("submit(factory);",ui) + self.assertIn("uiScene_=s;",ui) + self.assertIn("submit(uiScene_);",ui) + self.assertIn("isCustomIntent_=true;",ui) + # Brand opt-in only; factory IDs, GUI, IMRS and SonKu P9.9 + # approved instance must never be renamed or silently retuned. + processor=source("engine/builtin_fx/ImerSipP92Processor.h") + native=source("engine/builtin_fx/SonKuSpatialProcessor.h") + core=source("engine/builtin_fx/sonku/SonKuSpatialCore.h") + wrapper=source("engine/builtin_fx/sonku/SonKuImmerSIBVocalRoom.h") + cmake=source("CMakeLists.txt") + self.assertIn("optInImmerSIBVocalRoom();",processor) + self.assertIn("core_.optInImmerSIBVocalRoom();",native) + self.assertIn("immersibP99Enabled_ && p90World",core) + self.assertIn("const float p98RoomSourceL",core) + self.assertIn("p98RoomSourceL-x0",core) + self.assertIn("p99::ImmerSIBVocalRoom",core) + self.assertIn("MusicalVocalDepth donor_",wrapper) + self.assertIn("ARMIX_IMMERSIB_EXPERIMENTAL_P99_VOCAL_ROOM",cmake) + self.assertIn("default for every",cmake) + self.assertNotIn("readControls()",ui) self.assertIn('"Royal Concert Hall"',scene) self.assertIn('"Arena Thunder"',scene) self.assertIn('"Front Row Power"',scene) @@ -92,6 +119,7 @@ def test_single_pcm_authority_and_stable_catalog(self): self.assertNotIn('g.drawText("SPATIAL FIELD"',ui) self.assertNotIn('g.drawText("OUTPUT"',ui) self.assertNotIn("skin_.drawConcert(g,concert)",ui) + skin=source("engine/builtin_fx/ImerSipP92VisualSkin.h") cmake=source("CMakeLists.txt") self.assertIn("ImageCache::getFromMemory",skin) self.assertIn("Graphics::highResamplingQuality",skin) diff --git a/tests/imersip_p92_native_test.cpp b/tests/imersip_p92_native_test.cpp index 830d785ae..9890601af 100644 --- a/tests/imersip_p92_native_test.cpp +++ b/tests/imersip_p92_native_test.cpp @@ -54,7 +54,7 @@ static void nativeParity(int rate) { assert(actual.spacePreset==3); #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH assert(std::abs(actual.stereoSpreadDegrees-112.f)<.001f); - assert(std::abs(actual.sourceDistanceMeters-3.f)<.001f); + assert(std::abs(actual.sourceDistanceMeters-2.f)<.001f); assert(actual.roomAmount==1.36f && actual.ambience==.84f); assert(actual.outputTrim==1.8f && actual.sceneVoicing==4); #else @@ -71,6 +71,11 @@ static void nativeParity(int rate) { assert(!actual.musicCompatibleLowFrequency); auto native=std::make_unique(); +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + // Sample parity compares two identically opted-in instances of the + // SAME core. Generic SonKu stays unopted and byte-identical separately. + native->optInImmerSIBVocalRoom(); +#endif assert(native->prepare(rate, armix::sonku::SonKuReflectionProfile::SixSurfaceKemarResearch)); assert(native->setSettings(reference)); @@ -96,7 +101,7 @@ static void nativeParity(int rate) { for(int i=0;i<128;++i){ const float l=pcm.getSample(0,i),r=pcm.getSample(1,i); assert(std::isfinite(l)&&std::isfinite(r)); - // EXACT same P9.2 native callback, no second ImerSip DSP. + // EXACT native callback with matching ImmerSIB product opt-in; no second DSP. assert(std::abs(l-left[i])<2.e-6f); assert(std::abs(r-right[i])<2.e-6f); if(block<32)continue; // settle measured KEMAR/room histories @@ -145,10 +150,23 @@ static void nativeParity(int rate) { migratedFar->prepareToPlay(rate,128); assert(migratedFar->restoreUnpublishedState( farState.getData(),static_cast(farState.getSize()))); - assert(migratedFar->acceptedSettings().sourceDistanceMeters==4.f); + assert(migratedFar->acceptedSettings().sourceDistanceMeters==2.5f); assert(migratedFar->acceptedSettings().sceneVoicing==4); assert(migratedFar->acceptedSettings().roomAmount==1.36f); migratedFar->releaseResources(); + // Earlier Custom sessions may be 1.0m; migrate UP to 1.1m. + auto nearState=state; + const float near1m=1.f; + std::memcpy(static_cast(nearState.getData())+42, + &near1m,sizeof(near1m)); + auto migratedNear=std::make_unique(); + migratedNear->prepareToPlay(rate,128); + assert(migratedNear->restoreUnpublishedState( + nearState.getData(),static_cast(nearState.getSize()))); + assert(migratedNear->acceptedSettings().sourceDistanceMeters==1.1f); + assert(migratedNear->acceptedSettings().roomAmount==reference.roomAmount); + assert(migratedNear->acceptedSettings().outputTrim==reference.outputTrim); + migratedNear->releaseResources(); // Compatibility proof: an old IMRS v6 carries SONK v11 exactly // (63 bytes, no sceneVoicing). Restore it in the P9.8 engine as 0. juce::MemoryBlock oldV6; @@ -164,7 +182,7 @@ static void nativeParity(int rate) { assert(migratedV6->restoreUnpublishedState( oldV6.getData(),static_cast(oldV6.getSize()))); assert(migratedV6->acceptedSettings().sceneVoicing==0); - assert(migratedV6->acceptedSettings().sourceDistanceMeters<=4.f); + assert(migratedV6->acceptedSettings().sourceDistanceMeters<=2.5f); assert(migratedV6->acceptedSettings().stereoSpreadDegrees== reference.stereoSpreadDegrees); migratedV6->releaseResources(); @@ -376,7 +394,11 @@ int main() { assert(!power->getToggleState()); auto* selector=dynamic_cast( editor->findChildWithID("imersip.preset")); - assert(selector&&selector->getNumItems()==7); // Custom + six strong scenes +#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH + assert(selector&&selector->getNumItems()==8); // Custom + seven scenes +#else + assert(selector&&selector->getNumItems()==7); // Historical P9.2 +#endif assert(selector->getSelectedId()==2); for(int i=0;igetNumItems();++i){ const auto name=selector->getItemText(i); @@ -390,11 +412,15 @@ int main() { editor->findChildWithID("imersip.early")); assert(distanceSlider && earlySlider); #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH - assert(distanceSlider->getMinimum()==1.0); - assert(distanceSlider->getMaximum()==4.0); + assert(std::abs(distanceSlider->getMinimum()-1.1)<1.e-4); + assert(distanceSlider->getMaximum()==2.5); assert(earlySlider->getMaximum()==180.0); #endif +#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH + assert(armix::builtin_fx::imersipP92PresetById(8)!=nullptr); +#else assert(armix::builtin_fx::imersipP92PresetById(8)==nullptr); +#endif // Front Row Power must be a real applied audio edit, not UI illusion. selector->setSelectedId(5,juce::sendNotificationSync); juce::MidiBuffer editMidi; @@ -405,7 +431,7 @@ int main() { assert(editorFx->pollCompletion(selected)&&selected.applied); #if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH assert(std::abs(editorFx->acceptedSettings().stereoSpreadDegrees-104.f)<.001f); - assert(std::abs(editorFx->acceptedSettings().sourceDistanceMeters-1.4f)<.001f); + assert(std::abs(editorFx->acceptedSettings().sourceDistanceMeters-1.3f)<.001f); assert(std::abs(editorFx->acceptedSettings().ambience-.70f)<.001f); assert(std::abs(editorFx->acceptedSettings().roomAmount-1.26f)<.001f); assert(editorFx->acceptedSettings().sceneVoicing==4); @@ -417,7 +443,7 @@ int main() { assert(detailRestored->restoreUnpublishedState( detailState.getData(),static_cast(detailState.getSize()))); assert(detailRestored->acceptedSettings().sceneVoicing==4); - assert(detailRestored->acceptedSettings().sourceDistanceMeters<=4.f); + assert(detailRestored->acceptedSettings().sourceDistanceMeters<=2.5f); assert(detailRestored->acceptedSettings().roomAmount>1.f); detailRestored->releaseResources(); assert(std::abs(editorFx->acceptedSettings().outputTrim- @@ -428,6 +454,111 @@ int main() { assert(std::abs(editorFx->acceptedSettings().ambience-.97f)<.001f); assert(std::abs(editorFx->acceptedSettings().outputTrim- armix::builtin_fx::imersipP92DbToLinear(5.2f))<.001f); +#endif +#if defined(SONKU_P98_SCENE_VOICING_RESEARCH) && SONKU_P98_SCENE_VOICING_RESEARCH + // The first editor's ACK has been consumed explicitly by the test, + // while its Timer normally retires pending_ on the message thread. + // Use a fresh real editor/processor for an independent owner-preset + // transaction instead of inventing a second ACK for a deferred edit. + auto ownerFx=std::make_unique(); + ownerFx->prepareToPlay(48000.,128); + assert(ownerFx->isReady()); + std::unique_ptr ownerEditor(ownerFx->createEditor()); + assert(ownerEditor); + auto* ownerSelector=dynamic_cast( + ownerEditor->findChildWithID("imersip.preset")); + assert(ownerSelector && ownerSelector->getSelectedId()==2); + ownerSelector->setSelectedId(8,juce::sendNotificationSync); + juce::AudioBuffer ownerPcm(2,128); + juce::MidiBuffer ownerMidi; + ownerPcm.clear(); + ownerFx->processBlock(ownerPcm,ownerMidi); + armix::builtin_fx::SonKuSpatialProcessor::Completion userScene{}; + assert(ownerFx->pollCompletion(userScene) && userScene.applied && + userScene.requestId!=0); + const auto screenshot=ownerFx->acceptedSettings(); + assert(userScene.settings.stereoSpreadDegrees==134.f); + assert(screenshot.spacePreset==3); + assert(screenshot.stereoSpreadDegrees==134.f); + assert(screenshot.sourceDistanceMeters==1.5f); + assert(screenshot.roomAmount==1.70f); + assert(screenshot.ambience==.94f && screenshot.spatialMix==1.f); + assert(screenshot.hrtfElevationTrimDegrees==0.f && screenshot.headYawDegrees==0.f); + assert(screenshot.sceneVoicing==4); + assert(std::abs(screenshot.outputTrim- + armix::builtin_fx::imersipP92DbToLinear(4.4f))<.001f); + juce::MemoryBlock ownerState; + ownerFx->getStateInformation(ownerState); + auto ownerRestored=std::make_unique(); + ownerRestored->prepareToPlay(48000.,128); + assert(ownerRestored->restoreUnpublishedState( + ownerState.getData(),static_cast(ownerState.getSize()))); + assert(ownerRestored->acceptedSettings().stereoSpreadDegrees==134.f); + assert(ownerRestored->acceptedSettings().roomAmount==1.70f); + ownerRestored->releaseResources(); + ownerEditor.reset(); // Destroy editor before its processor. + ownerFx->releaseResources(); + + // Regression: the user's exact screenshot showed Live Concert controls + // 112deg / 2m / ER136 / Late84 / +5.1dB, but the preset showed Custom. + // Factory outputTrim=1.8f is NOT equal to the rounded slider's 5.1dB + // conversion. An untouched preset must submit exact factory Settings, + // retain its NAME after the real AUDIO ACK, and serialize unchanged. + auto sceneFx=std::make_unique(); + sceneFx->prepareToPlay(48000.,128); + assert(sceneFx->isReady()); + std::unique_ptr sceneEditor(sceneFx->createEditor()); + assert(sceneEditor); + auto* sceneSelector=dynamic_cast( + sceneEditor->findChildWithID("imersip.preset")); + auto* sceneStage=dynamic_cast( + sceneEditor->findChildWithID("imersip.stage")); + assert(sceneSelector && sceneStage && sceneSelector->getSelectedId()==2); + juce::AudioBuffer scenePcm(2,128); + juce::MidiBuffer sceneMidi; + const auto settleGui=[&]{ + // Native JUCE 25Hz editor timer must consume ACK and reconcile + // the selected label, not leave this assertion at pre-ACK state. + // The pinned headless JUCE build excludes the optional + // MessageManager modal loop API. Wait for the 25Hz timer to + // become due and pump the real JUCE timer callback synchronously. + juce::Thread::sleep(65); + juce::Timer::callPendingTimersSynchronously(); + }; + for(const auto& p:armix::builtin_fx::imersipP92Presets){ + sceneSelector->setSelectedId(p.id,juce::sendNotificationSync); + assert(sceneSelector->getSelectedId()==p.id); + scenePcm.clear(); + sceneFx->processBlock(scenePcm,sceneMidi); + settleGui(); + assert(sceneSelector->getSelectedId()==p.id); + const auto expected=imersipP92Factory(p.id); + const auto accepted=sceneFx->acceptedSettings(); + assert(std::abs(accepted.outputTrim-expected.outputTrim)<1.e-7f); + assert(std::abs(accepted.sourceDistanceMeters- + expected.sourceDistanceMeters)<1.e-6f); + assert(std::abs(accepted.roomAmount-expected.roomAmount)<1.e-6f); + assert(std::abs(accepted.ambience-expected.ambience)<1.e-6f); + assert(accepted.sceneVoicing==expected.sceneVoicing); + } + sceneSelector->setSelectedId(2,juce::sendNotificationSync); + scenePcm.clear(); + sceneFx->processBlock(scenePcm,sceneMidi); + settleGui(); + assert(sceneSelector->getSelectedId()==2); + assert(sceneFx->acceptedSettings().outputTrim==1.8f); + const auto originalStage=sceneStage->getValue(); + sceneStage->setValue(originalStage+1.,juce::sendNotificationSync); + assert(sceneSelector->getSelectedId()==1); // true parameter edit only + scenePcm.clear(); + sceneFx->processBlock(scenePcm,sceneMidi); + settleGui(); + assert(sceneSelector->getSelectedId()==1); // remains Custom after ACK + // Changing STAGE must not round and silently shift MASTER GAIN. + assert(sceneFx->acceptedSettings().outputTrim==1.8f); + assert(sceneFx->acceptedSettings().stereoSpreadDegrees==113.f); + sceneEditor.reset(); + sceneFx->releaseResources(); #endif auto* actualEditor=dynamic_cast( editor.get()); diff --git a/tests/immersib_p98_native_sonic_gate.cpp b/tests/immersib_p98_native_sonic_gate.cpp index 418b5a900..55022b5e2 100644 --- a/tests/immersib_p98_native_sonic_gate.cpp +++ b/tests/immersib_p98_native_sonic_gate.cpp @@ -27,8 +27,14 @@ using armix::builtin_fx::imersipP92Presets; constexpr int n=16384; constexpr double pi=3.1415926535897932384626433832795; struct Result {std::uint64_t hash;double power,side;float peak;}; -static Result render(int rate,const Settings& s,bool phaseReverse=false){ +static Result render(int rate,const Settings& s,bool phaseReverse=false, + bool immersibP99=false){ auto dsp=std::make_unique(); +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + if(immersibP99)dsp->optInImmerSIBVocalRoom(); +#else + assert(!immersibP99); +#endif assert(dsp->prepare(rate,SonKuReflectionProfile::SixSurfaceKemarResearch)); assert(armix::sonku::valid(s) && dsp->setSettings(s)); std::array,2> pcm{std::vector(n),std::vector(n)}; @@ -60,14 +66,36 @@ static Result render(int rate,const Settings& s,bool phaseReverse=false){ } } assert(result.power>1.e-4 && result.side>1.e-7); +#if defined(SONKU_IMMERSIB_PCM_DIAGNOSTICS) && SONKU_IMMERSIB_PCM_DIAGNOSTICS + const auto diag=dsp->dynamicsTrace(); + assert(diag.samples==n && diag.limitedSamples<=diag.samples); + assert(diag.minimumLimiterGain>0.f && diag.minimumLimiterGain<=1.f); + assert(diag.makeupGainSum>=double(diag.samples)); + if(s.sourceDistanceMeters==1.5f && s.stereoSpreadDegrees==134.f && + s.sceneVoicing==4) { + const double meanMakeup=diag.makeupGainSum/diag.samples; + const double limitedPct=100.*diag.limitedSamples/diag.samples; + std::fprintf(stderr, + "IMMERSIB_DYNAMICS,rate=%d,makeup=%.5f,limited=%.2f%%,minLimiter=%.5f,meanReduction=%.5f\n", + rate,meanMakeup,limitedPct,double(diag.minimumLimiterGain), + diag.limiterReductionSum/diag.samples); + // Real PCM adaptive makeup bound, NOT a claim of perceptual no-pumping. + assert(meanMakeup>=1. && meanMakeup<=1.101); + } +#endif return result; } // Whole-engine tone transfer, including HRTF/world reflections, P9.7 // stage, P9.8 voicing, P9.5 makeup and peak guard. Real PCM, not just a // narrow EQ coefficient guess. Short deterministic steady-state fixture. static double acousticTonePower(int rate,const Settings& scene, - double hz,bool mid) { + double hz,bool mid,bool immersibP99=false) { auto dsp=std::make_unique(); +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + if(immersibP99)dsp->optInImmerSIBVocalRoom(); +#else + assert(!immersibP99); +#endif assert(dsp->prepare(rate,SonKuReflectionProfile::SixSurfaceKemarResearch)); assert(dsp->setSettings(scene)); std::array,2> pcm{ @@ -114,26 +142,54 @@ int main(){ assert(venue.roomAmount==1.f && venue.ambience==1.f); assert(venue.outputTrim==1.8f && venue.spatialMix==1.f); assert(venue.startAzimuthDegrees==0.f && venue.spacePreset==3); - assert(imersipP92Presets.size()==6); + assert(imersipP92Presets.size()==7); + const auto ownerPreset=imersipP92Factory(8); + assert(ownerPreset.spacePreset==3 && ownerPreset.stereoSpreadDegrees==134.f); + assert(ownerPreset.sourceDistanceMeters==1.5f && ownerPreset.roomAmount==1.70f); + assert(ownerPreset.ambience==.94f && ownerPreset.spatialMix==1.f); + assert(ownerPreset.headYawDegrees==0.f && ownerPreset.hrtfElevationTrimDegrees==0.f); + assert(ownerPreset.sceneVoicing==4); + assert(std::abs(ownerPreset.outputTrim-armix::builtin_fx::imersipP92DbToLinear(4.4f))<1.e-6f); + assert(armix::builtin_fx::validImerSipP92Scene(ownerPreset)); + const auto live=imersipP92Factory(2); + // Make XL grand through a larger room RETURN, not a new HRTF or + // a louder-than-Live output trim. Near-row retains front-vocal focus. + assert(ownerPreset.ambience>live.ambience); + assert(ownerPreset.stereoSpreadDegrees>live.stereoSpreadDegrees); + assert(ownerPreset.sourceDistanceMeters1.f && current.sceneVoicing==4); assert(armix::builtin_fx::validImerSipP92Scene(current)); for(const auto& preset:imersipP92Presets) { const auto s=imersipP92Factory(preset.id); - assert(s.sourceDistanceMeters>=1.f && s.sourceDistanceMeters<=4.f); + assert(s.sourceDistanceMeters>=1.1f && s.sourceDistanceMeters<=2.5f); assert(s.roomAmount>1.f && s.roomAmount<=1.8f); } assert(armix::sonku::p98::SceneVoicing::valid(4)); assert(armix::sonku::p98::SceneVoicing::valid(5)); assert(!armix::sonku::p98::SceneVoicing::valid(6)); + // Drive the upstream compensation detector into a low-output state. + // The ImmerSIB cap must reduce modulation range, while the legacy cap + // remains available for the immutable Venue and other native voicings. + for(int sr:{44100,48000}) { + armix::sonku::p95::MusicalPresence bounded,legacy; + assert(bounded.prepare(sr) && legacy.prepare(sr)); + for(int i=0;i=1.f && bounded.gain()<=1.1001f); + assert(legacy.gain()>1.20f && legacy.gain()<=1.6501f); + } // Product scene classification: preserve original Venue golden; new // detail and impact voicings must NEVER silently affect its PCM. - constexpr int expectedProfiles[]{4,4,5,4,4,3}; + constexpr int expectedProfiles[]{4,4,5,4,4,3,4}; for(std::size_t i=0;ibaselineAir*.75 && lateralAirdouble { + armix::sonku::p98::SceneVoicing fx; + assert(fx.prepare(sr)); + double energy=0.; + for(int i=0;i<16000;++i) { + (void)fx.source(0.f,0.f,scene,true); + const float v=.10f*std::sin(2*pi*hz*i/double(sr)); + const auto reflected=fx.early(v,mono?v:-v); + assert(std::isfinite(reflected.left)&&std::isfinite(reflected.right)); + if(mono)assert(std::abs(reflected.left-reflected.right)<1.e-6f); + if(i>=9000) { + const double side=.5*(reflected.left-reflected.right); + energy+=side*side; + } + } + return energy; + }; + const double firstAir=earlySide(rate,0,7400,false); + const double warmAir=earlySide(rate,4,7400,false); + const double impactAir=earlySide(rate,5,7400,false); + const double firstMid=earlySide(rate,0,1500,false); + const double warmMid=earlySide(rate,4,1500,false); + const double airLift=warmAir/firstAir; + const double midLift=warmMid/firstMid; + std::fprintf(stderr, + "IMMERSIB_EARLY_LATERAL,rate=%d,air=%.4f,impact=%.4f,mid=%.4f\n", + rate,airLift,impactAir/firstAir,midLift); + assert(airLift>1.15 && airLift<1.80); + assert(impactAir>firstAir*1.10 && impactAirdouble{ armix::sonku::p98::SceneVoicing fx; assert(fx.prepare(sr)); @@ -224,6 +314,63 @@ int main(){ assert(edgeRatio<1.05); assert(airRatio>.65); } +#if defined(SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH) && SONKU_IMMERSIB_P99_VOCAL_ROOM_RESEARCH + // Whole KEMAR/room/limiter A/B: older P9.8 with no opt-in remains + // a fixed comparison, not a second processing graph. + for(int id:{2,4,8}) { + const auto warm=imersipP92Factory(id); + const auto before=render(rate,warm); + const auto after=render(rate,warm,false,true); + assert(before.hash!=after.hash); + const double ratio=after.power/before.power; + std::fprintf(stderr, + "IMMERSIB_P99_VOCAL_AB,rate=%d,id=%d,powerRatio=%.5f,sideRatio=%.5f,peak=%.5f\n", + rate,id,ratio,after.side/before.side,double(after.peak)); + assert(ratio>.80 && ratio<1.36); + assert(after.peak<=.9805f); + const double chest0=acousticTonePower(rate,warm,330.,true); + const double chest1=acousticTonePower(rate,warm,330.,true,true); + const double bass0=acousticTonePower(rate,warm,86.,true); + const double bass1=acousticTonePower(rate,warm,86.,true,true); + const double high0=acousticTonePower(rate,warm,7600.,true); + const double high1=acousticTonePower(rate,warm,7600.,true,true); + const double chest=chest1/chest0; + const double bass=bass1/bass0; + const double high=high1/high0; + std::fprintf(stderr, + "IMMERSIB_P99_TONAL_AB,rate=%d,id=%d,chest=%.5f,bass=%.5f,high=%.5f\n", + rate,id,chest,bass,high); + assert(chest>1.0001 && chest<1.35); + assert(bass>.87 && bass<1.13); + assert(high>.88 && high<1.12); + auto off=warm;off.spacePreset=0;off.roomAmount=0.f;off.ambience=0.f; + assert(render(rate,off).hash==render(rate,off,false,true).hash); + auto noMix=warm;noMix.spatialMix=0.f; + assert(render(rate,noMix).hash==render(rate,noMix,false,true).hash); + auto neutral=warm;neutral.sceneVoicing=0; + assert(render(rate,neutral).hash==render(rate,neutral,false,true).hash); + } + assert(render(rate,golden).hash==render(rate,golden,false,true).hash); +#endif + // Historical owner Custom screenshot is a valid private audio + // control reference, not a shipped preset or frozen Venue. + auto oldFront=ownerPreset; + oldFront.stereoSpreadDegrees=147.f; + oldFront.sourceDistanceMeters=1.1f; + oldFront.roomAmount=1.8f; + oldFront.ambience=.60f; + oldFront.outputTrim=armix::builtin_fx::imersipP92DbToLinear(2.5f); + const auto oldFrontPcm=render(rate,oldFront); + const auto updatedFrontPcm=render(rate,ownerPreset); + assert(updatedFrontPcm.hash!=oldFrontPcm.hash); + std::fprintf(stderr, + "IMMERSIB_FRONT_ROW_A_B,rate=%d,oldEnergy=%.5f,newEnergy=%.5f,oldSide=%.5f,newSide=%.5f,oldPeak=%.5f,newPeak=%.5f\\n", + rate,oldFrontPcm.power,updatedFrontPcm.power, + oldFrontPcm.side,updatedFrontPcm.side, + double(oldFrontPcm.peak),double(updatedFrontPcm.peak)); + // Electrical guard only: the spatial balance and subjective + // majesty still require level-matched headphone A/B. + assert(updatedFrontPcm.power>oldFrontPcm.power*.90); const auto base=render(rate,golden); // Baseline acoustic PCM hashes captured BEFORE any ImmerSIB // nearfield or M/S tuning. Real regression, not self-comparison. @@ -232,11 +379,11 @@ int main(){ const auto migrated=render(rate,venue); // The operator's approved Venue is a bit-exact audio checkpoint. assert(base.hash==migrated.hash); - std::array uniquePcm{}; + std::array uniquePcm{}; for(const auto& preset:imersipP92Presets){ const auto s=imersipP92Factory(preset.id); assert(s.renderMode==9 && !s.moving); - assert(s.spacePreset==3 && s.sourceDistanceMeters<=4.f); + assert(s.spacePreset==3 && s.sourceDistanceMeters<=2.5f); const auto heard=render(rate,s); const auto inverse=render(rate,s,true); assert(inverse.side>1.e-7); // no catastrophic antiphase null @@ -251,7 +398,21 @@ int main(){ // shrill, thin vocals. The independent WHOLE-PCM 285Hz/3.45k // tonal tests above replace it with a physically appropriate // transfer quality criterion. Still forbid silent presets. - assert(heard.power>base.power*.70); + if(preset.id==8) { + // The owner deliberately selected +2.5dB rather than the + // +5.1dB archived Venue trim. Equalize electrical output + // trim for this energy-only *diagnostic*, not for the PCM + // render or production gain. This does not equate to LUFS. + const double matchedPower=heard.power* + (double(golden.outputTrim)*golden.outputTrim)/ + (double(s.outputTrim)*s.outputTrim); + std::fprintf(stderr, + "OWNER_XL_GAIN_MATCH,rate=%d,raw=%.6f,matched=%.6f,venue=%.6f\\n", + rate,heard.power,matchedPower,base.power); + assert(matchedPower>base.power*.70); + }else { + assert(heard.power>base.power*.70); + } uniquePcm[static_cast(preset.id-2)]=heard.hash; std::printf("IMMERSIB_P98_SCENE,%d,%d,%s,%d,%.6f,%.6f,%.6f,%016llx\n", rate,preset.id,preset.label,s.sceneVoicing, @@ -263,5 +424,5 @@ int main(){ for(std::size_t j=i+1;j