Normalize Linux audio pipeline to lossless Float32 (skill: lossless-audio-compliance)

- native bridge WAV writers: 16-bit PCM truncation -> IEEE Float32 (fmt 3, bit-exact)
- vendor sheredom_json.h (vst3sdk 3.8.1 lacks moduleinfo/json.h)
- Dockerfile: drop nonexistent sfizz tag v1.2.3
- Python sf.write -> subtype=FLOAT everywhere
- resample_poly -> kaiser(16) window (>=130dB stopband)
- audio_editor._write_wav_lossless(): FLOAT passthrough, TPDF dither only for
  8/16/24-bit final exports
- app.jsx WAV encoders: Float32 default, TPDF dither for integer depths, fix 24-bit
- tests: lossless compliance gate (null test < -140dBFS, float32 format) 9/9 pass
- TASKS_WINDOWS_AUDIO_NORMALIZE.md: Windows-side remaining tasks
This commit is contained in:
2026-08-18 11:50:26 +07:00
parent c382afe2a6
commit a2f93138be
18 changed files with 3842 additions and 72 deletions
@@ -18,9 +18,18 @@ TOTAL = int(max(1024, round((0.0 + 1.0) * BEAT_SEC * SR))) # 22050
def read_wav(path):
b = open(path, "rb").read()
assert b[:4] == b"RIFF" and b[8:12] == b"WAVE", "not a RIFF/WAVE file"
fmt_tag = struct.unpack_from("<H", b, 20)[0]
bits = struct.unpack_from("<H", b, 34)[0]
assert b[36:40] == b"data", "no data chunk"
data_size = struct.unpack_from("<I", b, 40)[0]
assert len(b) == 44 + data_size, "trailing bytes"
if fmt_tag == 3: # IEEE float32 (lossless render output)
assert bits == 32 and data_size % 8 == 0, "float32 stereo"
frames = data_size // 8
samples = struct.unpack("<%df" % (frames * 2), b[44:])
rms = math.sqrt(sum(s * s for s in samples) / len(samples))
return frames, rms
# PCM 16-bit (legacy)
assert data_size % 4 == 0, "stereo 16-bit: data must be multiple of 4"
frames = data_size // 4
samples = struct.unpack("<%dh" % (frames * 2), b[44:])