LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices



Reply
 
Search this Thread
Old 06-08-2006, 04:30 AM   #1
babyface
LQ Newbie
 
Registered: Mar 2004
Posts: 5

Rep: Reputation: 0
Unhappy 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.
 
Old 06-09-2006, 04:38 PM   #2
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
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.
 
Old 06-12-2006, 03:03 PM   #3
Andefeldt
LQ Newbie
 
Registered: Oct 2003
Distribution: Ubuntu 5.10
Posts: 12

Rep: Reputation: 0
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
 
Old 06-12-2006, 05:39 PM   #4
Electro
Guru
 
Registered: Jan 2002
Posts: 6,042

Rep: Reputation: Disabled
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.
 
Old 06-13-2006, 02:25 PM   #5
Andefeldt
LQ Newbie
 
Registered: Oct 2003
Distribution: Ubuntu 5.10
Posts: 12

Rep: Reputation: 0
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
 
Old 06-14-2006, 03:11 AM   #6
babyface
LQ Newbie
 
Registered: Mar 2004
Posts: 5

Original Poster
Rep: Reputation: 0
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Enable AC3 passthrough for Audigy 2 value gavinln Linux - Hardware 1 05-02-2006 07:19 PM
AC3 passthrough? Japi Linux - Hardware 2 02-12-2006 04:27 PM
Sound card always too busy for Xine SPDIF passthrough sdistefano Linux - Software 0 09-06-2005 01:01 PM
ac3 passthrough? fackamato Linux - Hardware 5 03-09-2004 08:39 AM
SPDIF Passthrough. raid517 Linux - Hardware 4 09-17-2003 09:38 PM


All times are GMT -5. The time now is 11:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration