Closed ghost closed 8 years ago
I've found a workaround. However, it's not that nice...
So, I tried executing the following script, receiving the exact same error as above:
import pyaudio
import wave
CHUNK = 1024
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 16000
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "output.wav"
p = pyaudio.PyAudio()
stream = p.open(format=FORMAT,
channels=CHANNELS,
rate=RATE,
input=True,
frames_per_buffer=CHUNK)
print("* recording")
frames = []
for i in range(0, int(RATE / CHUNK * RECORD_SECONDS)):
data = stream.read(CHUNK)
frames.append(data)
print("* done recording")
stream.stop_stream()
stream.close()
p.terminate()
wf = wave.open(WAVE_OUTPUT_FILENAME, 'wb')
wf.setnchannels(CHANNELS)
wf.setsampwidth(p.get_sample_size(FORMAT))
wf.setframerate(RATE)
wf.writeframes(b''.join(frames))
wf.close()
However, when I changed RATE to other values like 24000 it worked and created a correct output file.
Therefore, I added
audio:
input_samplerate: 24000
to my ~/.jasper/profile.yml. Now it does not crash anymore.
This is very strange, because arecord -f cd -r 16000 -t wav -d 5 -c 1
works like a charm and also
>>> import pyaudio
>>> _pyaudio = pyaudio.PyAudio()
>>> _pyaudio.get_device_info_by_index(15)["name"]
u'default'
>>> _pyaudio.is_format_supported(input_device=15, rate=16000, input_channels=1, input_format=8)
True
After wondering why recognition does not work at all, I stumbled across #552. Works perfectly fine now :-)
Without this fix, it recognizes really random things.
Hi, I use a raspberry pi 2 and installed Jasper according to these instructions: https://github.com/GeoBeBee/mySystem/blob/master/Jasper-dev_onPocketPhinx_5preAlpha.txt
Everything went fine until the last step. When I try to execute, the following happens:
I guess you might be interested in my alsa config. Here is my /etc/asound.conf:
I hope, you can help me fix this error. arecord and aplay work fine. If you need the output of any other commands, please let me know and I will provide.
Thanks in advance, Andreas