skip navigation

www.Hilands.com


Content:: Audio only works for one application

Audio only working for one application
OS: Debian Wheezy (7.x)
Last Modified: 2013-07-26

I recently upgraded the Debian Wheezy and ran into an issue where I could only play audio from one application. The audio would then work for another application and stop for another. I started digging into the new "pulseaudio" configurations and realized the applications failing were being funneled through pulseaudio. Searching a little more I found pulseaudio was sending my audio output through my HDMI port on my video card. After digging around I found a site explaining how to disable the audio on an NVIDIA card here. The solution was simply removing the video cards HDMI audio port!

Table of Contents
Debugging
Being clueless on my problem the first thing I did was find some VLC Pulse downloads in the repository # apt-get install vlc-plugin-pulse

Needing to do some testing I had to figure out how pulseaudio worked. It's pretty simple, when an audio need is initiated, the pulseaudio daemon starts up! It can be found with "ps aux | grep pulse" I wanted a quick way to kill it so I decided to use a little bit of grep, head and awk to find and kill the first "pulse" process I found. $ kill -9 `ps aux |grep pulse | head -n 1 | awk {'print $2'}`
After a few hours of using this command I found pulseaudio has a built in way to find and kill itself! $ pulseaudio -k
After killing the process you can restart it with $ /etc/init.d/pulseaudio However I'm not sure starting pulseaudio really does anything as it is triggered whenever an audio request is initiated.

In /usr/share/alsa there are a handful of configuration files.
The first configuration file to note is alsa.conf
This configuration file grabs configurations from
  • /usr/share/alsa/alsa.conf.d/
  • /etc/asound.conf
  • ~/.asoundrc
The conf and RC files didn't exist so the next place to look was the in alsa.conf.d folder.
I found information about turning pulse of by removing these configuration files. # cd /usr/share/alsa/alsa.conf.d/
# mkdir ../alsa-conf.d-removed
# mv *pulse* ../alsa-conf.d-removed


libao.conf has a default_driver that you can set to alsa or pulse! For me it was defaulted as alsa. # nano /etc/libao.conf
default_driver=pulse


This however didn't solve my issue. VLC reported issues with the audio device
Audio output failed:
The audio device "sysdefault:CARD=PCH" could not be used:
Device or resource busy.

There are a few commands to configure and deal with pulse audio # pactl
# pacmd
We can see what current "Audio Sinks are being used" # pacmd list-sinks
While the pulseaudio process is running you can set a default sink # pacmd set-default-sink <SINKNAME> While the pulseaudio process is running we can set the default source #pacmd set-default-source <SOURCENAME>
Starting to debug using VLC. Running VLC in the command line, we can change the verbose output to see what is going on. vlc --verbose=2 Looking at the output flying across the screen we can see vlc tries to go through the HDMI audio on the video card.
[0x26c4d58] pulse audio output debug: listing sink alsa_output.pci-0000_01_00.1.hdmi-stereo (0): Barts HDMI Audio [Radeon HD 6800 Series] Digital Stereo (HDMI)


It seems like we could set the default source to the motherboards video card. However I think the removal of the audio device is a cleaner solution (see below)
Removing an audio device
Using lspci we can find the devices our system knows about. # lspci |grep -i audio In my case I found an AMD video card with HDMI audio and the built in Intel Audio card.
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)
01:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI Barts HDMI Audio [Radeon HD 6800 Series]
We will want to set a remove flag where the device data resides. Search for the first set of numbers from the lspci output in the /sys/devices/ folder. # find /sys/devices -name *01:00.1 Our output shows a lengthy folder path.
/sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1
If you go into the folder you will see a file named remove that is writeable by the root user and root group. # cd /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1
# ls -l |grep remove
--w--w---- 1 root root  4096 Jul 26 19:41 remove

We will need to add the number 1 to the file "remove", in the folder we discovered above, to flag the device not to load by the kernel. # nano /etc/rc.local The file should be empty, outside of some comments and an exit 0 command. Add the following above exit 0.
echo 1 > /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.1/remove
Reboot your system and the device should be removed.
Verify this with lspci $ lspci | grep -i audio Our output only shows one device now!
00:1b.0 Audio device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller (rev 05)
References