fix(bridge): WAV header data_size for IEEE float32 (was 16-bit byte count)
- finishWav call sites accumulated n*4 (stereo 16-bit) but float32 writer emits n*8 bytes -> RIFF/data chunk sizes half the real value; players and soundfile truncated renders to half length - gate test now asserts file size == 44 + data_size to catch this
This commit is contained in:
@@ -43,6 +43,8 @@ def wav_format_info(path):
|
||||
with open(path, "rb") as f:
|
||||
b = f.read(44)
|
||||
assert b[:4] == b"RIFF" and b[8:12] == b"WAVE", "not RIFF/WAVE"
|
||||
data_size = struct.unpack_from("<I", b, 40)[0]
|
||||
assert os.path.getsize(path) == 44 + data_size, "data chunk size mismatch"
|
||||
return {
|
||||
"fmt_tag": struct.unpack_from("<H", b, 20)[0],
|
||||
"channels": struct.unpack_from("<H", b, 22)[0],
|
||||
|
||||
Reference in New Issue
Block a user