-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathbc_mic.py
More file actions
46 lines (34 loc) · 1.12 KB
/
bc_mic.py
File metadata and controls
46 lines (34 loc) · 1.12 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
"""
This script is an example of using a single microphone with the backchannel model.
"""
import sys
import os
# For debugging purposes, you can uncomment the following line to add the src directory to the path.
# This allows you to import modules from the src directory without pip installing the package.
# Uncomment the line below if you need to run this script directly without installing the package.
# sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '../../src/')))
from maai import Maai, MaaiInput, MaaiOutput
def test():
# Use the default mic
mic = MaaiInput.Mic()
# Use zero signals for the second channel
zero = MaaiInput.Zero()
# output = MaaiOutput.GuiBar()
output = MaaiOutput.ConsoleBar()
maai = Maai(
mode="bc",
lang="jp",
frame_rate=10,
audio_ch1=mic,
audio_ch2=zero,
device="cpu"
)
maai.start()
while True:
result = maai.get_result()
output.update(result)
if __name__ == "__main__":
try:
test()
except KeyboardInterrupt:
print("Ending the test script.")