record.py script not running
Hello, Alex!
The record.py script at https://github.com/OpenAcousticDevices/Application-Notes/blob/master/Using_the_AudioMoth_USB_Microphone_Firmware_and_Hardware/record.py is not running. I have tried to fix it with no results. This is the error I get:
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: 2718
Expression 'PaAlsaStream_Configure( stream, inputParameters, outputParameters, sampleRate, framesPerBuffer, &inputLatency, &outputLatency, &hostBufferSizeMode )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2842
Traceback (most recent call last):
File "/home/pi/record.py", line 29, in <module>
stream = audio.open(format=audio_format, rate=sample_rate, channels=number_of_channels, input_device_index=device_index, input=True, frames_per_buffer=chunk_size)
File "/home/pi/.local/lib/python3.9/site-packages/pyaudio/__init__.py", line 639, in open
stream = PyAudio.Stream(self, *args, **kwargs)
File "/home/pi/.local/lib/python3.9/site-packages/pyaudio/__init__.py", line 441, in __init__
self._stream = pa.open(**arguments)
OSError: [Errno -9997] Invalid sample rate
Could you have a look? Any advice is appreciated!
Thanks!
Antonio.
I have discovered the problem: if you have another USB mic connected to the RPi (Raspbian) the script does not run properly. If you disconnect the non-Audiomoth USB mic, it runs ok.