diff --git a/src/App.tsx b/src/App.tsx index ec852f0..70e45a1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -297,6 +297,9 @@ export function App() { // live. `.en` models take neither (same rule as the file flow). const options = (getModel(modelId)?.multilingual ?? false) ? { language, task } : {}; const transcriber = new LiveTranscriber({ + tentativeIntervalMs: 2500, + minTentativeSeconds: 2.0, + segmenter: { commitSilenceSeconds: 2.5, maxSegmentSeconds: 29 }, transcribe: (audio) => transcribeLiveSegment(worker, audio, options), onUpdate: (update) => { setLiveCommitted(update.committedText); diff --git a/src/lib/mic.ts b/src/lib/mic.ts index 8a14b41..8f807bf 100644 --- a/src/lib/mic.ts +++ b/src/lib/mic.ts @@ -131,7 +131,7 @@ export async function startMicCapture( audio: { echoCancellation: true, noiseSuppression: true, autoGainControl: true }, }); - const context = new AudioContext(); + const context = new AudioContext({ sampleRate: TARGET_SAMPLE_RATE }); // Contexts created outside a user gesture start suspended; the start button // click satisfies the gesture requirement, so this resolves immediately. await context.resume().catch(() => {}); diff --git a/src/worker/inference.worker.ts b/src/worker/inference.worker.ts index 0037aa6..fb03b93 100644 --- a/src/worker/inference.worker.ts +++ b/src/worker/inference.worker.ts @@ -209,22 +209,22 @@ async function transcribe(message: TranscribeMessage): Promise { } const asr = await active.promise; - const streamer = new WhisperTextStreamer( - // The ASR pipeline for Whisper models always carries a WhisperTokenizer. - asr.tokenizer as ConstructorParameters[0], - { - skip_prompt: true, - callback_function: (text: string) => - post({ type: "partial", text, requestId: message.requestId }), - }, - ); - const options: Record = { chunk_length_s: 30, stride_length_s: 5, return_timestamps: true, - streamer, }; + if (message.requestId === undefined) { + options.streamer = new WhisperTextStreamer( + // The ASR pipeline for Whisper models always carries a WhisperTokenizer. + asr.tokenizer as ConstructorParameters[0], + { + skip_prompt: true, + callback_function: (text: string) => + post({ type: "partial", text, requestId: message.requestId }), + }, + ); + } // Only meaningful for multilingual models; the UI omits these for `.en` // variants. "auto" / undefined lets Whisper detect the language. if (message.language !== undefined && message.language !== "auto") {