diff --git a/src/lib/components/session/ParticipantView.svelte b/src/lib/components/session/ParticipantView.svelte index 8c64008..a586a36 100644 --- a/src/lib/components/session/ParticipantView.svelte +++ b/src/lib/components/session/ParticipantView.svelte @@ -215,7 +215,8 @@ await pInitFFmpeg; console.log('Audio recorded:', audio); - const wav = float32ArrayToWav(audio); + // remove last 8000 samples (0.5s) + const wav = float32ArrayToWav(audio.slice(0, -8000)); console.log('Audio converted to wav:', wav); const mp3 = await wav2mp3(wav); console.log('Audio converted to mp3:', mp3); @@ -376,7 +377,8 @@ await pInitFFmpeg; console.log('Audio recorded:', audio); - const wav = float32ArrayToWav(audio); + // remove last 8000 samples (0.5s) + const wav = float32ArrayToWav(audio.slice(0, -8000)); console.log('Audio converted to wav:', wav); const mp3 = await wav2mp3(wav); console.log('Audio converted to mp3:', mp3); diff --git a/src/lib/stt/gemini.ts b/src/lib/stt/gemini.ts index a07a33e..1659e45 100644 --- a/src/lib/stt/gemini.ts +++ b/src/lib/stt/gemini.ts @@ -17,5 +17,5 @@ export async function transcribe(data: Buffer): Promise { throw new Error('Failed to transcribe audio'); } - return output.transcription; + return output.transcription.replace(/[嗶.…]+$/g, ''); }