pocketsphinx-python
pocketsphinx-python copied to clipboard
RuntimeError: new_Decoder returned -1
I am try to running the example code bellow and getting error
INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='live', VARNORM='no', AGC='none'
ERROR: "acmod.c", line 79: Folder 'pocketsphinx/model/en-us/en-us' does not contain acoustic model definition 'mdef'
Traceback (most recent call last):
File "/home/menon/speech/hello_ps.py", line 15, in <module>
decoder = Decoder(config)
File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 260, in __init__
this = _pocketsphinx.new_Decoder(*args)
RuntimeError: new_Decoder returned -1
My Code:
#!/usr/bin/env python
from os import environ, path
from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *
MODELDIR = "pocketsphinx/model"
DATADIR = "pocketsphinx/test/data"
# Create a decoder with certain model
config = Decoder.default_config()
config.set_string('-hmm', path.join(MODELDIR, 'en-us/en-us'))
config.set_string('-lm', path.join(MODELDIR, 'en-us/en-us.lm.bin'))
config.set_string('-dict', path.join(MODELDIR, 'en-us/cmudict-en-us.dict'))
decoder = Decoder(config)
# Decode streaming data.
decoder = Decoder(config)
decoder.start_utt()
stream = open(path.join(DATADIR, 'goforward.raw'), 'rb')
while True:
buf = stream.read(1024)
if buf:
decoder.process_raw(buf, False, False)
else:
break
decoder.end_utt()
print ('Best hypothesis segments: ', [seg.word for seg in decoder.seg()])
How can i solve this problem .
Thanks
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'))
I am facing the same error. I made changes to config file.
Traceback (most recent call last):
File "/home/sg/mycroft-core/mycroft/client/speech/main.py", line 172, in
Same problem for me too @UW-SG Are you able to fix it .
Hi, I've faced with same problem to. Just check the folders with installed pocketsphinx packages and verify if the MODELDIR and DATADIR path are correct and .set_string to.
In my case package were installed in this folder. /home/user-name/.pyenv/versions/general/lib/python3.6/site-packages/pocketsphinx/model. And there was no folder 'test' and nested 'en-us' folder.
This solved my problem
https://stackoverflow.com/questions/44339312/new-decoder-returned-1-when-trying-to-run-pocketsphinx-on-raspberry-pi/51346264#51346264