Can't manage to get proper digital output, please help!
#16
Temar Wrote:Just out of curiosity: Why do you need to use the SoundBlaster? When using digital output in passthrough mode the sound device should not matter - you should get the same output quality with the onboard soundchip.

The onboard sound chip is a coaxial connection. I've been using the toslink connections merely out of personal preference. I suppose I can juggle around some wires and make room for another coaxial if that ends up being the answer.

Temar Wrote:And what does "aplay -l" list? If you use "aplay -L" it lists virtual devices as well. Virtual devices might downmix the audio. To get the real hardware devices, use "aplay -l". Maybe XBMC sends its output to a virtual ALSA device, which would explain why you only get stereo output. If we know the correct hardware device we can create a virtual device manually which will pass its data directly to the hardware.


Code:
xbmc@(none):~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: XFi [Creative X-Fi], device 0: ctxfi [Front/WaveIn]
  Subdevices: 7/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: XFi [Creative X-Fi], device 1: ctxfi [Surround]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: XFi [Creative X-Fi], device 2: ctxfi [Center/LFE]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: XFi [Creative X-Fi], device 3: ctxfi [Side]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: XFi [Creative X-Fi], device 4: ctxfi [IEC958 Non-audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Temar Wrote:And what happens if you press F6 in this screen? Can you actually select other sound devices?

- (default)
0 Creative X-Fi
1 MPU-401 UART
enter device name...

Temar Wrote:That's odd. If XBMC is in passthrough mode it should not downmix. Otherwise it would not be the passthrough mode. What happens if you try to use the volume controls, does XBMC still confirm the passthrough mode or is it downmixing?

This is only the multichannel .wav file that I played in the music player. If I pop in a vob or avi with dts/dd it doesn't downmix, it just goes null.

Temar Wrote:Now that you have at least one working configuration you should enable XBMC's debug mode (System->System->Debugging) and check the logfile. Maybe there is an error message which explains the stereo mode.

Whoa, this debug thing, very clever.
Code:
DEBUG: Open - probing detected format [dts]
08:37:01 T:3054425984 M:1954267136   DEBUG: Open - av_find_stream_info starting
08:37:01 T:3054425984 M:1954013184   ERROR: ffmpeg[B60ED780]: [dca] Not a valid DCA frame
08:37:01 T:3054425984 M:1953378304   DEBUG: ffmpeg[B60ED780]: [dts] max_analyze_duration reached
08:37:01 T:3054425984 M:1953378304   DEBUG: ffmpeg[B60ED780]: [dts] Estimating duration from bitrate, this may be inaccurate
08:37:01 T:3054425984 M:1953378304   DEBUG: Open - av_find_stream_info finished
08:37:01 T:3054425984 M:1953378304    INFO: ffmpeg[B60ED780]: Input #0, dts, from '/home/xbmc/Music/Norrlanda.wav':
08:37:01 T:3054425984 M:1953378304    INFO: ffmpeg[B60ED780]:   Duration: 00:04:25.00, bitrate: 1411 kb/s
08:37:01 T:3054425984 M:1953378304    INFO: ffmpeg[B60ED780]:     Stream #0.0: Audio: dca, 44100 Hz, 5.1, s16, 1411 kb/s
08:37:01 T:3054425984 M:1953378304   DEBUG: FactoryCodec - Audio: PassthroughFFmpeg - Opening
08:37:01 T:3054425984 M:1953378304    INFO: CDVDAudioCodecPassthrough::Open - disabled passthrough due to sample rate not being 48000
08:37:01 T:3054425984 M:1953378304   DEBUG: FactoryCodec - Audio: PassthroughFFmpeg - Failed

I'm not terribly concerned with that (multichannel .wav) just yet, and it seems like it's going to be easy to fix, perhaps add additional passthrough sample rates to a config file somewhere, so, let's scroll down a little and see what the deal is with our .vob video.

I took your advice to heart yesterday and did a significant amount of messing around with the audio output. The closest I was able to come is with the passthrough set to "Creative X-Fi iec958" which results in nasty, modem like noises.

Here's my log now.
http://pastebin.com/k5ZdbuRd

It looks like it's detecting the correct format.
Code:
INFO: ffmpeg[4A33EB70]:     Stream #0.1[0x80]: Audio: ac3, 48000 Hz, 5.1, s16, 448 kb/s
Big Grin
Code:
#
DEBUG: FactoryCodec - Audio: PassthroughFFmpeg - Opening
#
09:01:58 T:1244916592 M:1880289280    INFO: CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - Trying to setup spdif muxer
#
09:01:58 T:1244916592 M:1880289280    INFO: CDVDAudioCodecPassthroughFFmpeg::SetupMuxer - spdif muxer ready
#
09:01:58 T:1244916592 M:1880289280   DEBUG: FactoryCodec - Audio: PassthroughFFmpeg - Opened
Nod
Code:
NOTICE: Creating audio device with codec id: 86020, channels: 2, sample rate: 48000, pass-through
Huh
Code:
#
DEBUG: Initialize - using alsa device iec958:CARD=XFi:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2
#
09:01:58 T:1214249840 M:1875177472   ERROR: Initialize - failed to open custom device iec958:CARD=XFi:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2 (error:Invalid argument), retry with default iec958:CARD=XFi
#
09:01:58 T:1214249840 M:1875050496   DEBUG: CALSADirectSound::Initialize - packet size:2048, packet count:16, buffer size:8192
#
09:01:58 T:1214249840 M:1875050496   DEBUG: CALSADirectSound::Initialize - Channels: 2 - SampleRate: 48000 - SampleBit: 16 - Resample false - IsMusic false - IsPassthrough true - audioDevice: iec958:CARD=XFi
Sad
Now I'm just confused. This looks nothing like the device listed in xbmc's config. Maybe it's an alias? How annoying is that? Where did it get "AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2"?

You mentioned being able to create a device once we knew all the right hardware info, a trick that I would certainly love to learn.
Reply
#17
DoctorDyna Wrote:The onboard sound chip is a coaxial connection. I've been using the toslink connections merely out of personal preference. I suppose I can juggle around some wires and make room for another coaxial if that ends up being the answer.

I think you will have to use your onboard soundcard. People have lots of problems with X-FI cards and some sound exactly like what you are describing:

http://ubuntuforums.org/showthread.php?p=9389033
http://ubuntuforums.org/showthread.php?t=870001 (A thread from 2008 which is still ongoing)
http://ubuntuforums.org/showthread.php?t=1496834

But we won't give up yet!


Quote:
Code:
card 0: XFi [Creative X-Fi], device 4: ctxfi [IEC958 Non-audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

"Non-audio" doesn't sound promissing.


Quote:I'm not terribly concerned with that (multichannel .wav) just yet, and it seems like it's going to be easy to fix, perhaps add additional passthrough sample rates to a config file somewhere, so, let's scroll down a little and see what the deal is with our .vob video.

Yeah, you can set the sample rate in ALSA.


Quote:I took your advice to heart yesterday and did a significant amount of messing around with the audio output. The closest I was able to come is with the passthrough set to "Creative X-Fi iec958" which results in nasty, modem like noises.

In the threads I linked above, some other guy has the exact same problem, getting weird audio output.

Quote:Here's my log now.
http://pastebin.com/k5ZdbuRd

Nothing really jumped into my eyes - except for the weird error message you quoted. But I think an XBMC developer should look at this.

Quote:You mentioned being able to create a device once we knew all the right hardware info, a trick that I would certainly love to learn.

Ok, here is the trick: Every user can override the ALSA settings. You can do it globally by writing your settings into /etc/asound.conf or on a user basis by writing your settings into $HOME/.asoundrc ($HOME is the home directory of the user). ALSA can do lots of stuff with the incoming/outgoing sound as it provides many modules to mix, route, duplicate,.... the sound stream.

We will keep it simple for now, by creating just one virtual device which sends its output directly to the hardware. From your aplay -l output we can extract everything we need:

Code:
card 0: XFi [Creative X-Fi], device 4: ctxfi [IEC958 Non-audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

So this device can be found on card 0 and has the device id 4. That's all we need. Now you can create the file .asoundrc in your XBMC's home directory:

Code:
pcm.out_pass {
        type hw
        card 0
        device 4
}

This will create a virtual device named "out_pass". You can use mplayer to see if it is working properly:

Code:
mplayer -afm hwac3 -ao alsa:device=out_pass ac3_or_dts_file.ac3

If it works you can use this device name in XBMC. Just set your passthrough-device to "Custom" and specify "out_pass" as device name. If it works in mplayer but not in XBMC, we are definetly looking at a XBMC bug.

Some soundcards also require additional parameters for the virtual device like "format", "channels" or "rate". However in most cases it should work without these parameters. If the above does not work you should also try all device names which are listed by "aplay -L". Just use mplayer to test them and add them to XBMC if you get sound.

If you want to dig deeper into ALSA configuration, you should start with: http://alsa.opensrc.org/.asoundrc

EDIT:
If you only get output on a few channels, try to add "channels 6" to your virtual device.
Reply
#18
Awesome, I think I'm making some progress.

I created the .asoundrc file in ~ and added the lines. I was able to specify it with mplayer and got proper audio.

So, I went into xbmc and set the passthrough to custom and the custom device is out_pass. It simply shuts down the fiber, exactly as it was doing before.

I can tell that I'm going to have a blast messing with this custom alsa config once I can get everything working properly.

EDIT: I can't even get mplayer to work with the onboard audio Sad

EDIT2:

xbmc@(none):~/Music$ aplay -D out_pass Norrlanda.wav (this is a dts encoded wav)
Playing WAVE 'Norrlanda.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Yay, all the speakers.

xbmc@(none):~/Videos$ mplayer -afm hwac3 -ao alsa:device=out_pass dolbycanyon.vob
Yay, all the speakers.

xbmc -> system -> system -> custom passthrough -> out_pass
Boo, gnomes unplugged my cable again.

Edit3: I did notice mplayer complaining thusly:
[AO_ALSA] alsa-lib: pcm.c:2211Sadsnd_pcm_open_noupdate) Unknown PCM out_pass:AES0=6

It played anyway though.

EDIT4: xbmc.log...
DEBUG: Initialize - using alsa device out_pass:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2
ERROR: Initialize - failed to open custom device out_pass:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2 (error:Invalid argument), retry with default out_pass

Why is it appending that garbage to the end of the output string and then complaining because there's garbage and we should try it without the garbage?
Reply
#19
DoctorDyna Wrote:EDIT: I can't even get mplayer to work with the onboard audio

I would expect this to be much easier, as the X-FI cards seem to cause a lot of trouble on Linux. What does aplay -l and aplay -L return when your onboard card is enabled.

Also don't forget to unmute all onboard sound channels on all devices (F6 in alsamixer) and use your virtual device to send the sound directly to the hardware.

Quote:xbmc@(none):~/Music$ aplay -D out_pass Norrlanda.wav (this is a dts encoded wav)
Playing WAVE 'Norrlanda.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Yay, all the speakers.

xbmc@(none):~/Videos$ mplayer -afm hwac3 -ao alsa:device=out_pass dolbycanyon.vob
Yay, all the speakers.

I don't like aplay as it does not output much debugging data. Mplayer is better for testing IMHO.

Quote:Edit3: I did notice mplayer complaining thusly:
[AO_ALSA] alsa-lib: pcm.c:2211Sadsnd_pcm_open_noupdate) Unknown PCM out_pass:AES0=6

It played anyway though.

Hmm, this might be a channel problem. Maybe add "channels 6" or "channels 8" to your virtual device. However mplayer might also fall back to its default value. So you should try one last thing to make sure mplayer really uses "out_pass" as ALSA device: What happens if you specify an ALSA device which does not exist, like "asdf" - does mplayer play the file?


Quote:EDIT4: xbmc.log...
DEBUG: Initialize - using alsa device out_pass:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2
ERROR: Initialize - failed to open custom device out_pass:AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2 (error:Invalid argument), retry with default out_pass

Why is it appending that garbage to the end of the output string and then complaining because there's garbage and we should try it without the garbage?

Hmm, my wisdom is at its end. You should create one last debug-log with your custom device enabled and file a XBMC bug report. This definetly seems to be a XBMC bug. Also if you google for AES0=0x6,AES1=0x82,AES2=0x0,AES3=0x2 you will get lots of hits. Some of them even point to the XBMC forum. So this has been a problem before.
Reply
#20
Yeah, I checked out some of those links. There was one post where a developer suggested another entry for .asoundrc which I tried just now with no luck.

I guess I'm stuck with Windows and all it's bloat and garbage for now.

Thanks for all the help, it's much appreciated!
Reply
#21
DoctorDyna Wrote:Yeah, I checked out some of those links. There was one post where a developer suggested another entry for .asoundrc which I tried just now with no luck.

I guess I'm stuck with Windows and all it's bloat and garbage for now.

Thanks for all the help, it's much appreciated!

I think you are not too far from a solution. As you can see, mplayer is also complaining about an invalid device parameter "AES0=6". I think that this is the parameter which makes XBMC abort its output whereas mplayer just tries a different strategy. So if you manage to get rid of this AES0=6 error - maybe by setting different amount of channels in your asoundrc, then I would guess that XBMC will play the file.

Also give all other sound devices a try. "aplay -L" lists all predefined devices. So try them in mplayer and if you get sound and no error message, use that device in XBMC.
Reply
#22
Check this out: http://ubuntuforums.org/archive/index.php/t-898446.html

Quote:The AES0=6 option is to put the spdif (co-axial/optical) connector in the proper mode. You can run 'man iecset'. Basically there are two modes for the spdif connector. For my sound blaster Live card, this is "IEC958 Optical Raw" when running alsamixer. This is a toggle button. It is either on or off.
Reply
#23
Mine seems to be set thusly:

xbmc@(none):~$ iecset
Mode: consumer
Data: audio
Rate: 48000 Hz
Copyright: protected
Emphasis: none
Category: PCM coder
Original: original
Clock: 1000 ppm

I've tried a few of the commands I've dug up on the internet, it doesn't seem to have any effect on what iecset says though.

I'm looking around to see if I can specify a passthrough device with some of those options.
Reply
#24
Dr. I can tell you this -- Whatever is going on seems to be specific to these Dharma Live ISO's because I have a very similar setup to yours (except I am using a generic Rocketfish 5.1 audio card which has worked fine in XBMC for many previous versions). I am able to either get no AC3/DTS via. TOSLINK or if i select one of the optional IEC adapters in XBMC I get static.

Having said that if you take a 9.11 install and and add the PPA sources, etc it should work (it did for me).

I'm really starting to wonder if this is an issue outside of XBMC...
Reply
#25
Hello
Any of XBMC developers read this multiple threads, on XBMC forums, about pulse, alsa, spdif, Dharma, Linux(Ubuntu) Huh?
Should we expect to solve the problem?
Reply

Logout Mark Read Team Forum Stats Members Help
Can't manage to get proper digital output, please help!0