Python 3.x 语音到文本应用程序:实时计算麦克风中所说的特定单词数
假设您想编写一个python程序,计算麦克风中无限期出现多少个“嘿,Siri”或“嘿,Google”Python 3.x 语音到文本应用程序:实时计算麦克风中所说的特定单词数,python-3.x,python-sounddevice,Python 3.x,Python Sounddevice,假设您想编写一个python程序,计算麦克风中无限期出现多少个“嘿,Siri”或“嘿,Google” import sounddevice as sd import numpy # Make sure NumPy is loaded before it is used in the callback import heySiri_recognizer as hsr heySiri_counter =0 def callback(indata, outdata, frames, time, s
import sounddevice as sd
import numpy # Make sure NumPy is loaded before it is used in the callback
import heySiri_recognizer as hsr
heySiri_counter =0
def callback(indata, outdata, frames, time, status):
if status:
print(status)
if indata.hsr():
heySiri_counter += 1
outdata[:] = indata
try:
with sd.Stream(device=(args.input_device, args.output_device),
samplerate=args.samplerate, blocksize=args.blocksize,
dtype=args.dtype, latency=args.latency,
channels=args.channels, callback=callback):
print('#' * 80)
print('press Return to quit')
print('#' * 80)
input()
print(heySiri_counter)
except KeyboardInterrupt:
parser.exit('')
except Exception as e:
parser.exit(type(e).__name__ + ': ' + str(e))
在上面的代码中,如果您能帮助/评论我如何实现这一点(多线程、异步、块大小(音频缓冲区)等),以及假设的heySiri_识别器模块,我非常感谢