File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -39,8 +39,8 @@ def listen(self, ready_callback=None):
39
39
if ready_callback :
40
40
ready_callback ()
41
41
while (
42
- self .listener_handle
43
- and not self .speech_waiting ()
42
+ ( self .listener_handle
43
+ and not self .speech_waiting ())
44
44
or not self .phrase_complete
45
45
):
46
46
if self .phrase_time and time .monotonic () > start + self .phrase_timeout :
Original file line number Diff line number Diff line change 75
75
TITLE_FADE_STEPS = 25
76
76
TEXT_FADE_TIME = 0.25
77
77
TEXT_FADE_STEPS = 51
78
- ALSA_ERROR_DELAY = 1.0 # Delay to wait after an ALSA errors
78
+ ALSA_ERROR_DELAY = 0.5 # Delay to wait after an ALSA errors
79
79
80
80
# Whitespace Settings (in Pixels)
81
81
PAGE_TOP_MARGIN = 20
92
92
93
93
# Speech Recognition Parameters
94
94
ENERGY_THRESHOLD = 300 # Energy level for mic to detect
95
- PHRASE_TIMEOUT = 3 .0 # Space between recordings for separating phrases
95
+ PHRASE_TIMEOUT = 1 .0 # Space between recordings for separating phrases
96
96
RECORD_TIMEOUT = 30 # Maximum time in seconds to wait for speech
97
97
98
98
# Do some checks and Import API keys from API_KEYS_FILE
@@ -641,25 +641,26 @@ def generate_new_story(self):
641
641
time .sleep (0.2 )
642
642
return
643
643
644
- def show_waiting ():
644
+ def show_listening ():
645
645
# Pause for a beat because the listener doesn't
646
646
# immediately start listening sometimes
647
647
time .sleep (ALSA_ERROR_DELAY )
648
648
self .pixels .fill (NEOPIXEL_WAITING_COLOR )
649
649
self .pixels .show ()
650
650
651
- self .listener .listen (ready_callback = show_waiting )
651
+ self .listener .listen (ready_callback = show_listening )
652
652
653
653
if self ._sleep_request :
654
654
self ._busy = False
655
655
return
656
656
657
657
if not self .listener .speech_waiting ():
658
658
# No response from user, so return
659
+ print ("No response from user." )
659
660
return
660
661
661
662
story_request = self .listener .recognize ()
662
-
663
+ print ( f"Whisper heard: { story_request } " )
663
664
story_prompt = self ._make_story_prompt (story_request )
664
665
self .display_loading ()
665
666
response = self ._sendchat (story_prompt )
You can’t perform that action at this time.
0 commit comments