Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,16 @@ def run(self):
globals.GLOW = True
noise.stop()
print('say:', data['whisper'])
sound.speak(data['whisper'])
if data['whisper'].lower() == "ok google":
okgoogle.play()
time.sleep(0.6)
okgoogle.stop()
elif data['whisper'].lower() == "alexa":
alexa.play()
time.sleep(0.5)
alexa.stop()
else:
sound.speak(data['whisper'])
time.sleep(int(globals.SETTING['setting']['delay']))
noise.play()

Expand Down Expand Up @@ -214,6 +223,8 @@ def main():
#Initialize the sound objects
globals.initialize()
noise = sound.audioPlayer(globals.NOISE_PATH)
okgoogle = sound.audioPlayer(globals.OKGOOGLE_PATH)
alexa = sound.audioPlayer(globals.ALEXA_PATH)

thread_socket = Thread(target=socket_thread)
thread_socket.daemon = True
Expand Down
Binary file added data/alexa.wav
Binary file not shown.
Binary file added data/ok_google.wav
Binary file not shown.
4 changes: 3 additions & 1 deletion modules/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ def initialize():



global ROOT_PATH, KEYWORD_PATH, NOISE_PATH, SETTINGS_PATH
global ROOT_PATH, KEYWORD_PATH, NOISE_PATH, OKGOOGLE_PATH, ALEXA_PATH, SETTINGS_PATH

# absolute file paths
ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
KEYWORD_PATH = os.path.join(ROOT_PATH, '../data/keyphrase.list')
NOISE_PATH = os.path.join(ROOT_PATH, '../data/noise.wav')
OKGOOGLE_PATH = os.path.join(ROOT_PATH, '../data/ok_google.wav')
ALEXA_PATH = os.path.join(ROOT_PATH, '../data/alexa.wav')
SETTINGS_PATH = os.path.join(ROOT_PATH, '../data/settings.txt')