Problem with an audio stream

Hi,

I use Jetson Nano as an online prediction system for audio data and I have encountered the following problem:
An audio stream (PyAudio) is starting just after a boot and sometimes it is blocked and does not send any data. During that blockade I am not able to record even in Audacity. More than that, it could happen after a few hours of working. I have noticed that it is always preluded by the following log in /var/log/syslog:

Jan  8 14:55:17 alpha-desktop kernel: [   39.657424] tegra-xusb 70090000.xusb: WARN: buffer overrun event on endpoint
Jan  8 14:55:18 alpha-desktop kernel: [   39.676556] tegra-xusb 70090000.xusb: WARN: buffer overrun event on endpoint
...
[many lines like above]
... 
Jan  8 14:55:18 alpha-desktop kernel: [   41.302375] tegra-xusb 70090000.xusb: WARN: buffer overrun event on endpoint
Jan  8 14:55:18 alpha-desktop pulseaudio[4401]: [alsa-source-USB Audio] alsa-source.c: Error opening PCM device hw:2: Device or resource busy

My configuration:
Jetpack version: 32.2.1
I use the following multichannel USB soundcard: https://www.diyinhk.com/shop/audio-kits/101-xmos-multichannel-high-quality-usb-tofrom-i2sdsd-spdif-pcb.html
Due to a fact that two processes need the same stream at the same time, I have forked audio in /etc/asound.conf:

pcm.forked_audio {
    type dsnoop
    slave {
	pcm "hw:CARD=D20,DEV=0"
	rate 16000
	channels 8
   }
    ipc_key 555555
    hint.description "forked audio input via dsnoop"
}

During the work of my services:

alpha@alpha-desktop:~$ fuser -uv /dev/snd/*
                     USER        PID ACCESS COMMAND
/dev/snd/controlC0:  alpha   4515 F.... (alpha)pulseaudio
/dev/snd/controlC1:  alpha   4515 F.... (alpha)pulseaudio
/dev/snd/controlC2:  alpha   4515 F.... (alpha)pulseaudio
/dev/snd/pcmC2D0c:   alpha   4607 F...m (alpha)python
/dev/snd/timer:      alpha   4607 f.... (alpha)python

Hi albert_,

Please check the Audio troubleshooting section doc if can gain some ideas: https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%2520Linux%2520Driver%2520Package%2520Development%2520Guide%2Fasoc_driver.17.2.html%23wwpID0E0VD0HA

Hi,

I have tried all of the suggested solutions, even recompiling kernel, and the problem still occurs :(

Hello!

Do you need pulseaudio for your application? Can you try disabling pulseaudio and see if the problem persists …

https://wiki.archlinux.org/index.php/PulseAudio/Examples#Disabling_automatic_spawning_of_PulseAudio_server

Regards,
Jon

I have tried to disable pulseaudio, then I had empty signal on every channel. I don’t know why but it looks like pulseaudio is necessary.

1 Like

When working with same setup, I encountered same problems. Sometimes stream is totally blocked and what is weird, is that there are situations where stream in blocked once and after restarting applications using audio input, everything is working well. However there are situations when stream keeps blocking after each applications’ restart. Anything from Audio troubleshooting seems to have no effect and problem remains the same, also disabling pulseaudio corrupting input signal.

Hello!

Are you using pulseaudio for audio capture? If not can you try …

Listing the audio sources for pulseaudio by …

$ pacmd list-sources

The default source will be indicated by a ‘*’ next to the soundcard ‘index’. I would expect that the default is pointing to your USB device and if that is the case. In my case, with a USB headset connected I see …

$ pacmd list-sources | grep "name:\|index:"                                                                                                                                                                                 
    index: 0
        name: <alsa_output.usb-Logitech_Logitech_USB_Headset_000000000000-00.analog-stereo.monitor>
    index: 1
        name: <alsa_input.usb-Logitech_Logitech_USB_Headset_000000000000-00.analog-mono>
    index: 2
        name: <alsa_output.platform-sound.analog-stereo.monitor>
  * index: 3
        name: <alsa_input.platform-sound.analog-stereo>

In the above the default source is the analog stereo input. If your default is the USB device, then set the default to the analog input …

$ pacmd set-default-source alsa_input.platform-sound.analog-stereo

Then see if you see any more problems with pulseaudio trying to use the USB device. Note that you can also set the default device in /etc/pulse/default.pa as described here so that it always defaults to the same device …

https://wiki.archlinux.org/index.php/PulseAudio/Examples#Set_default_input_source

Regards,
Jon