Fix export WAV khong mo duoc: default 32-bit float -> PCM 16 (client + server render + plugins.py)

This commit is contained in:
2026-08-24 19:58:44 +07:00
parent 5b747606c7
commit 2b7c7cef2c
5 changed files with 10 additions and 8 deletions
+4 -2
View File
@@ -996,7 +996,8 @@ class PythonRenderEngine:
if np.isfinite(_tp):
master_buffer *= 10 ** ((-1.0 - _tp) / 20.0)
# Write final output file (D3: PCM_16/PCM_24 + dither, FLOAT mac dinh).
# Write final output file (D3: PCM_16/PCM_24 + dither, PCM_16 mac dinh —
# 32-bit float WAV bi Windows Media Player va nhieu app khac tu choi).
# OGG: Vorbis float lossy — bỏ dither/PCM/BWF (chunk WAV-only).
ext = os.path.splitext(output_filepath)[1].lower()
if ext == ".ogg":
@@ -1009,7 +1010,8 @@ class PythonRenderEngine:
sf.write(output_filepath, _quantize_pcm(master_buffer, 24, dither).T,
out_sr, subtype="PCM_24")
else:
sf.write(output_filepath, master_buffer.T, out_sr, subtype="FLOAT")
sf.write(output_filepath, _quantize_pcm(master_buffer, 16, dither).T,
out_sr, subtype="PCM_16")
# Gap 13: BWF/INFO chunks (bext + LIST/INFO title/artist/ISRC) —
# chen sau khi ghi PCM, loi metadata khong lam hong file audio.
if metadata and ext != ".ogg":