Skip to content

VoiceStudio is the open-source, fully-local ElevenLabs alternative — voice cloning, voice design, video dubbing, dictation, transcription & audiobook creation in 646 languages.

fix(dictation): ignore empty utterance finals so pauses add no spaces (#3154)

velixiofc916b65476b
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d31eadf29..fd24a6355 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ metadata and the backend fallback mirror it.
### Fixed
+- Dictation no longer inserts runs of spaces when you pause mid-sentence (#3154)
- Older synthesized takes play again with accurate play/pause controls after a newer generation (#3102)
- Generation-complete notifications appear above the workspace instead of covering synthesis controls (#3102)
- Generated speech no longer starts and ends with silence, and `[pause]` markers give exactly the pause you asked for (Raw preset and explicit durations untouched) (#3080)
diff --git a/electron/src/renderer/src/features/transcriptions/live-dictation.test.ts b/electron/src/renderer/src/features/transcriptions/live-dictation.test.ts
index 5fea8d9e8..5ad0e557c 100644
--- a/electron/src/renderer/src/features/transcriptions/live-dictation.test.ts
+++ b/electron/src/renderer/src/features/transcriptions/live-dictation.test.ts
@@ -99,6 +99,19 @@ it('streams PCM and preserves repeated utterances without duplicating the EOF su
expect(stopTrack).toHaveBeenCalled();
expect(stopGraph).toHaveBeenCalled();
});
+it('ignores empty utterance finals so pauses add no extra spaces (#3154)', async () => {
+ const result = vi.fn();
+ await live.start(result);
+ const socket = Socket.instances[0];
+ socket.frame({ type: 'final', final_kind: 'utterance', text: 'First sentence.' });
+ socket.frame({ type: 'final', final_kind: 'utterance', text: '' });
+ socket.frame({ type: 'final', final_kind: 'utterance', text: ' ' });
+ socket.frame({ type: 'partial', text: ' ' });
+ expect(live.getSnapshot().text).toBe('First sentence.');
+ socket.frame({ type: 'final', final_kind: 'utterance', text: ' Second sentence. ' });
+ expect(live.getSnapshot().text).toBe('First sentence. Second sentence.');
+ expect(result).toHaveBeenCalledTimes(2);
+});
it('releases late microphone permission after cancellation', async () => {
let allow!: (value: { getTracks: () => { stop: typeof stopTrack }[] }) => void;
microphone.mockImplementation(
diff --git a/electron/src/renderer/src/features/transcriptions/live-dictation.ts b/electron/src/renderer/src/features/transcriptions/live-dictation.ts
index 94da33dcf..c5dcc3114 100644
--- a/electron/src/renderer/src/features/transcriptions/live-dictation.ts
+++ b/electron/src/renderer/src/features/transcriptions/live-dictation.ts
@@ -236,7 +236,7 @@ export class LiveDictation {
}
if (message.type === 'partial') {
this.publish({
- text: [...this.committed, message.text || ''].filter(Boolean).join(' '),
+ text: [...this.committed, message.text || ''].filter((part) => part.trim()).join(' '),
});
return;
}
@@ -245,7 +245,10 @@ export class LiveDictation {
const kind = message.final_kind === undefined ? 'summary' : classifySherpaFinal(message);
const text = message.refined_text || message.text || '';
if (kind === 'utterance') {
- this.committed.push(text);
+ // Silence arrives as empty finals; committing them would add a separator per pause (#3154).
+ const clean = text.trim();
+ if (!clean) return;
+ this.committed.push(clean);
this.publish({ text: this.committed.join(' ') });
try {
this.onResult(message);