Today I spent hours debugging the digital audio output on my XBMC system running Ubuntu 8.10 (Intrepid Ibex). It turned out the fix was a simple one line command to set the mode of the IEC958 port. In this post I wanted to document a simple set of steps to debug audio output problems in Linux for anyone in a similar situation.
The symptoms of the issue began when all XBMC audio from the digital coax became disabled, with the exception of DVD movie audio (that is AC3/DTS streams only). Getting at least some audio was a helpful start, and it meant the audio kernel module was still loading correctly. Knowing this, I assumed a system setting (either in ALSA or XBMC) had been misconfigured, even though I hadn't made any system changes before the problems.
Since not everyone will be able to test DVD audio output right away, the process below shows you how to first check the detected audio hardware (if any) in your system. Then it steps through other issues that may be blocking a digital audio output device.
Step 1: Setup
First off, make sure you have the ALSA tools installed to help debug the sound hardware.
sudo apt-get install alsa-utils
Step 2: Hardware
Test the state of your current sound hardware. A problem in this area indicates either that your ALSA driver is not working, or not installed. Run the command:
aplay -l
You should see output as shown:
**** List of PLAYBACK Hardware Devices **** card 0: VT82xx [HDA VIA VT82xx], device 0: ALC861 Analog [ALC861 Analog] Subdevices: 0/1 Subdevice #0: subdevice #0 card 0: VT82xx [HDA VIA VT82xx], device 1: ALC861 Digital [ALC861 Digital] Subdevices: 1/1 Subdevice #0: subdevice #0
The output above tells me that I have two(2) devices, labeled "ALC861 Analog" and "ALC861 Digital". We are only interested in the digital device for now. If you have no devices, or no digital device, than there is something wrong with your ALSA driver.
One item of note, are the "card" and "device" values. If you would like to explicitly access the device then use these values in the form, hw:<CARD,DEVICE>. For example, the digital device on my system would be hw:0,1
Problem: No device listed
In this case your best bet is to find out what audio hardware you have and either search Google or the ALSA website. Your audio hardware can be found with the command:
lspci -v | grep Audio
Problem: Only analog device listed
If you have an analog device, and no digital device. Then its possible that adding an argument when loading the audio driver module will resolve this. In the case of my ALC861 device driver module, it accepts the argument "model=3stack-dig". More information on this step can be found in the ALSA Configuration Guide
Step 3: Mixer Setup / IEC958 Setup
Assuming the last step worked, now make sure the mixer settings are correctly set. The easiest way to do this is to run:
alsamixer
Make sure that the output devices are unmuted including the IEC958 device. A picture of my settings are shown:
Second, you must verify the state of the IEC958 (digital out) device using the command:
iecset
which will produce the output:
Mode: consumer Data: audio Rate: 48000 Hz Copyright: permitted Emphasis: none Category: PCM coder Original: original Clock: 1000 ppm
Verify that the Data value is set to audio. If it is not set, then run the command:
iecset audio on
My ultimate problem was that this value was not set correctly. Somehow it had switched to non-audio, make sure you check this!
Step 4: Asound.conf
ALSA allows for a set of configuration files to create/modify plugins to the audio hardware layer. These plugins can perform rate conversion and add multi-source mixing capabilities. For now, I will recommend disabling then, as they could introduce unknown problems for now. The ALSA configuration files should either be removed or renamed on your system, until you can verify that the audio hardware is working. The locations of these files are:
- /etc/asound.conf
- ~/.asoundrc
Step 5: Test Audio Playback
This is the final step to verify your IEC958/spdif/Digital audio output is working. Before running these commands, it would help (though not required) to stop any processes that could be using the sound hardware. If you hear sound after this point, then you are likely done (or very close). You can use any of these commands to test for sound output:
aplay -D default /usr/share/sounds/alsa/Front_Center.wav aplay -D plug:spdif /usr/share/sounds/alsa/Front_Center.wav aplay -D plug:iec958 /usr/share/sounds/alsa/Front_Center.wav aplay -D hw:0,1 /usr/share/sounds/alsa/Front_Center.wav
Step 6: Playback Software Setup
I am including this section to cover the settings I am using for Digtal Audio in XBMC. Simply navigate to Settings->Systems->Audio Hardware:
- Audio Ougput ->
Digital - Dolby Digital AC3 Capable Receiver ->
ON - DTS Capable Receiver ->
ON - Audio Output Device ->
default - Passthrough Output Device ->
iec958
3 comments:
Thanks for a great post. "iecset audio on" solved all my problems :)
Hi, using fujitsu siemens amilo pa1510, audio codek realtek alc861, digital output not working, tryed everything, nothing works, loosing hope... where could be the problem?
Analog output works? What driver? Did any of the above steps behave differently on your system?
Post a Comment