How to set default audio output on Raspberry Pi to hdmi?

Viewed 6518

if I execute: speaker-test -D plughw:1,0 -t wav , sound gets played over the hdmi cable, as it is supposed to.

But if I type speaker-test -t wav , no sound gets played over the hdmi cable, so I guess the issue is the default output device.

Here is a list of what I've already tried:

  • change the output device in the top left corner on the Desktop
  • execute amixer cset numid=3 2 in the console
  • uncomment those 2 lines in the config: hdmi_drive=2 hdmi_force_hotplug=1
  • change to those 2 lines in the alsa.conf file: defaults.ctl.card 1 defaults.pcm.card 1 (also tried with 2 instead of 1)

My goal is to later play sound over a browser, but chrome seems to only be able to output sound over the default audio output device, so I guess I somehow need to change it.

I am a noob, so please tell if me if you need more informations and how to get them.

If anyone has some hits on how to solve this issue, I'd be really grateful

1 Answers

had the same problem (PI 4, Bullseye).
what helped was:
sudo raspi-config

  • 1. System options  
    
  • S2. Audio
    
  • Select HDMI Option (In my case it was HDMI 2, because default output was on HDMI 1)
    

After that default output worked. Everything else (changing config.txt or alsa.conf) wasn't necessary in my case.

reference: Raspberry Pi Configuration

Related