vad: webrtcvad.Vad = webrtcvad.Vad(mode=0)
with open(sys.argv[1], "rb") as file:
n = int(16000 * (30 / 1000.0) * 2)
while True:
buf = file.read(n)
if len(buf) == 0:
break
if vad.is_speech(buf=buf, sample_rate=16000):
print("the frame is speech")
else:
print("the frame is not speech")
get follows error:
Traceback (most recent call last):
File "test_vad.py", line 88, in <module>
if vad.is_speech(buf=buf, sample_rate=16000):
File "/home/ybZhang/miniconda3/lib/python3.8/site-packages/webrtcvad.py", line 27, in is_speech
return _webrtcvad.process(self._vad, sample_rate, buf, length)
webrtcvad.Error: Error while processing frame
I run follow codes to use webrtc:
get follows error: