fix: specify WAV format for atomic save temp file

soundfile cannot infer format from .tmp extension, causing all
generations to fail with 'No format specified and unable to get
format from file extension'
This commit is contained in:
James Pine
2026-03-13 04:34:26 -07:00
parent 5ccf79a8f7
commit bfe912e41a
+3 -2
View File
@@ -92,8 +92,9 @@ def save_audio(
# Ensure parent directory exists
Path(path).parent.mkdir(parents=True, exist_ok=True)
# Write to temporary file first
sf.write(temp_path, audio, sample_rate)
# Write to temporary file first (explicit format since .tmp
# extension is not recognised by soundfile)
sf.write(temp_path, audio, sample_rate, format='WAV')
# Atomic rename to final path
os.replace(temp_path, path)