Voice-to-text dictation app with local (Nvidia Parakeet/Whisper) and cloud models (BYOK). Privacy-first and available cross-platform.
JavaScript aianthropiccross-platformgeminigroqlinuxmacosnvidiaopen-sourceopenaiparakeetspeech-to-texttranscribewhisperwindows
fix: force cold-start Deepgram connection for meeting transcription
Gabriel Stein00f72a417043
diff --git a/src/helpers/deepgramStreaming.js b/src/helpers/deepgramStreaming.jsindex 0b8459074..6d212849c 100644--- a/src/helpers/deepgramStreaming.js+++ b/src/helpers/deepgramStreaming.js@@ -717,7 +717,15 @@ class DeepgramStreaming {}sendAudio(pcmBuffer) {- if (!this.ws) return false;+ if (!this.ws) {+ if (this.audioBytesSent === 0 && pcmBuffer.length > 0) {+ debugLogger.warn("Deepgram sendAudio: ws is null, audio dropped", {+ bufferSize: pcmBuffer.length,+ isConnected: this.isConnected,+ });+ }+ return false;+ }if (this.ws.readyState !== WebSocket.OPEN) {// Buffer audio during cold start so no frames are lost while WebSocket connectsdiff --git a/src/helpers/ipcHandlers.js b/src/helpers/ipcHandlers.jsindex 4640a9508..c6f10def2 100644--- a/src/helpers/ipcHandlers.js+++ b/src/helpers/ipcHandlers.js@@ -2526,6 +2526,7 @@ class IPCHandlers {});let deepgramStreamingStartInProgress = false;+ let sendDropCount = 0;ipcMain.handle("deepgram-streaming-start", async (event, options = {}) => {if (deepgramStreamingStartInProgress) {@@ -2599,12 +2600,22 @@ class IPCHandlers {}};+ sendDropCount = 0;await this.deepgramStreaming.connect({ ...options, token });- debugLogger.debug("Deepgram streaming started", {}, "streaming");+ debugLogger.debug(+ "Deepgram streaming started",+ {+ isConnected: this.deepgramStreaming.isConnected,+ hasWs: !!this.deepgramStreaming.ws,+ wsReadyState: this.deepgramStreaming.ws?.readyState,+ forceNew: !!options.forceNew,+ },+ "streaming"+ );return {success: true,- usedWarmConnection: hasWarm,+ usedWarmConnection: hasWarm && !options.forceNew,};} catch (error) {debugLogger.error("Deepgram streaming start error", { error: error.message });@@ -2617,11 +2628,38 @@ class IPCHandlers {}});+ let sendDropCount = 0;ipcMain.on("deepgram-streaming-send", (event, audioBuffer) => {try {if (!this.deepgramStreaming) return;const buffer = Buffer.from(audioBuffer);- this.deepgramStreaming.sendAudio(buffer);+ const sent = this.deepgramStreaming.sendAudio(buffer);+ if (!sent) {+ sendDropCount++;+ if (sendDropCount <= 3 || sendDropCount % 50 === 0) {+ debugLogger.warn(+ "Deepgram audio send dropped",+ {+ dropCount: sendDropCount,+ hasWs: !!this.deepgramStreaming.ws,+ isConnected: this.deepgramStreaming.isConnected,+ wsReadyState: this.deepgramStreaming.ws?.readyState,+ },+ "streaming"+ );+ }+ } else {+ if (sendDropCount > 0) {+ debugLogger.debug(+ "Deepgram audio send resumed after drops",+ {+ previousDrops: sendDropCount,+ },+ "streaming"+ );+ sendDropCount = 0;+ }+ }} catch (error) {debugLogger.error("Deepgram streaming send error", { error: error.message });}diff --git a/src/hooks/useMeetingTranscription.ts b/src/hooks/useMeetingTranscription.tsindex d5cbc8f57..afbba221c 100644--- a/src/hooks/useMeetingTranscription.ts+++ b/src/hooks/useMeetingTranscription.ts@@ -156,8 +156,6 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {streamRef.current = stream;try {- await window.electronAPI?.deepgramStreamingWarmup?.();-const audioContext = new AudioContext({ sampleRate: 16000 });audioContextRef.current = audioContext;@@ -212,6 +210,7 @@ export function useMeetingTranscription(): UseMeetingTranscriptionReturn {const result = await window.electronAPI?.deepgramStreamingStart?.({sampleRate: 16000,+ forceNew: true,});logger.info(diff --git a/src/types/electron.ts b/src/types/electron.tsindex adcdad10a..9d60142b4 100644--- a/src/types/electron.ts+++ b/src/types/electron.ts@@ -852,7 +852,11 @@ declare global {error?: string;code?: string;}>;- deepgramStreamingStart?: (options?: { sampleRate?: number; language?: string }) => Promise<{+ deepgramStreamingStart?: (options?: {+ sampleRate?: number;+ language?: string;+ forceNew?: boolean;+ }) => Promise<{success: boolean;usedWarmConnection?: boolean;error?: string;