[mythtv-users] RE: Configuring SPDIF digital out.

Marius Schrecker marius at schrecker.org
Sat Dec 17 03:44:12 EST 2005


> I finally got it working.
>
> Here is what I did to enable spdif output to my amp when I switched from a
> SB Live! 5.1 analog surround card to the on-board audio on my Asus
> motherboard.
>
> The obvious first step was to remove the SB Live! Card from the PC. During
> the Power On Self Test (POST), I entered the BIOS settings and enabled the
> on-board audio. Saved the settings ant continued with the boot up.
>
> KDE informed me that the default audio device was missing. I went to the
> Start menu --> System Settings --> Soundcard Detection. KDE found my
> Soundcard and played a test tune. The analog sound was coming out of my TV
> Speakers and nothing was coming out of my Receiver.
>
> I opened up a terminal and typed alsamixer.  I was given an error message
> :
>
> alsamixer: function snd_ctl_open failed for default: no such file or
> directory.
>
> Googling for that error led me to believe that my modprob.conf file was to
> blame so. . .
>
> # (any text editor) /etc/modprob.conf
>
> -----Before------
>
> alias eth0 sk98lin
> options snd-emu10k1 index=0
> remove snd-emu10k1 { /usr/sbin/alsactl store 0 >/dev/null 2>&
> 1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1
> alias char-major-81 cx8800
> alias usb-controller ehci-hcd
> alias usb-controller1 uhci-hcd
> alias ieee1394-controller ohci1394
> # nvidia kernel module
> alias char-major-195 nvidia-1_0-7174
> alias nvidia nvidia-1_0-7174
> options snd-intel8x0 index=1
> remove snd-intel8x0 { /usr/sbin/alsactl store 1 >/dev/null 2>&1 || : ; };
> /sbin/modprobe -r --ignore-remove snd-intel8x0
> alias snd-card-0 snd-intel8x0
> options snd-card-0 index=0
> options snd-intel8x0 index=0
> remove snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; };
> /sbin/modprobe -r --ignore-remove snd-intel8x0
>
> The intel8x0 is my on-board audio device, and the emu10k1 was my old card.
> I
> commented out the lines referencing my old sound card and made a few
> number
> changes in the file. This is my file after editing it.
>
> -------After--------
>
> alias eth0 sk98lin
> #options snd-emu10k1 index=0
> #remove snd-emu10k1 { /usr/sbin/alsactl store 0 >/dev/null 2>&
> 1 || : ; }; /sbin/modprobe -r --ignore-remove snd-emu10k1
> alias char-major-81 cx8800
> alias usb-controller ehci-hcd
> alias usb-controller1 uhci-hcd
> alias ieee1394-controller ohci1394
> # nvidia kernel module
> alias char-major-195 nvidia-1_0-7174
> alias nvidia nvidia-1_0-7174
> #changed index=1 to index=0 and ... store 1 to store 0
> options snd-intel8x0 index=0
> remove snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; };
> /sbin/modprobe -r --ignore-remove snd-intel8x0
> alias snd-card-0 snd-intel8x0
> options snd-card-0 index=0
> options snd-intel8x0 index=0
> remove snd-intel8x0 { /usr/sbin/alsactl store 0 >/dev/null 2>&1 || : ; };
> /sbin/modprobe -r --ignore-remove snd-intel8x0
>
> I rebooted and still no dice. Same error message from alsamixer. I tried
> creating a .asoundrc file like like the example on the ALSA website.
>
> $ vi /home/mythtv/.asoundrc
>
> pcm.intel8x0 {
>    type hw
>    card 0
> }
>
> ctl.intel8x0 {
>    type hw
>    card 0
> }
>
> Still no digital sound. I attempt to run alsamixer and receive this error
> message:
>
> alsamixer: relocation error: alsamixer: symbol
> snd_mixer_selem_get_playback_dB, version ALSA_0.9 not defined in file
> libasound.so.2 with link time reference
>
> After a few Google’s, I find out what needs to be done.
> It is time to update drivers and such. But first a little house cleaning.
>
> # mv /usr/lib/libasound.so.2 moved.libasound.so.2
> # mv /usr/lib/libasound.so.2.0.0 moved.libasound/so/2/0/0
>
> --- I later went back and deleted them but you can’t be too careful ---
>
> # yum install alsa-utils
> # yum install alsa-lib
> # yum install alsa-driver
>
> I tried alsamixer again and it worked.
> In alsamixer I un-muted IEC958, turned ICE958 Playback all the way down,
> set
> ICE958 Playback source to [AC-Link], un-muted External Amplifier, turned
> <PCM> and <Master> up to 90%. ESC to exit.
>
> --- I don’t know if all of this was necessary, but it worked for me. ---
>
> I started up mythfrontend, and navigated to Utilities/Setup -> Setup ->
> General. On the 3rd page I selected “Enable AC3 to SPDIF passthrough” and
> “Audio output device” was already on “/dev/dsp”.
> Finish going through the menu’s in order to make the settings take effect.
> After I verified that it worked, I spent a few minutes patting myself on
> the
> back, and then decided to save my settings.
>
> #  /usr/sbin/alsactl store
>
> --  That’s it. I hope someone can find this information useful. -Mat
>

I'm baffld about this.

Yes I have the libasound2 libraries installed, but these are essential,
not only to alsa, but also to about 100 other packages. There is no
alternative on my Debian system. Here are the alsa relataed packages I
have installed:

 $ dpkg -l *alsa* |grep ii
ii  alsa-base                          1.0.10-3       ALSA driver
configuration files
ii  alsa-oss                           1.0.10-1       ALSA wrapper for OSS
applications
ii  alsa-utils                         1.0.10-1       ALSA utilities
ii  alsamixergui                       0.9.0rc2-1-9   graphical soundcard
mixer for ALSA soundcard
ii  alsaplayer-alsa                    0.99.76-7      PCM player designed
for ALSA (ALSA output mo
ii  alsaplayer-common                  0.99.76-7      PCM player designed
for ALSA (common files)
ii  alsaplayer-gtk                     0.99.76-7      PCM player designed
for ALSA (GTK version)
ii  gnome-alsamixer                    0.9.6-3        ALSA sound mixer for
GNOME
ii  libalsaplayer-dev                  0.99.76-7      PCM player designed
for ALSA (interface libr
ii  libalsaplayer0                     0.99.76-7      PCM player designed
for ALSA (interface libr
ii  libclalsadrv-dev                   1.0.1-3        Development file for
libclalsadrv
ii  libclalsadrv1                      1.0.1-3        ALSA driver C++
access library
ii  libpt-plugins-alsa                 1.8.7-2        Portable Windows
Library Audio Plugin

and $ dpkg -l *asound* |grep ii
ii  libasound2         1.0.10-2       ALSA library
ii  libasound2-dev     1.0.10-2       ALSA library development files
ii  libasound2-plugins 1.0.10-1       ALSA library additional plugins

and these kernel modules:

$ lsmod |grep snd
snd_intel8x0           29596  2
snd_ac97_codec         93472  1 snd_intel8x0
snd_ac97_bus            1856  1 snd_ac97_codec
snd_pcm                80392  2 snd_intel8x0,snd_ac97_codec
snd_timer              20548  1 snd_pcm
snd                    46564  8 snd_intel8x0,snd_ac97_codec,snd_pcm,snd_timer
soundcore               7264  1 snd
snd_page_alloc          8648  2 snd_intel8x0,snd_pcm

My alsamixer shows the following controls:

Master : 100%
Master Mono [OFF]
PCM: 100%
SSurround [Off]
Surround Jack Mode [Shared]
Center [Off]
LFE [Off]
Line [Off]
CD [Off]
Mic [Off]
Mic Boost (+20dB) [Off]
Mic Front Input [Off]
Mic Select [Mic1]
 Video  -----
Phone [Off]
IEC958 [PCM]    (have also tried IEC958 [IEC958 In] - hear click when
switching between modes here, so physical connection is not the problem)
IEC958 Playback AC97-SPSA 0% (have tried other levels)
IEC958 Playback AC97-SPSA Capture 0% (have tried other levels
independently of playback)
PC Speaker [Off]
Aux [Off]
Mono Output Select [Mix]
Capture 100%
Mix    ------
Mix Mono -----
Channel Mode [2ch]
Duplicate Front [Off]
External Amplifier [Off]  (hav also tried on).

I'm using the following ~/.asoundrc, lifted straight from the digital
sound howto, and with unmixed-digital set as default:

# Override the default output used by ALSA.
# If you do not override the default, your default
# device is identical to the (unmixed) analog device
# shown below.  If you prefer mixed and/or digital
# output, uncomment the appropriate four lines below
# (only one slave.pcm line).
### Currently set w/digital-hw as the default output,
### comment out this entire section to use unmixed
### analog as your default
### -Marius
pcm.!default {
  type plug
## Uncomment the following to use mixed analog by default
#  slave.pcm "dmix-analog"
## Uncomment the following to use unmixed digital by default
  slave.pcm "digital-hw"
## Uncomment the following to use mixed digital by default
#  slave.pcm "dmix-digital"
}

# Alias for analog output on the nForce2/4 (hw:0,0)
# - This is identical to the device named "default"--which
# always exists and refers to hw:0,0 (unless overridden)
# - Therefore, we can specify "hw:0,0", "default", or "analog"
# to access analog output on the nForce2/4
pcm.analog {
 type plug
 slave.pcm "analog-hw"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.analog {
 type hw
 card 0
}

# Alias for (rate-converted) mixed analog output on the
# nForce2 (hw:0,0)
#  - This will accept audio input--regardless of rate--and
# convert to the rate required for the dmix plugin
# (in this case 48000Hz)
pcm.mixed-analog {
 type plug
 slave.pcm "dmix-analog"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.mixed-analog {
 type hw
 card 0
}

# Alias for (rate-converted) digital (S/PDIF) output on the
# nForce2 (hw:0,2)
#  - This will accept audio input--regardless of rate--and
# convert to the rate required for the S/PDIF hardware
# (in this case 48000Hz)
pcm.digital {
 type plug
 slave.pcm "digital-hw"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.digital {
 type hw
 card 0
}

# Alias for mixed (rate-converted) digital (S/PDIF) output on the
# nForce2/4 (hw:0,2)
#  - This will accept audio input--regardless of rate--and
# convert to the rate required for the S/PDIF hardware
# (in this case 48000Hz)
pcm.mixed-digital {
 type plug
 slave.pcm "dmix-digital"
}

# Control device (mixer, etc.) for the nForce2 card
ctl.mixed-digital {
 type hw
 card 0
}

# The following devices are not useful by themselves.  They
# require specific rates, channels, and formats.  Therefore,
# you probably do not want to use them directly.  Instead use
# of of the devices defined above.

# Alias for analog output on the nForce2 (hw:0,0)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.analog-hw {
 type hw
 card 0
 # The default value for device is 0, so no need to specify
}

# Control device (mixer, etc.) for the nForce2/4 card
ctl.analog-hw {
 type hw
 card 0
}

# Alias for digital (S/PDIF) output on the nForce2/4 (hw:0,2)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.digital-hw {
 type hw
 card 0
 device 2
}

# Control device (mixer, etc.) for the nForce2/4 card
ctl.digital-hw {
 type hw
 card 0
}

# Direct software mixing plugin for analog output on
# the nForce2/4 (hw:0,0)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.dmix-analog {
 type dmix
 ipc_key 1234
 slave {
   pcm "analog-hw"
   period_time 0
   period_size 1024
   buffer_size 4096
   rate 48000
 }
}

# Control device (mixer, etc.) for the nForce2/4 card
ctl.dmix-analog {
 type hw
 card 0
}

# Direct software mixing plugin for digital (S/PDIF) output
# on the nForce2/4 (hw:0,2)
# Do not use this directly--it requires specific rate,
# channels, and format
pcm.dmix-digital {
 type dmix
 ipc_key 1235
 slave {
   pcm "digital-hw"
   period_time 0
   period_size 1024
   buffer_size 4096
   rate 48000
 }
}

# Control device (mixer, etc.) for the nForce2/4 card
ctl.dmix-digital {
 type hw
 card 0
}



$ aplay -D digital english.au
Playing Sparc Audio 'english.au' : Mu-Law, Rate 8000 Hz, Mono
     gives nothing

$ aplay -D mixed-digital english.au
Playing Sparc Audio 'english.au' : Mu-Law, Rate 8000 Hz, Mono
     gives nothing

$ aplay -D mixed-analog english.au
Playing Sparc Audio 'english.au' : Mu-Law, Rate 8000 Hz, Mono
     plays sound
$ aplay -D analog english.au
Playing Sparc Audio 'english.au' : Mu-Law, Rate 8000 Hz, Mono
      plays sound

Could someone with working spdiff post the output from
alsactl store -f somefile ?

as it looks like not all the controils are visible in the mixers.

Sorry about the long post.

I'll try the digital sound running from live CD to see what happens.

Cheers

Marius











More information about the mythtv-users mailing list