Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ALSAAudioError: No such file or directory #23

Open
MichielBontenbal opened this issue Oct 26, 2021 · 8 comments
Open

ALSAAudioError: No such file or directory #23

MichielBontenbal opened this issue Oct 26, 2021 · 8 comments

Comments

@MichielBontenbal
Copy link

When testing on the NEW Pi I get the following error:

[/home/pi/.config/pulse/client.conf:26] Unknown lvalue 'utospawn' in section 'n/a'.
Exception in thread captor:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/home/pi/OpenEars/devicehive-dev/audio/captor.py", line 85, in _capture
ad = AudioDevice()
File "/home/pi/OpenEars/devicehive-dev/audio/alsadevice.py", line 28, in init
self.inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NORMAL, device=device)
alsaaudio.ALSAAudioError: No such file or directory [rate16000Hz]

@gmos
Copy link

gmos commented Oct 26, 2021 via email

@gmos gmos closed this as completed Oct 26, 2021
@MichielBontenbal
Copy link
Author

MichielBontenbal commented Oct 26, 2021

I've done the following to solve this issue:

as per the instruction, make sure there is a file /home/pi/.asoundrc.
check with arecord -l the number of the card the UMIK uses.

with nano, change .asoundrc and make sure the following segment is correct (card number in bold:

pcm.umik {
type plug
slave {
pcm "hw:2,0"
rate 48000
channels 2
format S24_3LE
}

@gmos
Copy link

gmos commented Oct 26, 2021 via email

@MichielBontenbal
Copy link
Author

The script works ;-) Data is coming into the IoT Platform. If there are newer instructions, I'll be happy to receive these!

@Bionerdy
Copy link

Bionerdy commented Oct 26, 2021 via email

@gmos
Copy link

gmos commented Oct 27, 2021

Check a recording. Just data coming in is not enough. The input stage of serval does not do its own transcoding currently (has been disabled/commented out). So the incoming data is already expected to be 16 kHz sample rate and mono. This can only work if ALSA already provides the transcoding from UMIK's native 48 kHz stereo (2/3/4?? bytes per sample) to 16 kHz mono, 2 bytes per sample.

Wonder if that works for your patch. You may be mangling the recording data beyond recognition.

This is by the way a murky area in the Serval suite. Many changes have been made as can be seen from the code. Mostly not well documented or propagated to all affected files (like writeups and documentations).

We should consider to clean up / refactor and document this bit thoroughly. It would be a good investment since we will need a good input stage for whatever future classifier we are going to use. I also have read somewhere that the Raspberry guys have decided to swap ALSA for something new (perhaps better). We should verify this and if true perhaps follow this move to new audio libraries.

To check your set-up you might want to write a couple of lines of Python. Just copy the open statement of the audio device from the Serval code and then read a 10 second sample into a buffer. If your config is ok you should get something close to 10 (sec) * 16 * 1024 (samples/sec) * 2 (byte per sample) =about 399 kB. If you get more you are not transcoding properly.

@gmos gmos reopened this Oct 27, 2021
@MichielBontenbal
Copy link
Author

MichielBontenbal commented Oct 27, 2021

Agree 100%. We also discussed this in the summer. This is something we'll have to work on. I'll add some code to the OpenEars audio analysis.ipynb (see folder data science in this repo). Probably ready later this week.
This will be only the first step...

@MichielBontenbal
Copy link
Author

Gijs, see folder datascience for 5 samples we recorded in september and the notebook OpenEars audio analysis.ipynb. I use librosa. the recorded samples have a samplerate=16000 Hz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants