Skip to content

Commit

Permalink
refactor/test: Created speak_response_with_input.py
Browse files Browse the repository at this point in the history
created the above script which will accept an input in voice after speaking. Needs more work, but for this I need to refactor other parts first, mainly the wakeword and command JSON file usage as mentioned in #9
  • Loading branch information
mattordev committed Sep 8, 2022
1 parent 6366d30 commit 26d735e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Commands/status.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import time
#import memory_profiler as profiler
import utils.speak_response as speak
import utils.speak_response_with_input as speak_input


def run(args):
Expand Down
2 changes: 0 additions & 2 deletions utils/speak_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ def speak_response(response):
speaker.setProperty('voice', voices[0].id)
speaker.say(response)
speaker.runAndWait()

return response
17 changes: 17 additions & 0 deletions utils/speak_response_with_input.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# very similar in function to speak_response.py, except, this one waits for an input after speaking the response
import pyttsx3 as tts
import utils.voice_recognizer as voice_recognizer


def speak_response(response):
# Initialize text-to-speech
speaker = tts.init()
# Set how fast it will talk.
speaker.setProperty("rate", 175)
speaker.setProperty('voice', voices[0].id)
speaker.say(response)
speaker.runAndWait()



#voice_recognizer.run(wakeword, commands, type)

0 comments on commit 26d735e

Please sign in to comment.