LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Bad quality sound on SPDIF and no AC3-passthrough (https://www.linuxquestions.org/questions/linux-hardware-18/bad-quality-sound-on-spdif-and-no-ac3-passthrough-452690/)

babyface 06-08-2006 03:30 AM

Bad quality sound on SPDIF and no AC3-passthrough
 
Here is my conf : Debian Sarge with Kernel 2.6.8-smp on P4P800
Seams that drivers are ok because if I do

mplayer dvd:// -ao alsa:device=spdif -ac hwac3

or even with a DivX movie the DD or DTS stream passtrough the SPDIF connector and I get AC3 stream in my DD/DTS receiver.
But if I start Totem (sound on AC3 output of course)clicking the icone or try with Mplayer I get bad sound quality and no AC3 stream.

Stéréo has bad sound too.

It looks like all streams are transcoded in stéréo and badly.

I'd like to have DTS and DD and 2 stéréo (depend on the source file) set in this order as default stream through SPDIF. Even original stream (except MP3) 'always' sent through SPDIF connector.

I tried to create a .asoudrc and a /etc/asournd.conf file but it seams to have no effect at all.
For the record everything is installed correctly : alsa libs,driver, mixer.
Volume control has 'Digital' slider and I get sound only if it's on and in the gnome volume control if I put ICE958P on sound gets off. ICE958 has no effect at all.

Electro 06-09-2006 03:38 PM

First play the DVD movie and find out which aid has AC3 encoded. You may have to do 'mplayer dvd:// -identify -frames 0'. Next you can use spdif to output AC3 but specify -aid option with the value that you used. It could be:

mplayer dvd:// -ao alsa:device=spdif -ac hwac3 -aid 128

For DTS, it could be

mplayer dvd:// -ao alsa:device=spdif ac hwdts -aid 137

I am just taking information from http://gentoo-wiki.com/HOWTO_Dolby_D...t_(AC3,_SPDIF). I do not have a spdif to analog converter to test my sound card's, Audiotrak Prodigy 7.1, spdif outputs.

The $HOME/.asoundrc or /etc/asoundrc should work. If you run aplay -L it will include the lines that are in those files even though they may not be the correct syntax. I suggest using aplay to play a wav file to test your setup.

BTW, You should upgrade the kernel and as well upgrade ALSA.

Andefeldt 06-12-2006 02:03 PM

Hi,

I can't play AC3 or DTS on my system. Mplayer plays the movie and outputs the sound somewhere, but I haven't been able to found out where yet. It's not to my receiver and not to my normal monitor speakers.

My Receiver can handle DD5.1 and DTS so that's not the problem. I can play the Dolby Surround 2.0 track from a DVD without problems, just using:

mplayer dvd://

This outputs to both my receiver and monitor speakers.

I think there must be something missing in my alsa setup. I'm running Ubuntu-5.10 with the supplied alsa-1.0.9b4 (or something like that). My sound card uses the snd_intel8x0 driver (it's an nForce4 chipset motherboard from Asus).

My .asoundrc looks like

Code:

# ~/.asoundrc or /etc/asound.conf
# ALSA configuration file

##### USAGE #####
# Save this file as "~/.asoundrc" (for user-specific sound configuration) or
# "/etc/asound.conf" (for system-wide sound configuration) and specify ALSA
# device names ad described in the next section.


##### DEVICE NAMES #####
# This configuration file defines four devices for use by the user.  Those
# devices are "analog", "mixed-analog", "digital", and "mixed-digital".  The
# user may also re-define "default" to be identical to one of the above-named
# devices (i.e. to send all sound output to the digital output unless otherwise
# specified).  Use the device names as described below:
#  - "analog" outputs to the analog output directly and (at least on software
#  sound cards) blocks other audio output.  After playback completes, "queued"
#  sounds are output in sequence.
#  - "mixed-analog" mixes audio output from multiple programs into the analog
#  output (so you can hear beeps, alerts, and other noises while playing back
#  an audio stream).
#  - "digital" outputs to the digital output directly.  Since most (all?)
#  digital outputs expect 48kHz PCM audio, this may not work for some playback
#  (i.e. CD's--which are 44.1kHz PCM audio--or 32kHz audio streams from TV
#  recordings, etc.).
#  - "mixed-digital"

# All other devices created within this file are used only by the configuration
# file itself and should /not/ be used directly.  In other words, do not use
# the devices "analog-hw", "dmix-analog", "digital-hw", or "dmix-digital".


##### IMPORTANT #####
# To make this ALSA configuration file work with your sound card, you will need
# to define the appropriate card and device information for the "analog-hw" and
# "digital-hw" devices below.  You can find the card and device information
# using "aplay -l".


##### 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 "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 2 # This used to be 1, but my digital is device 2 - Andefeldt
#  - 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
}

Also, I can't get any output to my receiver if I do

mplayer dvd:// -ao alsa:device=spdif (or digital, iec958, digital-hw)

Mplayer outputs, but not to my receiver or normal speakers. Can anybody figure out, what's wrong with my setup?

Another thing is the number of channels used. If I pass the option -channels 6 to mplayer it keeps playing 2 channels. Why is that?

I hope someone can help me out here :)

Ooh, one last thing. In order to get my spdif to work, I need to open the alsamixer and change the IEC958 to PCM. On each reboot it automatically changes itself to Analog In (where my spdif doesn't work). It doesn't help to do "alsactl store". Any ideas on how to fix this also?


Please help :)

Anders

Electro 06-12-2006 04:39 PM

Your setup shows that it should output to the analog connectors. You will need to adjust PCM in alsamixer to get the sound. You may also have to adjust DAC if have them in the mixer. Third some sound cards need external amplifier unmuted in order to get analog outputs working. Not all sound cards have these mixer options.

Every DVD movie is different, so you have to specify the aid option that has AC-3. Mplayer have to be re-compiled if it does not have DTS support. If it is not, only AC-3 can be used. If you run 'mplayer dvd:// -identify -frames 0' it will show you different aid tracks and no it will not play because of the frames option.

You may want to run mplayer by doing mplayer 'dvd:// -ao oss -channels 2' to see if outputs to analog. Probably your ~/.asoundrc or /etc/asound.conf is screwing up your ALSA setup. Back up them and clear out those files and try using spdif again.

Try upgrading to 1.0.11 of ALSA. ALSA version 1.0.11 fixes a lot of problems.

My A/V Reciever is Technics SA-AX7. It does not have have digital or optical inputs, so I am unable to test my SPDIF with my sound card. If you know where to find a SPDIF to analog converter, I could help you further. I am just giving out what I would do.

Andefeldt 06-13-2006 01:25 PM

Thanks for your answers.

My setup doesn't only output to the normal analog outputs. My receiver is connected via a Coax cable to my soundcard and when I play normal sounds (Music, Movies (not AC3 or DTS) etc) I hear sounds both in my normal speakers as well as from my receiver. So ALSA outputs both to the analog and SPDIF outputs.

I have tried all the available aid's on the DVD's. Still nothing. Mplayer is compiled with DTS.

Before my .asoundrc file I didn't get any output to SPDIF, no matter what I did! Only with this .asoundrc file have I been succesful. It's taken from http://www.mythtv.org/wiki/index.php/DigitalSoundHowTo (I've changed device 1 to device 2 somewhere).

If I could just find out, how I only send sound to the SPDIF. As I wrote earlier didn't

mplayer dvd:// -ao alsa:device=spdif (plus extra options)

help.

As for my mixer settings, they are (output from amixer):

Code:

Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 31 [100%] [on]
  Front Right: Playback 31 [100%] [on]
Simple mixer control 'Master Mono',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 31 [100%] [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 31 [100%] [on]
  Front Right: Playback 31 [100%] [on]
Simple mixer control 'Surround',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 31 [100%] [on]
  Front Right: Playback 31 [100%] [on]
Simple mixer control 'Surround Jack Mode',0
  Capabilities:
  Mono:
Simple mixer control 'Center',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 31 [100%] [on]
Simple mixer control 'LFE',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 31
  Mono: Playback 31 [100%] [on]
Simple mixer control 'Line',0
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 0 [0%] [off] Capture [off]
  Front Right: Playback 0 [0%] [off] Capture [off]
Simple mixer control 'CD',0
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 31 [100%] [on] Capture [off]
  Front Right: Playback 31 [100%] [on] Capture [off]
Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Mono
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono: Playback 0 [0%] [off]
  Front Left: Capture [on]
  Front Right: Capture [on]
Simple mixer control 'Mic Boost (+20dB)',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Mic Front Input',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'Mic Select',0
  Capabilities:
  Mono:
Simple mixer control 'Video',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Phone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Mono
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono: Playback 0 [0%] [off]
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Mono: Playback [on] Capture [on]
Simple mixer control 'IEC958 Playback AC97-SPSA',0
  Capabilities: volume volume-joined
  Playback channels: Mono
  Limits: 0 - 3
  Mono: 0 [0%]
Simple mixer control 'PC Speaker',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 15
  Mono: Playback 0 [0%] [off]
Simple mixer control 'Aux',0
  Capabilities: pvolume pswitch pswitch-joined cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Front Left: Playback 31 [100%] [on] Capture [off]
  Front Right: Playback 31 [100%] [on] Capture [off]
Simple mixer control 'Mono Output Select',0
  Capabilities:
  Mono:
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 15
  Front Left: Capture 0 [0%] [off]
  Front Right: Capture 0 [0%] [off]
Simple mixer control 'Mix',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Mix Mono',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Front Left - Front Right
  Front Left: Capture [off]
  Front Right: Capture [off]
Simple mixer control 'Channel Mode',0
  Capabilities:
  Mono:
Simple mixer control 'Duplicate Front',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]
Simple mixer control 'External Amplifier',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

How can I update Alsa when I'm using the supplied alsa-drivers from Ubuntu? Should I just download and install the latest version, or do I need to remove the alsa-packages from Ubuntu first?

Anders

babyface 06-14-2006 02:11 AM

For myself I'd like to have everything through SPDIF with preferred stream DTS, if not present DD if not present Stéréo with audio files directed to SPDIF as well and everything converted to stéréo on analog outpout at the same time. Does anyone have this kind of asound.conf ?
Totem an player plays AC3 stream correctly, everything is there if I execute the right commande in the shell but front-end gui is configured awfully. Audio and movies in totem has really bad sound quality (don't even think of AC3) and in mplayer it freezes or I get bad sound as well. I didn't even try xmms. I just want a simple conf file to set everything default for all applications.


All times are GMT -5. The time now is 03:03 AM.