fix: await ears warmup on boot, give instant PTT release feedback, and support configurable TTS device - #36
Open
pcarff wants to merge 1 commit into
Conversation
…d support configurable TTS device
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.
Symptoms
listen_for_ptt(). The console appears hung and the microphone never completes transcription.mouth.pypreviously hardcodeddevice="cpu", preventing systems with available CUDA compute from leveraging GPU acceleration for speech synthesis.Causes
main.py,warm_ears_fut = loop.run_in_executor(None, warm_ears)was dispatched in the background to warm the Whisper STT model during the greeting and brain connect. However,main.pynever awaitedwarm_ears_futbefore entering the main interaction loop. If the user pressed the PTT key before the background STT warm-up finished,transcribe()andwarm_ears()raced on loading/running the model pipeline, blocking the thread or deadlocking the loop.ears.py, release of the PTT button (on_release()) stopped audio recording and put an audio chunk into_audio_q, but stdout logging ([ptt] transcribing...) and signal state updates (signals.set_state("thinking")) were deferred until aftertranscribe()completed or started later in the consumer.config.pyhad notts_devicesetting (unlikestt_device), so Kokoro's pipeline always defaulted to CPU.The Fix
main.py: Explicitly awaitwarm_ears_fut(with a 60-second timeout) right after the brain is confirmed warm, ensuring STT model initialization is 100% complete before any user utterances can be captured.ears.py: Added immediate stdout feedback ([ptt] transcribing...) and set the visualizer signal state to"thinking"the moment the PTT key is released, giving the user and attached visualizers (e.g.ai-visualizer,barehands) instant feedback that speech is being processed. Added early-stage debug logging before heavier model imports.config.py&mouth.py: Added"tts_device": "cpu"configuration option (supporting"cpu"or"cuda") inDEFAULTS, and passdevice=CFG.get("tts_device", "cpu")to Kokoro'sKPipeline.Deliberately Unchanged
stt_model: small.en,stt_device: auto,stt_compute: int8) and existing microphone stream mechanics are untouched.