How to record sound by usb mic device in docker on Jetson Nano

I’d like to record sound by arecord command in docker container on Jetson Nano but I can’t.

When I execute arecord on the shell in docker, following error happens.

arecord: main:788: audio open error: No such file or directory

I think that I need only options ’ --device=/dev/snd --previreged’ but it seems not valid. Base image is nvcr.io/nvidia/l4t-base:r32.3.1.

Please let me know valid option set to access USB mic device.

Hello!

Can you tell me what the following command shows …

$ arecord -l

Regards,
Jon

Hi Jon,
Thanks for your response.

root@nvidia-desktop:/build# arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 0: ADMAIF1 CIF ADMAIF1-0
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 1: ADMAIF2 CIF ADMAIF2-1
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 2: ADMAIF3 CIF ADMAIF3-2
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 3: ADMAIF4 CIF ADMAIF4-3
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 4: ADMAIF5 CIF ADMAIF5-4
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 5: ADMAIF6 CIF ADMAIF6-5
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 6: ADMAIF7 CIF ADMAIF7-6
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 7: ADMAIF8 CIF ADMAIF8-7
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 8: ADMAIF9 CIF ADMAIF9-8
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: tegrasndt210ref [tegra-snd-t210ref-mobile-rt565x], device 9: ADMAIF10 CIF ADMAIF10-9
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: Array [Azure Kinect Microphone Array], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

I’d like to use card2 device and I confirmed that arecord works on host side.

Regards,

I continued trying that asound command works properly.

Using following options, I succeeded to let asound be able to work.

–net=host --runtime=nvidia -v /usr/lib/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu -v /lib/aarch64-linux-gnu:/lib/aarch64-linux-gnu -v /tmp/.X11-unix:/tmp/.X11-unix:rw --device=/dev/snd -v /dev/snd:/dev/snd:ro --device=/dev/bus/usb -v /dev/bus/usb:/dev/bus/usb:ro -e DISPLAY=:0 --device=/dev/video0 -v /lib/udev:/lib/udev:ro -v /lib/modules:/lib/modules:ro -v /etc/asound.conf:/etc/asound.conf:ro --privileged -it nvcr.io/nvidia/l4t-base:r32.3.1

※ I don’t know this options are minimum set.

But after several attempts, it stops working with error message.

arecord: main:788: audio open error: No such file or directory

Once this error occurs, it will not work properly until I start over Jetson Nano from the first setup and I’ve not found a trigger of fail happen.

I suspicious that arecord fails to close USB device during running then fails to open it at next running time.

Hello!

Can you try …

$ arecord -D hw:2,0 -c 2 -r 48000 -f S16_LE -d 10 cap.wav

Thanks
Jon