I use a headset to make phone calls and when they are mono the great awesomeness of the Linux audio stack seems to change volume only on the active channel (e.g. the right channel). So when I listen to some music (stereo) afterwards the channels are not balanced anymore and one side is louder than the other. And this persists thanks to saving the preferences across reboots. Duh.
As usually checking Pulseaudio (pavucontrol) is useless, it shows balanced channels.
But checking Alsa (alsamixer) revealed the issue and alsamixer can fix this, too:
Step 1: run
alsamixer in a terminal and select your headset after pressing [F6]:
Step 2: Select the headset audio output with [<-] and [->] cursor keys:
Step 3: Press [b] to balance the left and right channels:
Step 4: Press [Esc] to exit
alsamixer which will keep the changed settings (... great choice of key, [q] raises the left channel's loundness ...).
Step 5: Save this setting by running
sudo alsactl store which should update
/var/lib/alsa/asound.state with the fixed settings so they persist across reboots.
Step 6: Enjoy music again .
If you need to script this,
amixer is the tool to use, e.g.
amixer -c 1 set "Headset" 36.
1 is the card number which you see in
alsamixer, "Headset" is the channel name, also from
alsamixer (which can contain blanks, hence the quotes around the name) and 36 is the desired loundness level for both channels. See the screenshots above where to find the data or run
aplay -l to see the cards on your PC and
amixer -c 1 (with your card id) to see the channels that (virtual, USB) sound card has.