Files
skate-3-rust-engine/tools/audio-e2e/render_diff.py
T
Hails 418dcecd41 Audio: interim cue tables retired, native water splash, published tools
- The interim cue tables and their opt-outs are gone; the native runtime is the only audio path. Old
  settings/audio.json files still load ("interim" / "native" ignored). Missing native data logs an error
  instead of falling back.
- Water splash from retail's mechanism (SFXObj_OffBoard start / update): Skate_Collisions 1187 / 1197 once
  per water stay, 1198 when the board is in water.
- The random interim riding bed is removed; riding collision and cloth sounds compared with the recomp
  (doc 11). Native output otherwise byte-identical (13 scenarios + 5 sessions).
- Published tools under tools/ (one folder per tool with a README; the recomp ones labelled for use with the
  research hooks), doc 14 and PR plan bucket L.
- Docs: doc 11 (retirement, bail density measured against the recomp, collision posts), doc 13 (usage guide).
2026-10-03 10:20:08 -06:00

39 lines
1.3 KiB
Python

"""Compare two directories of e2e renders (`<name>.ours.f32`, interleaved 6-channel f32 at 48 kHz):
per scenario bit-identical / max |difference| / RMS level of each (dBFS over the six channels) and
the level change. Headless; reads files only.
usage: py -3.13 tools/audio-e2e/render_diff.py DIR_A DIR_B
"""
import math
import sys
from pathlib import Path
import numpy as np
def rms_db(x):
r = float(np.sqrt(np.mean(np.square(x, dtype=np.float64)))) if x.size else 0.0
return 20 * math.log10(r) if r > 0 else -200.0
def main():
if len(sys.argv) != 3 or sys.argv[1] in ('-h', '--help'):
sys.exit(__doc__)
a, b = Path(sys.argv[1]), Path(sys.argv[2])
print(f"{'scenario':14} {'same':>5} {'max|d|':>10} {'A dBFS':>8} {'B dBFS':>8} {'B-A dB':>7}")
for fa in sorted(a.glob('*.ours.f32')):
fb = b / fa.name
if not fb.exists():
continue
xa = np.fromfile(fa, dtype='<f4')
xb = np.fromfile(fb, dtype='<f4')
n = min(xa.size, xb.size)
same = xa.size == xb.size and xa.tobytes() == xb.tobytes()
d = float(np.max(np.abs(xa[:n] - xb[:n]))) if n else 0.0
la, lb = rms_db(xa), rms_db(xb)
print(f"{fa.name.split('.')[0]:14} {str(same):>5} {d:10.3g} {la:8.2f} {lb:8.2f} {lb - la:+7.2f}")
if __name__ == '__main__':
main()