From f09d14549af3d296e4d93fadc6e998432f407b94 Mon Sep 17 00:00:00 2001 From: Richard R Date: Tue, 9 Jun 2026 09:52:37 -0600 Subject: [PATCH] fix(tts): encode normalized audio at VBR q2 instead of 64k to reduce fatigue The wav->mp3 normalization path re-encoded pristine high-fidelity TTS (e.g. Supertonic's 44.1 kHz wav) at 64k CBR, which lowpasses hard and introduces high-frequency artifacts that cause listening fatigue. Switch the live/segment transcode to libmp3lame VBR -q:a 2 (~170-210 kbps for speech), effectively transparent. The audiobook export still re-encodes to 64k for file size. --- src/lib/server/tts/audio-format.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib/server/tts/audio-format.ts b/src/lib/server/tts/audio-format.ts index bd537e0..7b5d8ae 100644 --- a/src/lib/server/tts/audio-format.ts +++ b/src/lib/server/tts/audio-format.ts @@ -109,7 +109,12 @@ function spawnFfmpegToBuffer(args: string[], signal?: AbortSignal): Promise { let workDir: string | null = null; @@ -125,7 +130,7 @@ export async function transcodeToMp3(buffer: Buffer, signal?: AbortSignal): Prom '-i', inputPath, '-vn', '-c:a', 'libmp3lame', - '-b:a', '64k', + '-q:a', '2', '-f', 'mp3', 'pipe:1', ],