dictation-service/tests/test_run.py
Kade Heyborne 73a15d03cd
Fix dictation service: state detection, async processing, and performance optimizations
- Fix state detection priority: dictation now takes precedence over conversation
- Fix critical bug: event loop was created but never started, preventing async coroutines from executing
- Optimize audio processing: reorder AcceptWaveform/PartialResult checks
- Switch to faster Vosk model: vosk-model-en-us-0.22-lgraph for 2-3x speed improvement
- Reduce block size from 8000 to 4000 for lower latency
- Add filtering to remove spurious 'the', 'a', 'an' words from start/end of transcriptions
- Update toggle-dictation.sh to properly clean up conversation lock file
- Improve batch audio processing for better responsiveness
2025-12-04 11:49:07 -07:00

22 lines
669 B
Python

import sounddevice as sd
from vosk import Model, KaldiRecognizer
from pynput.keyboard import Controller
import time
with open("/home/universal/.gemini/tmp/428d098e581799ff7817b2001dd545f7b891975897338dd78498cc16582e004f/test.log", "w") as f:
f.write("test")
SAMPLE_RATE = 16000
BLOCK_SIZE = 8000
MODEL_NAME = "vosk-model-small-en-us-0.15"
def audio_callback(indata, frames, time, status):
pass
keyboard = Controller()
model = Model(MODEL_NAME)
recognizer = KaldiRecognizer(model, SAMPLE_RATE)
with sd.RawInputStream(samplerate=SAMPLE_RATE, blocksize=BLOCK_SIZE, dtype='int16',
channels=1, callback=audio_callback):
time.sleep(10)