First i want to tell the tools that i use 1. Raspberry pi 3b+
2. ReSpeaker 4Mic Array Circular (Mic)
3. Linux Debian "Buster"
4. Thony Python IDE
My problem is every time i try to run my code, it always give me error [Errno -9981] Input overflowed
But when i run code and immediately say a word, it can recognize
then the error happen, i already try using my own lm and dict but the
result is same, im a newbie and i try to follow this thread, but i kinda lost direction and make me more confused, this is my code :
from os import environ, path
from pocketsphinx import *
from sphinxbase import *
in_speech_bf = False
decoder.start_utt()
print("Check")
while True:
buf = stream.read(1024)
if buf:
decoder.process_raw(buf, False, False)
print("CHECKPOINT 1")
if decoder.get_in_speech() != in_speech_bf:
in_speech_bf = decoder.get_in_speech()
print("CHECKPOINT 2")
if not in_speech_bf:
decoder.end_utt()
print ('Result:', decoder.hyp().hypstr)
decoder.start_utt()
else:
break
decoder.end_utt()
And this is the output
Check
CHECKPOINT 1
CHECKPOINT 1
CHECKPOINT 2
CHECKPOINT 1
CHECKPOINT 1
Traceback (most recent call last):
File "/home/pi/pocketRecognition/NYOBAINN.py", line 42, in <module>
buf = stream.read(1024)
File "/usr/lib/python3/dist-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames,
exception_on_overflow) OSError: [Errno -9981] Input overflowed</module>
When i run * pocketsphinx_continuous -inmic yes -adcdev plughw:1,0 * in
terminal , it worked pretty well no error. Maybe for additional information, when i try to use LiveSpeech , it cant recognize anything but no error
Please any answer is very meaningfull to me, thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Raspberry Pi CPU is too slow to decode with such configuration. You need to use smaller acoustic and language model or you can try more modern vosk library
Really sad to hear that, you means there is no other way to use pocketsphinx in Raspberry CPU? Or there is, if yes i would like to learn how @nshmyrev.
Yeah sure, thans for your suggestion, im gonna try using vosk, but it is able to make own lm and dict using vosk like pocketsphinx? Because i want to make recognition using my own languange word ( Indonesia )
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First i want to tell the tools that i use
1. Raspberry pi 3b+
2. ReSpeaker 4Mic Array Circular (Mic)
3. Linux Debian "Buster"
4. Thony Python IDE
My problem is every time i try to run my code, it always give me error
[Errno -9981] Input overflowed
But when i run code and immediately say a word, it can recognize
then the error happen, i already try using my own lm and dict but the
result is same, im a newbie and i try to follow this thread, but i kinda lost direction and make me more confused, this is my code :
from os import environ, path
from pocketsphinx import *
from sphinxbase import *
MODELDIR = "/usr/local/lib/python3.7/dist-packages/pocketsphinx/model"
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us'))
config.set_string('-lm', path.join(MODELDIR, 'en-us.lm.bin'))
config.set_string('-dict', path.join(MODELDIR, 'cmudict-en-us.dict'))
config.set_string('-logfn', '/dev/null')
decoder = Decoder(config)
import pyaudio
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16,
channels=1,
rate=16000 ,#rate=16000,
input=True,
frames_per_buffer=1024,
input_device_index =2)
stream.start_stream()
in_speech_bf = False
decoder.start_utt()
print("Check")
while True:
buf = stream.read(1024)
if buf:
decoder.process_raw(buf, False, False)
print("CHECKPOINT 1")
if decoder.get_in_speech() != in_speech_bf:
in_speech_bf = decoder.get_in_speech()
print("CHECKPOINT 2")
if not in_speech_bf:
decoder.end_utt()
print ('Result:', decoder.hyp().hypstr)
decoder.start_utt()
else:
break
decoder.end_utt()
And this is the output
Check
CHECKPOINT 1
CHECKPOINT 1
CHECKPOINT 2
CHECKPOINT 1
CHECKPOINT 1
Traceback (most recent call last):
File "/home/pi/pocketRecognition/NYOBAINN.py", line 42, in <module>
buf = stream.read(1024)
File "/usr/lib/python3/dist-packages/pyaudio.py", line 608, in read
return pa.read_stream(self._stream, num_frames,
exception_on_overflow) OSError: [Errno -9981] Input overflowed</module>
When i run * pocketsphinx_continuous -inmic yes -adcdev plughw:1,0 * in
terminal , it worked pretty well no error. Maybe for additional information, when i try to use LiveSpeech , it cant recognize anything but no error
Please any answer is very meaningfull to me, thanks
Raspberry Pi CPU is too slow to decode with such configuration. You need to use smaller acoustic and language model or you can try more modern vosk library
https://github.com/alphacep/vosk-api
vosk is much faster to recognize large vocabulary.
Really sad to hear that, you means there is no other way to use pocketsphinx in Raspberry CPU? Or there is, if yes i would like to learn how @nshmyrev.
Yeah sure, thans for your suggestion, im gonna try using vosk, but it is able to make own lm and dict using vosk like pocketsphinx? Because i want to make recognition using my own languange word ( Indonesia )
Yes, sure, you can use kaldi toolkit for that.
Hi. Is ReSpeaker 4Mic Array Circular (Mic) good for speech recognition? How does it affect the accuracy of speech recognition?
in my opinion using ReSpeaker 4Mic Array is great