Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
    Bumped by Community user
3 replaced http://raspberrypi.stackexchange.com/ with https://raspberrypi.stackexchange.com/
source | link

So, I tried to put stream.read(0) as said in the comments section in this question : http://raspberrypi.stackexchange.com/questions/62962/pocketsphinx-alsa-ioerror-9997-while-trying-to-decode-speech?noredirect=1#comment98784_62962PocketSphinx - ALSA IOError: -9997 while trying to Decode Speech . When i do that, the program stops running with displaying this:

So, I tried to put stream.read(0) as said in the comments section in this question : http://raspberrypi.stackexchange.com/questions/62962/pocketsphinx-alsa-ioerror-9997-while-trying-to-decode-speech?noredirect=1#comment98784_62962 . When i do that, the program stops running with displaying this:

So, I tried to put stream.read(0) as said in the comments section in this question : PocketSphinx - ALSA IOError: -9997 while trying to Decode Speech . When i do that, the program stops running with displaying this:

2 edited title
| link

Pocketsphinx not working, dmix plugin only supports playback streamworking; Input Overflowed -9981

1
source | link

Pocketsphinx not working, dmix plugin only supports playback stream

I am trying to use pocketsphinx in Python using the code given below:

#!/usr/bin/python

from os import environ, path

from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *

MODELDIR = "pocketsphinx-5prealpha/model"
DATADIR = "pocketsphinx-5prealpha/test/data"

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'))
config.set_string('-logfn', '/dev/null')
decoder = Decoder(config)

import pyaudio
p = pyaudio.PyAudio()
stream = p.open(format=pyaudio.paInt16, channels=1, rate=44100,     input=True, frames_per_buffer=1024)
stream.start_stream()

in_speech_bf = False
decoder.start_utt()
while True:
    buf = stream.read(0)
if buf:
    decoder.process_raw(buf, False, False)
    if decoder.get_in_speech() != in_speech_bf:
        in_speech_bf = decoder.get_in_speech()
        if not in_speech_bf:
            decoder.end_utt()
            print 'Result:', decoder.hyp().hypstr
            decoder.start_utt()
else:
    break
decoder.end_utt()

The reason why I gave stream.read(0) is because whatever number i put for it(I tried 512-32768), it gives me input overflowed. This is the error i get when i put stream.read(1024):

Traceback (most recent call last):
  File "nnntest.py", line 26, in <module>
    buf = stream.read(1024)
  File "/usr/lib/pymodules/python2.7/pyaudio.py", line 564, in read
    return pa.read_stream(self._stream, num_frames)
IOError: [Errno Input overflowed] -9981

So, I tried to put stream.read(0) as said in the comments section in this question : http://raspberrypi.stackexchange.com/questions/62962/pocketsphinx-alsa-ioerror-9997-while-trying-to-decode-speech?noredirect=1#comment98784_62962 . When i do that, the program stops running with displaying this:

ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2217:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm_hw.c:1401:(_snd_pcm_hw_open) Invalid value for card
ALSA lib pcm_hw.c:1401:(_snd_pcm_hw_open) Invalid value for card
ALSA lib pcm_dmix.c:957:(snd_pcm_dmix_open) The dmix plugin supports only playback stream

I've got a big project to complete and any help is appreciated! What should i do?