Step 1: List Available Audio Devices
- Open a terminal and run:
cat /dev/sndstat
This will display the list of available sound devices. Look for lines starting with pcm.
Example output:
Installed devices:
pcm0: <Realtek ALC892 (Analog 5.1)> (play/rec) default
pcm1: <NVIDIA (HDMI/DP 8ch)> (play)
pcm2: <USB Audio Device> (play/rec)
The device index corresponds to the number after pcm (e.g., 0 for pcm0).
Step 2: Set the Default Audio Output
- Open /etc/sysrc.conf in your preferred text editor:
sudo nano /etc/sysctl.conf
- Add or update the following line to set the desired default audio device (replace X with the index of the desired pcm device):
hw.snd.default_unit=X
For example, to set the HDMI audio device (pcm1) as default:
hw.snd.default_unit=1
Step 3: Apply the Changes
- Apply the changes immediately without rebooting by running:
sudo sysctl hw.snd.default_unit=X
Replace X with the desired device index (e.g., 1 for pcm1).