sys·ad·min·ol·o·gy [sis-ad-mih-nol-uh-jee]

noun

  1. The scientific study of system administration and related phenomena.

Sunday, 19 October 2014

Gentoo, alsasound & Chromium No Sound From Flash

I recently upgraded my PC and needed to re-install a things to get my KDE based Gentoo desktop working. One of those was alsasound. All went fine until I tried watching a video on YouTube. I got no audio.

So here's my check list for diagnosing sound problems with alsasound

No Audio Checklist

  1. Go to system settings->Multimedia->Audio and Video Settings and choose Audio Playback. In the right hand pane it should list the devices you have on your PC.
  2. Mine consisted of this:
    1. HDA Intel PCH
    2. HDA Intel PCH ALC662 rev1 Analog (Default Audio Device)
    3. default
    4. hw:0,0
    5. hw:1,3
    6. .. Other NVidia related devices.

      Click on each device in turn, and click on the "Test" button at the bottom of the list. Oh and make sure you're speakers are switched on! ;-)
  3. For me, I got sound from HDA Intel PCH (ALC662..) (e.g. from entries 1 and 2) I also got sound from hw:0,0 but critically, I DID NOT get sound from default.
  4. Do you get sound from an application playing a video/audio file? I installed VLC and loaded up a video, sure enough, I got audio.
  5. Next, lets see what we can get from alsa-utils speaker-test utility:
    1. Running this as my user

      speaker-test -t wav -c 2

      Resulted in no audio. However running it as root, produced audio! Strange, and possibly pointing to a rights issue.
  6. Checking the man page of speaker-test showed that you can specify which device to output the audio on via the -D flag. So running speaker test again as my user

    speaker-test -D hw:0,0 -t wav -c 2

    I got audio! Some progress! According to the alsa sound documentation,  "The keyword default is defined in the ALSA lib API and will always access hw:0,0" So what's going on?
  7. Hard to say, but .asoundrc comes to the rescue. I noted earlier whilst in KDE that the device named "default" DID NOT produce any output. Note this is NOT the same as "HDA Intel PCH ALC662 rev 1 Analog" Which is marked with (Default Audio Device) its the entry at 3 called "default".

    Reading the online documentation about .asoundrc showed that its possible to create aliases for your sound cards. E.g. "Surround 5.1, Surround 7.1, Stereo" and so forth. It occurred to me that "default" is in fact just such an alias, (In fact its mentioned and getting it working was simply a matter of overriding it.
  8. I put this in my ~/.asoundrc:

    pcm.!default {                                                                        type hw
         card 0                                                                          device 0
    }

  9. Then restart the alsasound service (/etc/init.d/alsasound restart) - This causes alsasound to re-read .asoundrc
  10. If chromium is still open, close it and start it again. Check out a video on YouTube and hopefully, you will have audio!

No comments:

Post a Comment