USB Audio broke after latest updates
-
Up until yesterday, my RetroPie arcade was playing all sounds through a C-Media USB Audio interface. I ran an update through the RetroPie Setup menu and it appears to have broken audio. The issue seems connected to the Card/Device Number. To enable sound via the USB card, I had edited the default Card # in
/usr/share/alsa/alsa.conf
from 0 to 1. However when I check what card number it is now, I see it is # 2:
pi@PiArcadev2:~/RetroPie $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1] Subdevices: 4/4 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones] Subdevices: 3/4 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 card 2: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0
I therefore edited the alsa.conf file to point to #2, and rebooted. At first this did not seem to fix the issue, however after a few more attempts and reboots (so I might have touched something else as well), it appears to have fixed the issue.
# AMR: Commented out #defaults.ctl.card 0 #defaults.pcm.card 0 # AMR: Making USB Audio card the default system sound device defaults.ctl.card 2 defaults.pcm.card 2 defaults.pcm.device 0 defaults.pcm.subdevice -1
Does anyone know why it happened (other than the fact I updated the sw)? New RPI audio drivers moving stuff around?
-
https://www.raspberrypi.org/blog/latest-raspberry-pi-os-update-may-2020/
Says that:
One particular change which it is worth pointing out is that we have made a small change to audio. Raspberry Pi OS uses what is known as ALSA (Advanced Linux Sound Architecture) to control audio devices. Up until now, both the internal audio outputs on Raspberry Pi – the HDMI socket and the headphone jack – have been treated as a single ALSA device, with a Raspberry Pi-specific command used to choose which is active. Going forward, we are treating each output as a separate ALSA device; this makes managing audio from the two HDMI sockets on Raspberry Pi 4 easier and should be more compatible with third-party software. What this means is that after installing the updated image, you may need to use the audio output selector (right-click the volume icon on the taskbar) to re-select your audio output. (There is a known issue with Sonic Pi, which will only use the HDMI output however the selector is set – we’re looking at getting this fixed in a future release.)
Some people have asked how they can switch the audio output from the command line without using the desktop. To do this, you will need to create a file called .asoundrc in your home directory; ALSA looks for this file to determine which audio device it should use by default. If the file does not exist, ALSA uses “card 0” – which is HDMI – as the output device. If you want to set the headphone jack as the default output, create the .asoundrc file with the following contents:
defaults.pcm.card 1 defaults.ctl.card 1
This tells ALSA that “card 1” – the headphone jack – is the default device. To switch back to the HDMI output, either change the ‘1’s in the file to ‘0’s, or just delete the file.
However, I tried to follow these instructions and it did not work. When I default to card 2 (as that is where the USB Audio card was showing up as, the card moves to 1, and vice versa.
EDIT: I reverted to modifying alsa.conf since I found out that the .asoundrc in the home folder was only for the specific user (this would have worked fine since I only use a single user on the arcade system however...) and the alsa.conf method is systemwide.
EDIT@: GGGGRRRRRRRRRRRRRRRRRRRR The order of the sound cards keeps changing on me after reboots!!!!! I guess this is a bug, and I hope they fix it soon! A couple reboots ago the USB Card was #2, now it is #1......
pi@PiArcadev2:~/RetroPie $ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1] Subdevices: 4/4 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 card 1: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones] Subdevices: 4/4 Subdevice #0: subdevice #0 Subdevice #1: subdevice #1 Subdevice #2: subdevice #2 Subdevice #3: subdevice #3 pi@PiArcadev2:~/RetroPie $
-
You can configure the sound system to work like before the update by modifying
/boot/cmdline.txt
and adding at the endsnd-bcm2835.enable_compat_alsa=1
If you have a USB soundcard which you'd like to make the default, it would be easier to just disable the onboard sound in
config.txt
, this way you'll have a single audio device. -
@mitu A few days ago I discovered that disabling onboard sound fixed my issue, so I am super glad to see you recommend the same thing as I was wondering how much of a hack my fix was. Thank you!
-
@mitu said in USB Audio broke after latest updates:
You can configure the sound system to work like before the update by modifying
/boot/cmdline.txt
and adding at the endsnd-bcm2835.enable_compat_alsa=1
If you have a USB soundcard which you'd like to make the default, it would be easier to just disable the onboard sound in
config.txt
, this way you'll have a single audio device.@mitu could you please explain how to use new method and keep sound working?
I added suggested line to cmdline.txt and sound starts again but I would like to use the new configuration.
Do I have to create a file called .asoundrc? Could you post an example on how to fill this file to use HDMI or 3,5" jack for sound?
Thanks a lot. -
@pscotto1234 said in USB Audio broke after latest updates:
Do I have to create a file called .asoundrc? Could you post an example on how to fill this file to use HDMI or 3,5" jack for sound?
You don't need to create the file - you can use the Audio menu in RetroPie or start
Raspi-config
from the same RetroPie menu and - in both options - choose your desired audio output.
NB: make sure you've updated to the latest version of RetroPie-Setup. -
@mitu said in USB Audio broke after latest updates:
@pscotto1234 said in USB Audio broke after latest updates:
Do I have to create a file called .asoundrc? Could you post an example on how to fill this file to use HDMI or 3,5" jack for sound?
You don't need to create the file - you can use the Audio menu in RetroPie or start
Raspi-config
from the same RetroPie menu and - in both options - choose your desired audio output.
NB: make sure you've updated to the latest version of RetroPie-Setup.Ok. I’ll try. Thanks a lot!
-
@mitu said in USB Audio broke after latest updates:
@pscotto1234 said in USB Audio broke after latest updates:
Do I have to create a file called .asoundrc? Could you post an example on how to fill this file to use HDMI or 3,5" jack for sound?
You don't need to create the file - you can use the Audio menu in RetroPie or start
Raspi-config
from the same RetroPie menu and - in both options - choose your desired audio output.
NB: make sure you've updated to the latest version of RetroPie-Setup.@mitu removing the line in /boot/cmdline.txt there is no way to have audio in EmulationStation.
Any suggestion? -
@pscotto1234 said in USB Audio broke after latest updates:
Any suggestion?
Wait for an update to EmulationStation to solve this part.
EDIT: or you can manually modify the config file to set the AudioDevice to 'HDMI'.
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.