[mythtv-users] ALSA experts: Please help me configure SPDIF

William Munson william_munson at bellsouth.net
Mon Jun 18 21:50:29 UTC 2007


JDP DATA wrote:
>
> I've been try to get SPDIF output on my frontend with no success.  
> Please any kind souls out there help me.
> I already try 
> http://mythtv.org/wiki/index.php/Configuring_Digital_Sound_with_AC3_and_SPDIF 
> and
> http://www.alsa-project.org/alsa-doc/doc-php/template.php?module=intel8x0#opt 
> <http://www.alsa-project.org/alsa-doc/doc-php/template.php?module=intel8x0#opt> 
>
>
> Well to be more specific, I do get sound via tos-link but only 2 
> channel (Dolby Pro-logic).  I want to passthrough 5.1 (Dolby 
> Digital).  Not having any luck, I've try playing with alsamixer.  
> Unmute iec958 and set slider to "0", still no AC3 output to my receiver.
>
> my specs:
> Mythdora 4.0
> Shuttle XPC SB75G2 optical output ==>> Denon AVR-95 optical input
> Intel Corporation 82801EB/ER (ICH5/ICH5R) AC'97 Audio Controller (rev 02)
> Alsa v1.0.14
>
>
> lspci
> 00:00.0 Host bridge: Intel Corporation 82875P/E7210 Memory Controller 
> Hub (rev 02)
> 00:01.0 PCI bridge: Intel Corporation 82875P Processor to AGP 
> Controller (rev 02)
> 00:06.0 System peripheral: Intel Corporation 82875P/E7210 Processor to 
> I/O Memory Interface (rev 02)
> 00:1d.0 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB 
> UHCI Controller #1 (rev 02)
> 00:1d.1 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB 
> UHCI Controller #2 (rev 02)
> 00:1d.2 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB 
> UHCI Controller #3 (rev 02)
> 00:1d.3 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB 
> UHCI Controller #4 (rev 02)
> 00:1d.7 USB Controller: Intel Corporation 82801EB/ER (ICH5/ICH5R) USB2 
> EHCI Controller (rev 02)
> 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev c2)
> 00:1f.0 ISA bridge: Intel Corporation 82801EB/ER (ICH5/ICH5R) LPC 
> Interface Bridge (rev 02)
> 00:1f.1 IDE interface: Intel Corporation 82801EB/ER (ICH5/ICH5R) IDE 
> Controller (rev 02)
> 00:1f.2 IDE interface: Intel Corporation 82801EB (ICH5) SATA 
> Controller (rev 02)
> 00:1f.3 SMBus: Intel Corporation 82801EB/ER (ICH5/ICH5R) SMBus 
> Controller (rev 02)
> 00:1f.5 Multimedia audio controller: Intel Corporation 82801EB/ER 
> (ICH5/ICH5R) AC'97 Audio Controller (rev 02)
> 01:00.0 VGA compatible controller: nVidia Corporation NV34GL [Quadro 
> FX 500/600 PCI] (rev a1)
> 02:06.0 FireWire (IEEE 1394): VIA Technologies, Inc. IEEE 1394 Host 
> Controller (rev 46)
> 02:07.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5788 
> Gigabit Ethernet (rev 03)
>
> aplay -L
> front:CARD=ICH5,DEV=0
>     Intel ICH5, Intel ICH5
>     Front speakers
> surround40:CARD=ICH5,DEV=0
>     Intel ICH5, Intel ICH5
>     4.0 Surround output to Front and Rear speakers
> surround41:CARD=ICH5,DEV=0
>     Intel ICH5, Intel ICH5
>     4.1 Surround output to Front, Rear and Subwoofer speakers
> surround50:CARD=ICH5,DEV=0
>     Intel ICH5, Intel ICH5
>     5.0 Surround output to Front, Center and Rear speakers
> surround51:CARD=ICH5,DEV=0
>     Intel ICH5, Intel ICH5
>     5.1 Surround output to Front, Center, Rear and Subwoofer speakers
> null
>     Discard all samples (playback) or generate zero samples (capture)
>
> aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: ICH5 [Intel ICH5], device 0: Intel ICH [Intel ICH5]
>   Subdevices: 0/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
>
> modprobe.conf
> alias scsi_hostadapter ata_piix
> 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
> # nvidia kernel module
> alias char-major-195 nvidia-1_0-9755
> alias nvidia nvidia-1_0-9755
> alias eth0 tg3
>
> asound.conf
> #Generated by system-config-soundcard, do not edit by hand
> #SWCONF
> #DEV 4
> defaults.pcm.card 0
> defaults.pcm.device 4
> defaults.ctl.card 0
>
I would start by adding a .asoundrc to your mythtv user's home 
directory. You will need to modify the file to use device #4 as your 
spdif port device. I use the following document for my base 
http://mythtv.org/wiki/index.php/Configuring_Digital_Sound
and would modify the .asoundrc as follows: (Feel free to copy and paste)

-------------snip-----------------

##### Configuration File #####

# 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).
#
# Note, also, that as of ALSA 1.0.9, "software" sound cards have been modified
# such that their default "default" device is identical to the "mixed-analog"
# device.  Whether using an ALSA version before or after 1.0.9, it does no harm
# and has no affect on performance to redefine the device (even if the
# redefinition does not change anything).  Also, by using this ALSA
# configuration file, you once again have access to unmixed analog output using
# the "analog" device.
pcm.!default {
  type plug
## Uncomment the following to use (unmixed) "analog" by default
#  slave.pcm "analog-hw"
## 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"
}

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

# Alias for (converted) analog output on the card
# - 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 card
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is different from "default" and
# allows playback while blocking other sound sources (until playback
# completes).
pcm.analog {
  type plug
  slave.pcm "analog-hw"
}

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

# Alias for (converted) mixed analog output on the card
# - This will accept audio input--regardless of rate--and convert to the rate
# required for the dmix plugin (in this case 48000Hz)
# - Note that as of ALSA 1.0.9, "software" sound card definitions redefine
# "default" to do mixing, meaning this device is identical to "default" for
# "software" sound cards.
pcm.mixed-analog {
  type plug
  slave.pcm "dmix-analog"
}

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

# Alias for (converted) digital (S/PDIF) output on the card
# - 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 card
ctl.digital {
  type hw
  card 0
}

# Alias for mixed (converted) digital (S/PDIF) output on the card
#  - 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 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 card
# 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
#  - Uncomment one of the below or create a new "device N" line as appropriate
#    for your sound card or 
#  device 1
#  device 4
}

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

# Alias for digital (S/PDIF) output on the card
# Do not use this directly--it requires specific rate, channels, and format
pcm.digital-hw {
  type hw
  card 0
  device 4
#  - Comment out "device 1" above and uncomment one of the below or create a
#    new "device N" line as appropriate for your sound card or 
#  device 2
#  device 4
}

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

# Direct software mixing plugin for analog output on the card
# 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 card
ctl.dmix-analog {
  type hw
  card 0
}

# Direct software mixing plugin for digital (S/PDIF) output on the card
# 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 card
ctl.dmix-digital {
  type hw
  card 0
}

-----------------------------------

I would set the default output device to: ALSA:spdif and the default 
passthru device to: default. Then either disable the internal mixer or 
set it to:default

That should route all sound to your spdif port. You will probably want 
to enable AC3 passthru and perhaps DTS passthru. but try them in 
different combos until everything works as you want. Now if I could only 
get the slave output to the speaker feature working I would be in sound 
heaven.

Good luck!
Bill



More information about the mythtv-users mailing list