Closed RD0617 closed 2 years ago
We recommend to use sounddevice instead of pyaudio:
https://github.com/alphacep/vosk-api/blob/master/python/example/test_microphone.py
Let us know if you need extra help
i am also facing the same issue:- from vosk import Model,KaldiRecognizer import pyaudio
model= Model("/Users/jaihanuman/Desktop/untitled folder/task/vosk/vosk-model-small-en-us-0.15 2") rec= KaldiRecognizer(model,1600)
mic= pyaudio.PyAudio() stream =mic.open(rate=16000, channels=1, format=pyaudio.paInt16,input=True,frames_per_buffer=8192) stream.start_stream()
while True: data = stream.read(4096)
# break
if recognizer.AcceptWaveform(data):
print(recognizer.Result())
this is the code and heres the error :-
if recognizer.AcceptWaveform(data): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/anaconda3/lib/python3.11/site-packages/vosk/init.py", line 184, in AcceptWaveform raise Exception("Failed to process waveform") Exception: Failed to process waveform
how ti resolve?
@iamvibhavtripathi
Hello everyone! When i try to run the basic example of code I get an error
Code:
What is the problem?