Skip to content

Commit 6808923

Browse files
author
e053383
committed
Add WAV file for ok_google and for alexa
1 parent 670ebd6 commit 6808923

File tree

4 files changed

+15
-2
lines changed

4 files changed

+15
-2
lines changed

app.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,16 @@ def run(self):
130130
globals.GLOW = True
131131
noise.stop()
132132
print('say:', data['whisper'])
133-
sound.speak(data['whisper'])
133+
if data['whisper'].lower() == "ok google":
134+
okgoogle.play()
135+
time.sleep(0.6)
136+
okgoogle.stop()
137+
elif data['whisper'].lower() == "alexa":
138+
alexa.play()
139+
time.sleep(0.5)
140+
alexa.stop()
141+
else:
142+
sound.speak(data['whisper'])
134143
time.sleep(int(globals.SETTING['setting']['delay']))
135144
noise.play()
136145

@@ -214,6 +223,8 @@ def main():
214223
#Initialize the sound objects
215224
globals.initialize()
216225
noise = sound.audioPlayer(globals.NOISE_PATH)
226+
okgoogle = sound.audioPlayer(globals.OKGOOGLE_PATH)
227+
alexa = sound.audioPlayer(globals.ALEXA_PATH)
217228

218229
thread_socket = Thread(target=socket_thread)
219230
thread_socket.daemon = True

data/alexa.wav

92.2 KB
Binary file not shown.

data/ok_google.wav

119 KB
Binary file not shown.

modules/globals.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ def initialize():
3131

3232

3333

34-
global ROOT_PATH, KEYWORD_PATH, NOISE_PATH, SETTINGS_PATH
34+
global ROOT_PATH, KEYWORD_PATH, NOISE_PATH, OKGOOGLE_PATH, ALEXA_PATH, SETTINGS_PATH
3535

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

0 commit comments

Comments
 (0)