From 2b7c7cef2c19baf9417ff7f429ae9ed81eb2f31d Mon Sep 17 00:00:00 2001 From: locphamtran Date: Mon, 24 Aug 2026 19:58:44 +0700 Subject: [PATCH] Fix export WAV khong mo duoc: default 32-bit float -> PCM 16 (client + server render + plugins.py) --- app/api/v1/plugins.py | 2 +- app/core/render_engine.py | 6 ++++-- app/static/js/app.jsx | 4 ++-- app/static/js/app.precompiled.js | 4 ++-- app/templates/index.html | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app/api/v1/plugins.py b/app/api/v1/plugins.py index e32b449..af3a4ab 100644 --- a/app/api/v1/plugins.py +++ b/app/api/v1/plugins.py @@ -1257,7 +1257,7 @@ def render_project( try: result_path = engine.render_project( req.project_json, output_path, - bit_depth=req.bit_depth or 32, + bit_depth=req.bit_depth or 16, out_sample_rate=req.sample_rate or 0, dither=bool(req.dither), normalize=bool(req.normalize), diff --git a/app/core/render_engine.py b/app/core/render_engine.py index 6fc6f76..30d1834 100644 --- a/app/core/render_engine.py +++ b/app/core/render_engine.py @@ -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": diff --git a/app/static/js/app.jsx b/app/static/js/app.jsx index 9558de3..8f6f7fe 100644 --- a/app/static/js/app.jsx +++ b/app/static/js/app.jsx @@ -12497,7 +12497,7 @@ const ExportModal = ({ open, onClose, exportSettings, setExportSettings, isExpor