feat(libSceAudioPropagation): render three-point material paths from console measurements #27216
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/27216"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by aKazm1 on 2026-11-25T13:26:41Z.
What
sceAudioPropagationSourceRendernow renders active audio paths for the case SAROS uses, instead of throwingnonempty audio path rendering is not implemented. The model comes from console measurements, source 1 in REVERSE_ENGINEERING.md: impulse responses of the console's own/system/common/lib/libSceAudioPropagation.sprx, driven by a homebrew payload.sceKernelGetSystemSwVersionreturns 13.590.001.What the console showed, and what this PR implements:
SetAudioPathfixes a path's delay and gains from the source attributes current at that call. The material absorption now comes from offset 32 of the 0x40 record, stored byRegisterMaterial; the PCM record is attribute 4, and its samples are copied when it is set and used by one render (measured: a later rewrite of the buffer is not heard, and a render without a new PCM attribute is silent).(pathLength - |sourcePosition|) · 48000 / speed + 256, plus one frame when the source position is nonzero. Fractional samples are read by linear interpolation.{model, maxDistance, factor, referenceDistance};W, Y, Z, Xwith SN3D, whereY = −x,Z = yandX = zof the middle point;channelCountstays 0;δ − Σ aₖ·gₖ. The six bands are generated, not copied: sine crossoversTᵢ(k) = 0.5 − 0.5·sin(π/2·clamp((k − mᵢ)/wᵢ, −1, 1))at binsmᵢ = 2^(i+2)+1(5, 9, 17, 33, 65) withwᵢ = (mᵢ − 1)/3on a 1024-point grid, band differences, inverse FFT, and 513 taps under0.54 + 0.46·cos(πj/256). This matches the measured console responses to 4.2e-8. The console's filter is linear in absorption to 4e-8, and the bands sum to 1.Every case that was not measured still throws (
std::runtime_error, as the existing tests expect):The debt fragment records the limits. The other pending fragment's entry for this library said rendering adds no path contributions, so it is updated in place, as
debt_fold.pyrequires.Known difference: for a fractional delay the console splits the impulse slightly differently, 0.074 of the peak where this model gives 0.068 at 1979.07 samples. The sum and the position match.
Out of scope, seen on the console:
SetAudioPathrejects every 2-point path.Tested
guest_audio_propagationpasses, including five new checks of console numbers:check_conventions.pyanddebt_fold.py --checkpass.openingterminal.mp4):Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)AI-assisted: Yes.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T13:37:26Z.
Review: COMMENTED
Reviewed — comments
No blocking defect is verified, but I did not read every changed file or run the reported checks, so a formal decision is not justified.
What I ran
Reviewed head
c4a1f690193501ecccd00087e925bcc7641eeff9. Read the prepared description, commits, manifest, and diff, plus lines 1–150 and 300–420 ofExport.cpp. No commands or tests were run.Results
Findings
Blocking
None verified.
Non-blocking
None.
Not verified
The full implementation and behavior remain unverified. The changed files listed in the manifest are
Export.cpp,MaterialBands.hpp,GuestAudioPropagation.cpp,audiopropagation-source-render.md, andfix-audiopropagation-zero-ray-paths.md; only portions ofExport.cppwere read. The other changed files, the rest ofExport.cpp, and any excluded files were not read. The reported tests and console behavior were not independently checked.To get this to a good state
Nothing is required. Optional: review the remaining changed files and run the reported checks before relying on the console behavior claims.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T18:27:24Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: preserve correct PCM samples when the game updates the source PCM buffer between render calls.
What I ran
Reviewed head
9418db2a635d278b1d1dd04a5aba18b6ff65f5e8. I read the prepared description, commit list, manifest, diff, and every added line in the four changed files. I inspected the relevant source attribute and render code withrepo_read.py. No tests were run.Results
Findings
Blocking
core/libs/prx/libSceAudioPropagation/Export.cpp:335: The source PCM pointer and byte count are retained from the last attribute update, but each render copies samples starting at that same buffer address into history. If the caller reuses and updates a PCM buffer for each frame, as the added tests do atcore/libs/tests/GuestAudioPropagation.cpp:973-977, rendering frame 2 and later reads frame 1's now-overwritten memory as though it were current input. Conversely, if the caller supplies a new PCM buffer each frame, the render uses the stale pointer becauseSourceSetAttributesis the only place that replaces it. Track/copy each frame's current PCM input through the supported API lifecycle so delayed paths receive the actual source stream rather than repeated or stale samples.Non-blocking
None.
Not verified
No tests or builds were run. The description's console measurements and SAROS run were author-reported and not independently verified. All four changed files were read; no changed files were excluded by the prepared manifest.
To get this to a good state
Update PCM capture so each render frame uses the current source samples, then add coverage that changes PCM data across consecutive frames and verifies a delayed path emits those distinct samples.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-25T20:33:59Z.
Review: COMMENTED
Reviewed — no blocking findings
The implementation and added tests support the measured three-point rendering behavior, but I could not run the checks in this review environment, so approval is not justified.
What I ran
Inspected the prepared diff and changed files at head
2458de0c6f6f7e7bb3c0d7ab89b45fd8f0af37a6. No commands or tests were run.Results
Negative control
Not run; command execution was unavailable.
Findings
Blocking
None.
Non-blocking
None.
Sources
Reviewed the prepared diff and source at the pinned head; no external behavior claims are made.
Not verified
The reported
guest_audio_propagation,check_conventions.py,debt_fold.py --check, and SAROS run were not independently verified. Files reviewed:core/libs/prx/libSceAudioPropagation/Export.cpp,core/libs/tests/GuestAudioPropagation.cpp,docs/dev/debt/changes/audiopropagation-source-render.md, anddocs/dev/debt/changes/fix-audiopropagation-zero-ray-paths.md. No changed files were excluded from review.To get this to a good state
Nothing is required.