-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
62 lines (29 loc) · 770 Bytes
/
Copy pathmain.py
File metadata and controls
62 lines (29 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from lib.Voice import *
from lib.Wakeup import *
import time
_scan_voice = False
_thr_wakeup = None
def found_hot_word():
global _scan_voice
_scan_voice = True
wakeup = Wakeup(["jarvis.pmdl"],found_hot_word)
def init_thread_wakeup():
global _thr_wakeup
wakeup.start_audio()
_thr_wakeup = ThreadWakeup(wakeup)
_thr_wakeup.setDaemon(True)
_thr_wakeup.start()
init_thread_wakeup()
voice = Voice()
while True:
if _scan_voice:
_thr_wakeup.stop()
voice.init_sound()
while True:#Make a loop until there is not action request
if voice.run():
break
voice.stop()
_scan_voice = False
init_thread_wakeup()
else:
time.sleep(0.1)