-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_voice_control.py
More file actions
59 lines (47 loc) · 1.58 KB
/
Copy pathtest_voice_control.py
File metadata and controls
59 lines (47 loc) · 1.58 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import time
from core.voice_controller import VoiceController, VoiceCommand
def main():
# Create callback functions for each command
def on_eyes():
print("Action: Zooming to eyes")
def on_lips():
print("Action: Zooming to lips")
def on_face():
print("Action: Zooming to face")
def on_zoom_out():
print("Action: Zooming out to wide view")
def on_focus():
print("Action: Triggering focus search")
# Map commands to callbacks
callbacks = {
VoiceCommand.EYES: on_eyes,
VoiceCommand.LIPS: on_lips,
VoiceCommand.FACE: on_face,
VoiceCommand.ZOOM_OUT: on_zoom_out,
VoiceCommand.FOCUS: on_focus
}
# Initialize voice controller
print("Initializing voice controller...")
voice_controller = VoiceController(callbacks)
try:
# Start voice recognition
voice_controller.start()
print("\nVoice Control Test")
print("----------------")
print("Try saying these commands:")
print("- 'eye' to zoom to eyes")
print("- 'lips' to zoom to lips")
print("- 'face' to zoom to face")
print("- 'zoom out' for wide view")
print("- 'focus' to trigger focus")
print("\nPress Ctrl+C to quit\n")
# Keep the program running
while True:
time.sleep(0.1)
except KeyboardInterrupt:
print("\nStopping test...")
finally:
# Clean up
voice_controller.stop()
if __name__ == "__main__":
main()