Digital Audio and XBMC
#1
Ok folks after 2 weeks of struggling to get 5.1 AC3 and DTS working out of my shuttle box I finally spent a few hrs last sunday working out the kinks and got it up and running.

Here is what I finally did to get it running, of course everyone has some sort of differnt config but maybe this might help anyone else who went though the same pains.

first run aplay -l

Quote:gateway@gateway-desktop:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SN25P [Shuttle SN25P], device 0: ICE1724 [ICE1724]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SN25P [Shuttle SN25P], device 1: IEC1724 IEC958 [IEC1724 IEC958]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: SN25P [Shuttle SN25P], device 2: ICE1724 Surrounds [ICE1724 Surround PCM]
Subdevices: 2/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1

this shows me that on HW 0 device 1 was my digital out..

device 1: IEC1724 IEC958 [IEC1724 IEC958]

so I know 2 things from this HW = 0 and device = 1

also running aplay -L gave me more info

Quote:cards 'cards.pcm'
front 'cards.pcm.front'
rear 'cards.pcm.rear'
center_lfe 'cards.pcm.center_lfe'
side 'cards.pcm.side'
surround40 'cards.pcm.surround40'
surround41 'cards.pcm.surround41'
surround50 'cards.pcm.surround50'
surround51 'cards.pcm.surround51'
surround71 'cards.pcm.surround71'
iec958 'cards.pcm.iec958'
spdif 'cards.pcm.iec958'

modem 'cards.pcm.modem'
phoneline 'cards.pcm.phoneline'
dsnoop 'cards.pcm.dsnoop'

as you can see from the bold devices listed spdif and iec958 are both listed.

the next thing I did was copied the demo-asoundrc to my home folder and changed the device number from 0 to 1 in the first part of the file (sorry going off memory here)

Next thing I did was run xbmc and go to settings --> settings --> audio config and turned on digital, checked both check boxes and left both fields as "default" (I'm assuming this reads the asoundrc file and uses the default device listed)

then all of a sudden boom audio was working.

something I did before doing this is to test this clip

http://www.torrentportal.com/details/915...rrent.html

which is a 5.1 audio clip with mplayer

you can test this 2 ways (im going from memory so hopefully I remember the right command)

mplayer <file> -ac hwac3 -ao alsa:device=plughw=0.1

if you have dts change -ac to hwdts

also, plughw might not work for you so try this command in stead.

mplayer <file> -ac hwac3 -ao alsa:device=hw=0,1


now keep in mind this assumes that your digital out device = 1 from the above information that aplay spits out.

hopefully this helps people and once again everyone might have a different config/setting

oh one thing that also helped was in ubuntu going to admin/sound settings and selecting the various card options and hitting test till you hear a tone.

ill do my best to post some screen shots of my config and settings in both asoundrc, and system sound settings and volume control panel.

One thing I did notice now is that my clips play alot slower and alot more cpu is taken up, and im starting to see screen tearing in my video playback.

I have a dual core amd 64 x2 3800+ and 2 gigs of ram and a nice video card in my box running on my 65 inch Mitsubishi with dvi or hdmi in which runs my desktop at 1080p.
-------------
I Bare It All -Personal Blog
Reply
#2
I had digital audio working in mplayer and xine previous to installing XBMC.

To get it working in XBMC, here is what I had to do:

In Settings -> Audio Config, change the digital device from "iec958" to:

PHP Code:
iec958:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2 
^^ This should really be the default in XBMC for digital audio. This is what both xine and mplayer use as their default iec958 line.

I left analog at 'default'.

Then I created an xbmc script in ~/bin/ that basically says this:

PHP Code:
#!/bin/bash
cd $HOME/XBMC/BUILD
SDL_AUDIODRIVER
=ALSA ./XboxMediaCenter -fs 

Then I "chmod a+x ~/bin/xbmc" and just use "xbmc" to launch. ~/bin/ may be /usr/local/ in your case.

(NOTE: That SDL_AUDIODRIVER=ALSA line changes the audio driver for the XboxMediaCenter UI. I've seen that line used elsewhere and now know it is NOT working exactly like people think. The problem is, if the UI grabs the alsa analog out for its 'click' sound, it doesn't seem to release it for a playing movie that requires iec958 -- you can't do both simultaneously. So you have to disable audio for the UI. This SDL_AUDIODRIVER=ALSA line is NOT setting it to ALSA. In fact, "ALSA" is not a correct driver and this is basically forcing no-audio for the UI, which lets movie sound work fine. "alsa" is a correct driver, and changing from "ALSA" to "alsa" results in UI clicking working, but video digital audio once again broken. Once they get the UI to properly close the audio device while spawning a video instance, this will no longer be needed)

Now, my .asoundrc (which I also copied to /etc/asound.conf):

PHP Code:
pcm.!default {
        
type plug
        slave
.pcm "softvol"
}

pcm.forcerate {
        
type plug
        slave 
{
                
pcm "spdif"
                
rate 48000
                format S16_LE
        
}
}

pcm.softvol {
        
type softvol
        slave 
{
                
pcm "forcerate"
        
}
        
control {
                
name "Master"
                
card 0
        
}


This setup will allow you to have proper volume control over PCM SPDIF and output pass-through SPDIF when available. You may need to run "alsamixer" from a console and unmute IEC958. I do not use any analog connections, only SPDIF.
Reply
#3
I'm a little confused why you need a .asoundrc file if you are using spdif only. I may have totally the wrong understanding of what it is for but I thought it was for downmixing things like 5.1 to 2 channel.

I have no .asoundrc and get all UI and DD audio over spdif. I also only have the IEC958 as the default line.
Reply
#4
to best honest im not sure why asoundrc is needed, and I havnt tested my new setup by removing that file.

What I THINK its doing is based upon what you input into xbmc -- audio settings default is reading what = default in the asoundrc, my only thing I had to do was make sure I change device = 0 to device = 1 and then it all seemed to work.

of course this is all guessing.

However now im really seeing a slowdown in playback of video files.
-------------
I Bare It All -Personal Blog
Reply
#5
This asoundrc is likely only required if you are sending *all* audio over your SPDIF connection (including analog/MP3/stereo) --

This asoundrc does two things:

1. When you do not use analog and use SPDIF-only, non-surround audio is typically sent raw without any volume modification to your receiver. Just the raw stereo PCM data. This is solved by creating a 'softvol' mixer for the PCM data.

2. When you use SPDIF-only (again, for non-encoded PCM/WAV/MP3-type audio), most audio devices only support 48KHz output. This asoundrc resamples 44.1KHz/etc (i.e, MP3) to 48KHz before outputting via SPDIF to my receiver.
Reply
#6
Hey all!
I've some trouble getting my audio to work with ubuntu 7.xx

I got nforce3 chipset on my epox m/b with iec958, realtek 850 chipset.

Tried all sulotions I could find on net, tried to force all signals in .asoundrc to go thru spdif, in /etc/asound.conf also but no luck.

When I tried the nvmixer I got all sounds to work the problem with that is that xbmc can't seem to passthru to my reciver so I get dts and dolbydigital.

nor can I find any settings in nvsound to send all signlas untouched to my reciver.

Anyone here happend to be able to help?
Reply
#7
Digital audio worked for me right out of the box with Ubuntu 7.10 on my Shuttle X100 with Realtek 8CH (I'm not at home right now and can't check it any better than that...). I activated IEC958 in Gnome Mixer (first go to preferences and make sure IEC958 is checked), and was happily playing audio in all apps, including XBMC.

My problem now comes when I play a DTS or AC3 encoded stream. Passthrough works and I get the audio in the receiver, but it looks like XBMC fails to unset passthrough after the stream stops, so the receiver stays on Dolby Digital and I get no sound from the GUI or non-AC3 encoded streams.
Reply
#8
einal Wrote:My problem now comes when I play a DTS or AC3 encoded stream. Passthrough works and I get the audio in the receiver, but it looks like XBMC fails to unset passthrough after the stream stops, so the receiver stays on Dolby Digital and I get no sound from the GUI or non-AC3 encoded streams.

Same here. Restarting xbmc is a good workaround. When I started with linux xbmc I had to restart several times while watching a single movie. So this is already good progress Wink
Reply
#9
einal Wrote:My problem now comes when I play a DTS or AC3 encoded stream. Passthrough works and I get the audio in the receiver, but it looks like XBMC fails to unset passthrough after the stream stops, so the receiver stays on Dolby Digital and I get no sound from the GUI or non-AC3 encoded streams.

I just noticed this today as well. Played a TS file with DD5.1 and after stopping I had no audio from the GUI. I am sure this worked fine before.
Build 10587 and 10594 show the same thing. I'll try heading back a few builds and see if I can find it.
Reply
#10
Please try SVN 10596 and let me know if the problem is still present.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Please read and follow the forum rules.
For troubleshooting and bug reporting, please make sure you read this first.


Image
Reply
#11
It reverts back now thanks d4rk.
It does seem to miss the first couple of button press/cursor moves but after that no problem.

Thanks again
Reply

Logout Mark Read Team Forum Stats Members Help
Digital Audio and XBMC0