0

I am using an external USB sound card with my Raspberry Pi 4 and play music using pygame. To set the audio output from the 3.5 mm minijack to the USB sound card I first checked the available outputs using aplay -l. It lists the 3.5 mm minijack as card 0 and my USB sound card as card 1. I therefore updated the file /etc/asound.conf with the following:

pcm.!default {
    type hw
    card 1
}

ctl.!default {
    type hw           
    card 1
}

And it worked! Then I rebooted (gracefully, didn't pull the plug), and it no longer works... When I try to play music using pygame I get the following error message:

pygame.error: No available audio device

I then updated the /etc/asound.conf file to set the sound output back to card 0 and I could then play music using the 3.5 mm minijack. Now setting it back to card 1 again (without reboot) I get the same error message. I've also verified using aplay -l that both audio outputs are still present. This seems incredibly strange as it did work, but now it won't anymore. Anyone experienced the same?

1 Answer 1

2

Turns out an audio jack has to be connected when the python script is running in order for the USB sound card to be working. Strange, but works for what I'm trying to do. When configured to use the internal 3.5 mm minijack port this is not needed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.