snipsco/snips-record-personal-hotword

Can't get the script running - IOError 9997 Invalid Sample Rate

the-smart-home-maker opened this issue · 1 comments

Hi there,

I can't get the script running as of an invalid sample rate.

Traceback (most recent call last): File "script_recording.py", line 143, in <module> record_and_trim(args.hotword_key) File "script_recording.py", line 80, in record_and_trim record_one(directory, i) File "script_recording.py", line 40, in record_one frames_per_buffer=CHUNK, input_device_index=2) File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 750, in open stream = Stream(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 441, in __init__ self._stream = pa.open(**arguments) IOError: [Errno -9997] Invalid sample rate

I tried to change the sample rate to the default sample rate of my mic (44100) and the it worked and I was able to record the wake word. Unfortunately then I get the following issue when trying to start snips using the key word:

`[13:36:10.156829] ERROR:snips_hotword: Expected wav in form: WavSpec { channels: 1, sample_rate: 16000, bits_per_sample: 16, sample_format: Int } got: WavSpec { channels: 1, sample_rate: 44100, bits_per_sample: 16, sample_format: Int }

[13:36:10.156877] ERROR:rumqtt::client: a06227beece44aa19e8d0bdd677df32a Disconnected: (Error(SyncMpsc(Disconnected), State { next_error: None, backtrace: None }))`

So it seems that snips is expecting a sample rate of 16000. What can I do to make it work? Can I somehow convert the sample rate of my mic to make it work with the script? How can I do that? I am running Raspberry 3 B+ with Stretch.

Thanks and best regards
Daniel

i got this:
Expression 'paInvalidSampleRate' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2048 Expression 'PaAlsaStreamComponent_InitialConfigure( &self->capture, inParams, self->primeBuffers, hwParamsCapture, &realSr )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2719 Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2843 Traceback (most recent call last): File "script_recording.py", line 142, in <module> record_and_trim(args.hotword_key) File "script_recording.py", line 79, in record_and_trim record_one(directory, i) File "script_recording.py", line 39, in record_one frames_per_buffer=CHUNK) File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 750, in open stream = Stream(self, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 441, in __init__ self._stream = pa.open(**arguments) IOError: [Errno -9997] Invalid sample rate