There is no audio driver when I try to use play my .wav file in jetson container

Hi,

I try to access my audio driver via the below command:
test_audio.py

import pygame
file = '1.wav'
pygame.init()
pygame.mixer.init()
pygame.mixer.music.load(file)
pygame.mixer.music.play()

I could use the above code in the terminal when I am not access the container, but after accessing the container, I could not play it.

The error that I received was:
pygame.error(): no audio driver

Solution which I tested:

import os
os.environ['SDL_AUDIODRIVER'] = 'dsp'
cat /proc/asound/cards 

The above code could not work too but it work when I try it on the terminal without accessing the container

Hi,

You will need to mount the nodes to get access within the container.
Could you check the below topic for information first?

Thanks.

Thank you and yes, I refered to it and trried the below code but still failed’;

sudo docker run -it -v /home/jetson/work:/work -d --name test_audio --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix/:/tmp/.X11-unix --runtime nvidia -v /usr/lib/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu -v /lib/aarch64-linux-gnu:/lib/aarch64-linux-gnu --device=/dev/snd -v /dev/snd:/dev/snd:ro --device=/dev/bus/usb -v /dev/bus/usb:/dev/bus/usb:ro --device /dev/video0:/dev/video0:mwr --network host nvcr.io/nvidia/l4t-pytorch:r32.5.0-pth1.7-py3 /bin/bash

Also, i try to check:
arecord -l
and below is my output:

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

it did not show my usb speaker.

I’m closing this topic due to there is no update from you for a period, assuming this issue was resolved.
If still need the support, please open a new topic. Thanks

Hi,

Could you play the wav file inside the container with aplay?
Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.