feat: add voice interaction to jarvis chat (--voice flag)#539
Open
jeremyboles76 wants to merge 1 commit into
Open
feat: add voice interaction to jarvis chat (--voice flag)#539jeremyboles76 wants to merge 1 commit into
jeremyboles76 wants to merge 1 commit into
Conversation
Add a `--voice` flag to `jarvis chat` that enables full voice I/O: mic recording with automatic silence detection feeds a speech-to-text backend, and each assistant response is synthesised and played back via a text-to-speech backend. New file `src/openjarvis/speech/voice_io.py`: - `record_until_silence()` — 16 kHz mono mic capture via sounddevice; stops after ~1.5 s of silence (RMS threshold) or a 30 s safety cap; returns raw WAV bytes. - `play_wav()` — plays WAV bytes through the default output device using sounddevice + soundfile (handles both WAV-headered and raw PCM). Changes to `src/openjarvis/cli/chat_cmd.py`: - `--voice` / `voice_mode` flag wired into the click command. - `_record_voice()` helper: discovers the best available STT backend (faster-whisper → openai → deepgram), records, transcribes, and returns the text; returns a sentinel on Ctrl-C / fatal error so the REPL loop can distinguish try-again from exit. - `_speak()` helper: tries TTS backends in priority order (kokoro → openai_tts → cartesia) and plays the synthesised WAV back. - Banner updated to advertise voice mode when active. - openjarvis.speech imported eagerly so TTS registry is populated before the first turn. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--voiceflag tojarvis chatenabling full duplex voice I/O (mic-in -> STT -> LLM -> TTS -> speaker-out)src/openjarvis/speech/voice_io.py: mic recording with automatic silence detection (record_until_silence) and WAV playback (play_wav) via sounddevice/soundfile_record_voice()inchat_cmd.py: auto-discovers the best available STT backend (faster-whisper -> openai -> deepgram), records, transcribes, and returns text_speak()inchat_cmd.py: tries TTS backends in priority order (kokoro -> openai_tts -> cartesia) and plays the synthesised WAV responseTest plan
Generated with Claude Code