Skip to content

feat(stt): warm audio pipeline on prepare and retain between recordings#247

Open
chriswritescode-dev wants to merge 2 commits into
mainfrom
forge/stt-warmup
Open

feat(stt): warm audio pipeline on prepare and retain between recordings#247
chriswritescode-dev wants to merge 2 commits into
mainfrom
forge/stt-warmup

Conversation

@chriswritescode-dev
Copy link
Copy Markdown
Owner

Add prepare() method to AudioRecorder to warm the audio context and worklet before first recording. Retain the audio pipeline between recordings (only the mic track is stopped after each use). Full resources are released via dispose() when STT is disabled or the component unmounts.

  • Add AudioRecorder.prepare() to pre-warm audio context and worklet
  • Keep audio context alive across recordings; only stop mic track between uses
  • Add AudioRecorder.dispose() for full cleanup of all resources
  • Refactor cleanup()cleanupRecording(closeAudioContext) to distinguish partial vs full cleanup
  • Fix race condition: dispose() during async start() prevents entering recording state
  • Update useSTT to use disposeAudioRecorder on unmount and timeout
  • Document the performance improvement in docs/features/stt.md
  • Test coverage for prepare, reuse across recordings, lifecycle cancellation

Files

  • docs/features/stt.md
  • frontend/src/hooks/useSTT.ts
  • frontend/src/hooks/useSTT.test.tsx
  • frontend/src/lib/audioRecorder.ts
  • frontend/src/lib/audioRecorder.test.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant