If you have more than one soundcard the default one that Ubuntu chooses is not always the one you want. Here is how to change that in the GUI or command-line.
With the pavucontrol App
Install pavucontrol (
apt install pavucontrol) and on the Output devices tab, toggle the “Check” button next to the little lock, on the device you want to mark as the default. Same for Input devices.
It is aa good idea to also go to the Configuration tab and set the other cards to off. Specifically, HDMI often includes a video card (as audio) and a main CODEC as well. They are both ALSA cards and most advice (like referenced AskUbuntu in another answer) do not tell you how to change the card.
You can control PulseAudio thoroughly through the command line using
pactl commands. For options see
pacmd --help or
pactl --help the wiki at PulseAudio:
pacmd list-sinks for name or index number of possible sinks
pacmd list-sources for name or index number of possible sources
pacmd set-default-sink "SINKNAME" | index to set the default output sink
pacmd set-default-source "SOURCENAME" | index to set the default input
pacmd set-sink-volume index volume
pacmd set-source-volume index volume for volume control (
65536 = 100 %,
0 = mute; or a bit more intuitive
0x10000 = 100 %,
0x7500 = 75 %,
0x0 = 0 %)
Note: Changing the output sink through the command line interface can only take effect if stream target device reading is disabled. This can be done by editing the corresponding line in
load-module module-stream-restore restore_device=false
Restart PulseAudio for changes to take effect: