Friday, September 26, 2008

How to set up both analog and digital out in Ubuntu


Wanted to get S/Pdif / digital output to my 2 channel DAC, while maintaining my analog output/ line out


First check what your devices are:type in terminal: aplay -l

Result:

**** List of PLAYBACK Hardware Devices ****
card 0: ICH5 [Intel ICH5], device 0: Intel ICH [Intel ICH5]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: ICH5 [Intel ICH5], device 4: Intel ICH - IEC958 [Intel ICH5 - IEC958]
Subdevices: 1/1
Subdevice #0: subdevice #0


Note that device 4 is my digital audio device: IEC958.
First I set the sound preferences in System to IEC 958; this made the digital out active.
But no sound anymore on my pc speakers connected to analog audio out or line out.
So I found this suggestion: create in ~/.asoundrc the following code (type in terminal: sudo gedit ~/.asoundrc):
pcm.!default {
type plug
slave.pcm ttable

}

pcm.ana {
type hw
card 0
device 0
}

pcm.digi {
type hw
card 0
device 4
format S16_LE
rate 48000
}

pcm.both {
type multi
slaves {
a {
pcm "digi"
channels 2
}
b {
pcm "ana"
channels 2
}
}
bindings {
0 {
slave a
channel 0
}
1 {
slave a
channel 1
}
2 {
slave b
channel 0
}
3 {
slave b
channel 1
}
}
}

pcm.ttable {
type route
slave.pcm "both"
ttable.0.0 1
ttable.1.1 1
ttable.0.2 1
ttable.1.3 1
}

Note that I set my digital device to 4. It may be 2 or another one in your case.
(source: http://sudan.ubuntuforums.com/showthread.php?t=875268&s=bd8557c7e7f2df6b1627e997a1a82f62&

I had set my sound preferences back to ALSA. So now I had sound on the analog output, but not on the digital output. I installed gnome alsa mixer (via synaptic) and set it to work(applications, multimedia).
And found out that the volume of the ICP958P was zero. Changing that I had sound both analog and digital...







+++++++++++++++++++++++++++++++++++++++++++++++++++



The following was a digression that didn'tlead to a solution for me. But maybe for others:

Found this bug report:


Hardy beta, clean install.

ALSA sees the integrated sound card in my system and its analog and digital outputs, with no problem:

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: ALC883 Analog [ALC883 Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: ALC883 Digital [ALC883 Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0

However, pulseaudio is only using the Analog output.
Also, pavucontrol only shows the analog output device (ALC883 Analog).

I think this is a bug, there seems to be no way to have pulseaudio output to the digital (s/pdif / ie958) sink.

This: http://www.pulseaudio.org/ticket/139
may have something to do with this.
I followed the instructions:
- added the following line to /etc/pulse/default.pa:
load-module module-alsa-sink device=hw:0,1 ## Card 0, Device 1
- Kill and restart the audio server:
pulseaudio -k
pulseaudio -D

Now the digital output shows up in pavucontrol, and the applications that use pulse also use the digital output. All this shouldn't be needed (output to digital by default) or at least an easier digital output activation is necessary.


sorrce: https://bugs.launchpad.net/ubuntu/+source/pulseaudio/+bug/205717


I tried the above solution. Didn't work for me; got the message connection failed when I tried to activate pavucontrol and no sound on my system and no digital out.







Device 4 or the IEC958 is the digital device; set that in tab Devices as device.

No comments:

Blog Archive