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
+1 -1
View File
@@ -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),
+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":
+2 -2
View File
@@ -12497,7 +12497,7 @@ const ExportModal = ({ open, onClose, exportSettings, setExportSettings, isExpor
<div>
<label className="block text-[7px] text-zinc-500 font-bold uppercase mb-0.5">Định dạng</label>
<select value={exportSettings.format}
onChange={e => setExportSettings(p => ({ ...p, format: e.target.value, sampleRate: '44100', bitDepth: 'float', quality: '44khz' }))}
onChange={e => setExportSettings(p => ({ ...p, format: e.target.value, sampleRate: '44100', bitDepth: '16', quality: '44khz' }))}
className="w-full bg-[#141414] border border-zinc-800 rounded px-1 py-0.5 text-xs text-zinc-300 focus:outline-none">
<option value="wav">WAV</option>
<option value="mp3">MP3</option>
@@ -18431,7 +18431,7 @@ const App = () => {
try { remExpDir = localStorage.getItem('sonic_remember_export_dir') === '1'; } catch (e) { }
return {
sampleRate: '44100',
bitDepth: 'float',
bitDepth: '16',
format: 'wav',
source: 'project',
quality: '44khz',
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -51,7 +51,7 @@
<script src="/static/js/services/promptTemplateManager.js?v=202607281039"></script>
<script src="/static/js/services/undoRedoEngine.js?v=202607290941"></script>
<script src="/static/js/services/chordTheory.js?v=202608211300"></script>
<script src="/static/js/app.precompiled.js?v=202608241919" defer></script>
<script src="/static/js/app.precompiled.js?v=202608241954" defer></script>
<link rel="stylesheet" href="/static/css/styles.css?v=202607271016">
<style>
:root {