Troubleshooting audio problems in Linux.

dos2unix

Well-Known Member
Joined
May 3, 2019
Messages
4,408
Reaction score
4,601
Credits
41,638
This is a big subject, and this post can't cover all possibilities. But it's a good place to start. I see a lot of "My audio isn't working in Linux" posts. Most of this will be done from the command line. This eliminates layer of complexity.

Here are some things to try, before you ask for more help. Running these commands will help other people help you.
First, what kind of sound hardware do you have?
Code:
sudo lspci | grep -i audio

This should return something similar to this. You may have more or less devices, but you need at least one.
Code:
2e:00.1 Audio device: NVIDIA Corporation TU104 HD Audio Controller (rev a1)
30:00.4 Audio device: Advanced Micro Devices, Inc. [AMD] Starship/Matisse HD Audio Controller

Next, are the drivers for that audio device loaded into my kernel?
Code:
sudo lsmod | grep snd

This can return qute a bit of "stuff".
Code:
snd_seq_dummy          12288  0
snd_hrtimer            12288  1
snd_hda_codec_realtek   221184  1
snd_hda_codec_generic   131072  1 snd_hda_codec_realtek
snd_hda_scodec_component    20480  1 snd_hda_codec_realtek
snd_hda_codec_hdmi    102400  1
snd_hda_intel          69632  4
snd_usb_audio         614400  2
snd_intel_dspcfg       45056  1 snd_hda_intel
snd_intel_sdw_acpi     16384  1 snd_intel_dspcfg
snd_usbmidi_lib        57344  1 snd_usb_audio
snd_hda_codec         225280  4 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek
snd_ump                49152  1 snd_usb_audio
snd_rawmidi            57344  2 snd_usbmidi_lib,snd_ump
snd_hda_core          155648  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek
snd_hwdep              20480  2 snd_usb_audio,snd_hda_codec
mc                     90112  1 snd_usb_audio
snd_seq               135168  7 snd_seq_dummy
snd_seq_device         16384  3 snd_seq,snd_ump,snd_rawmidi
snd_pcm               196608  5 snd_hda_codec_hdmi,snd_hda_intel,snd_usb_audio,snd_hda_codec,snd_hda_core
snd_timer              53248  3 snd_seq,snd_hrtimer,snd_pcm
snd                   159744  28 snd_hda_codec_generic,snd_seq,snd_seq_device,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_usb_audio,snd_usbmidi_lib,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_ump,snd_pcm,snd_rawmidi
soundcore              16384  1 snd

Again, you may have more or less, but you should at least have something here. The dummy and timer devices will be there even if nothing else is. Those don't help much.

Well, OK, my computer knows I have audio hardware. But does Linux know about it?
Code:
sudo aplay -l

This should return a list similar to ths.
Code:
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

This command is similar, but only for recording/capture devices.
Code:
arecord -l

This might return something like.
Code:
**** List of CAPTURE Hardware Devices ****
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 2: ALC1220 Alt Analog [ALC1220 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: DeviceEcho058 [USB PnP Device(Echo-058)], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

If you've gotten this far, you are usually in pretty good shape. Now it's probably just configuration and adjusting volume levels.
This next command doesn't work on all distro's. So if you get no output, don't worry. But it's helpful if it does work.
Code:
pactl info | grep "Server Name"

If that doesn't work, we can try to do that a little differently.
First, we will look for a pulseaudio server.
Code:
systemctl --user status pulseaudio

If that doesn't return anything, don't panic yet. My computer doesn't return anything from that command.
So next, we will look for pipewire.
Code:
systemctl --user status pipewire-pulse

This might return something like...
Code:
○ pipewire-pulse.service - PipeWire PulseAudio
     Loaded: loaded (/usr/lib/systemd/user/pipewire-pulse.service; disabled; preset: disabled)
    Drop-In: /usr/lib/systemd/user/service.d
             └─10-timeout-abort.conf
     Active: inactive (dead)
TriggeredBy: ○ pipewire-pulse.socket

Now you should know more information to help us. What Linux distro are you using?
Code:
cat /etc/os-release

There have been cases, believe it or not, where the firewall has blocked sound on some distro's.
You can try disabling the firewall to see if it helps. (This usually isn't a problem in you're running firewalld).
Code:
sudo ufw disable

For some audio devices, especially SoundBlaster cards, you might need to install the alsa-firmware.
Debian/Mint/Ubuntu
Code:
sudo apt-get install alsa-firmware

Fedora/Redhat/Rocky/Oracle
Code:
dnf install alsa-firmware

Well, OK I checked all of that, and everything looks good. But I still got no sound. What else can I look at?
Code:
alsamixer

That should bring up a screen like this.
1739975174141.png


In my case, it selected the wrong sound card. How can we fix this? Press your [F6] function key that top of your keyboard.
Now you should see a list of audio devices.
1739975281790.png


Use your up and down arrow keys to pick the one you want. Depending on how many channels your audio device has, you might see something like this.
1739975510637.png


Sometimes you will only see left and right. That's OK, at least you have sound channels. Well here is a problem, and default volumes on all channels are pretty low, no wonder I can't hear anything. Let's turn things up. Use your right and left arrow keys to select the channel. Then use your up and down arrow keys to crank up the volume. My headphones, and my microphone are set to zero volume. Let's fix this.
1739975790070.png


Ahhh... much better. Everything is turned up now. But I turned up my front Microphone a little too far. (I did it on purpose so I could mention it here) if you see red at the top, It might overload your audio device and cause distortion. I recommend turning the volume down to at least the "white" levels. Now amazing enough, my headphones are working when I play audio. All I needed to do was adjust the volume here. Press the [Esc] key to exit alsamixer.

Now go back into your music player. (vlc or whatever you like) and see if it's working now. If not, at least you know a lot more information to start doing more serious troubleshooting.

Remember before you ask for help. What distro? What soundcard? What audio server? Are the kernel drivers loaded?

Happy Linux'ing. :cool:
 

Attachments

  • 1739975365249.png
    1739975365249.png
    48.4 KB · Views: 258
Last edited:


That was a very comprehensive stack of instructions and help. Thank you so much.

I was able to follow exactly what you did and came up with the same results.
Sadly still no sound, although there are the odd clicks when something happens on the computer.
I am going to leave it for the time being, but will return when my head is not where it is at the moment.
My thanks again.
 
Thank you Mike.
Here is a screen shot I took following your instructions. As you can see, it is detecting the Realtek sound card, but even when I adjusted the levels as you suggested there is still nothing coming from the speakers.

Would it help if I found another version of Linux to try and solve this problem?
1744270167341.png
 
Would it help if I found another version of Linux to try and solve this problem?

If you're looking for another distro, Debian comes with wide hardware support and provides a ton of packages for missing firmware or drivers:

Debian has extensive Hardware Support.
Most hardware is supported by the Linux kernel which means that Debian will support it as well. Proprietary drivers for hardware are available if necessary.
 
This goes to show one thing. No matter what "sound-server" you have on top.....PulseAudio, Pipewire, whatever.....they ALL still run on top of ALSA itself (the Advanced Linux Sound Architecture).

I appreciate & understand WHY these "sound-servers" have evolved. Because ALSA, by itself, can be incredibly complicated & convoluted to unravel & trouble-shoot. So the sound-servers simplify that, presenting it all as a GUI that even noobs can usually get the hang of (with a little help).

Me, I tend to side-step a lot of this. With the exception of the internal card (which only really gets used for playback), all my other audio devices are USB-based, with their own built-in audio cards & relatively simple-to-use controls. Together with the use of "aplay -l" & "arecord -l".....and some creative scripting involving "amixer"!.....I can get everything audio-related done that needs doing.

All I need to do is select the appropriate card and adjust the settings. As I so often say, it "works" for me.

~~~~~~~~~~~~~~~~~~~~~~~​

For recording, say with screencasts, etc, I usually just have a 'voice-over'. Thus, I have the stereo mikes on the c920 webcam set up to do this.

Given that audio levels on many USB-connected audio devices never seem to stay where you left 'em, I have a wee script which runs at boot, that basically "resets" the input level for the webcam:-

Code:
#!/bin/sh
amixer -c 3 -- sset 'Mic',0 Capture 56
#
sleep 2
#
/root/my-applications/bin/VuStart

I've named this 'CamVolSet.sh'. Puppy has a user-directory in /root (remember, Puppy runs AS /root OOTB) called 'Startup'. Anything you place in this directory will auto-execute after Xorg/X11 has fired-up, so CamVolSet.sh (which lives in /usr/local/bin) is sym-linked into /root/Startup.

'VuStart' is a script which runs an animated GIF on the desktop for a few seconds, to let me know the webcam's mike input level has been reset. I DO like my 'eye-candy'!

VuStart.gif


I build the 'frame' in MooiTech's PhotoScape, running under WINE. I either 'source' a suitable GIF online, or I'll cut-out a suitable short section of video using Avidemux & turn it into a GIF with another Puppy-native utility. I then 'embed' the GIF into the PNG 'frame' using the GIMP, and re-export the finished item as a GIF.

I do no END of this kinda stuff.....courtesy of my long-standing interest in graphic design (which began in the mid-to-late 70s). Looong time ago!

As always.....it 'works' for me.


Mike. ;)
 
Last edited:


Follow Linux.org

Members online


Top