Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ASR hallucination on ending silence #115

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/lib/components/session/ParticipantView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/stt/gemini.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ export async function transcribe(data: Buffer): Promise<string> {
throw new Error('Failed to transcribe audio');
}

return output.transcription;
return output.transcription.replace(/[嗶.…]+$/g, '');
}
Loading