No surround sound with Creative X-Fi + Logitech Z-5500 (Solved)

Finally got surround sound working, easy fix, but it took awhile to get this figured out. The set-up:

Sound Card: Creative X-Fi Titanium Fatality Champion
Speakers: Logitech Z-5500 THX Certified 5.1 Digital Surround Sound
Connection: Optical
OS: openSUSE 12.1 64-bit
Sound System: just ALSA (removed PulseAudio due to some problems I was having with a few games)

After a fresh 12.1 install, I had a surround sound channel, but could never get more then stereo. I would hear an initial “pop” when trying to play through the surround sound channel, but beyond that, would hear nothing. My available channels:

http://www.imgplace.com/img12/222/48ss51kmix.th.png](http://www.imgplace.com/viewimg12/222/48ss51kmix.png)

Fix:

  1. Add the packman repo if you don’t already have it:
    Additional package repositories - openSUSE

  2. Install the dca alsa plugin & configure it: (WARNING: “The DTS technology is heavily patented. Please do not download and do not use this software if you live in a country such as USA where software patents are legal and you don’t have a patent license from DTS, Inc.”)


# zypper in alsa-plugins-dca
$ cp /usr/share/alsa/pcm/dca.conf ~/.asoundrc
  1. Test:
$ speaker-test -Dplug:dca -c6 -twav

Of related interest:
Solved - Creative X-FI Titanium (ctxfi) on Ubuntu 11.10
DigitalOut - ALSA wiki
Gentoo Wiki Archives - HOWTO_Dolby_Digital_and_DTS

Thanks for your information. When I reload my Media Center with openSUSE 12.1, I will give your suggestions a try out.

Thank You,

Good luck =D

Here’s some of my experiences when setting this plugin as the default in .asoundrc:

pcm.!default {
type plug
slave.pcm “dca”
}

Playing stereo music in Amarok = Receiver is receiving the dts signal, but songs sound worse & I get popping when transitioning tracks. Haven’t played with upmixing yet.
Playing 5.1 videos in SMPlayer = Sometimes I get MPlayer decode_audio error and can’t play the movie, or, if it plays I get no voice, just background noise and/or music. If I set the audio output to stereo,* some files* will play fine and audio comes out as expected but the receiver no longer gets the dts signal.
Playing 5.1 videos in Kaffeine/Bino = Receiver is getting the dts signal, the sound is extremely crisp, actually pretty amazing. But, voice comes out of either the left or right speakers instead of the center.
Playing 5.1 videos in MPlayer2/VLC = Same behavior as Kaffeine, but sound seems less crisp.

So, aside from the initial speaker-test, everything else is not without problems that still need further scrutiny. To complicate it, there are no details on the ALSA site as to the status of my X-Fi card. It just says “Partially supported on 1.0.21; EAX and Advanced sound options like crystalizer not available” with no further details. Also, my limited understanding of the .asoundrc file and how to best configure could be a source of some issues. Other irritations with this card include a non-working mic jack (I use a usb adapter instead).

I think I hear my M-Audio Delta calling me…

Another thought - a lot of gaming edition laptops include X-Fi soundcards…something Linux users should consider before buying one.

Surround sound ‘just works’ for me with pulse audio. That means its difficult for me to provide suggestions as everything functions. Did you check a mixer such as amixer to see if all controls are set appropriately ?

I know some users figure adding the following to /etc/pulse/default.pa helps:


load-module module-alsa-sink device_id=0 channels=5 channel_map=front-left,front-right,rear-left,rear-right,lfe

then restarting and testing.

I have not found that necessary.

For me, pulse causes too many issues, mostly related to audio in games (native & wine). Well, its not necessarily pulse’s fault, but the easiest fix is to just get rid of it.

Yes, I did check all my levels…I’ve used kmix/alsamixer/envy24control at various stages. With pulse, or without it, my output was only 2 channel audio (although I could still get sound out of all my speakers, what I want is true 5.1 digital surround sound).

As I understand it, I first needed to get 2-channel PCM S/PDIF working, which I’ve done on two cards. One, the X-Fi, is connected via optical, the other, a M-Audio Delta 1010LT, is connected via coaxial. The X-Fi has questionable support status under ALSA, so, I’ve just finished setting up the M-Audio to compare test results (they are, for the most part, identical).

The second step, was to get AC3 encoding working. After initially looking into it, it sounded like I needed to get the a52 alsa plugin. Looking through the repos, that wasn’t available, but I did stumble across the dca plugin and it sounded like that would accomplish the same thing since my receiver supports dts. After installing that plugin, and testing, I did get 5.1 channels of dts audio. So, I figured my objective had been completed.

Now, with all the in-consistent audio behavior, something still needs to be done. For one, I think I need to try the A52 plugin and see what that gets me, the other is looking at my alsa config to see if there’s something else I can do to improve things. Also, the problem my not lie solely in my config as this mplayer ac3 bug might indicate.

Thanks, I might have some hardware for sale soon! ;-]

Am I correct that you already dumped pulse ?

Anyway, sorry to read of your negative pulse audio experience. I have the opposite experience with the hardware on my main PC, where with pulse the audio system is better than it ever was before. I note I don’t use wine for audio playback.

Yes, dumped Pulse. It was the bane of my 11.4 experience, but with 12.1 I could tell it had greatly improved. I have several indie and windows games that simply don’t start, or have major audio issues when using pulse. I’m looking towards the alsa/jack set-up anyway…once I get past this infernal digital audio thing I want to play around with some of the tools that are out there (rosegarden, hydrogen, etc).

The latest on my I-really-wish-this-wasn’t-an-epic-undertaking…I built the a52 alsa module, and upon testing I get:

$ speaker-test -Dplug:a52 -c 6 -twav

speaker-test 1.0.24.2

Playback device is plug:a52
Stream parameters are 48000Hz, S16_LE, 6 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 3072 to 32256
Period size range from 1536 to 1536
Using max buffer size 32256
Periods = 4
[ac3 @ 0x60d460] Specified sample_fmt is not supported.
Unable to set hw params for playback: Invalid argument
Setting of hwparams failed: Invalid argument
Segmentation fault

A quick look around and I see this avcodec bug report. This bug should be fixed, so…why me when I am so close to glory!

/shakes fist

I documented the steps to build the module using the source repo, will post once I get past this error and have tested some.

This follow up is an attempt to summarize what I’ve learned over the last couple days, and to improve on this post. For starts, the topic of this thread isn’t particularly accurate. It should be something more along the lines of:

No 5.1 Digital Surround Sound over S/PDIF (Solved!)

To clarify the important components of my hardware, I have a receiver that can decode Dolby Digital and DTS (that 5.1 soundtrack you’ll find on DVD’s) and my sound card is connected via optical S/PDIF.
Aside from capabilities, my use of an X-Fi card and Logitech receiver is mostly irrelevant information.
**
=== Initial confusion: un-confuse-ified ===**
*No channels listed in my mixer worked except “Front/Wave In”. Figuring out why that was the case, and more importantly why the “Surround Sound” channel didn’t work started this little time-sink.
-> This turned out to be an analog channel, and I had no analog connection between my receiver and soundcard. After connecting the appropriate cables, I was able to get sound out of this channel, however, that doesn’t necessarily equate to me or you having true surround sound. Depending on several factors, the sound could just be matrixed to emulate surround sound.

*I have a sound card that doesn’t have its support status fully listed on ALSA, it just says “Partially Supported”
-> This made me jump to the conclusion that any issues or non-functionality I had was probably due to non-functioning hardware. To test, I installed a fully supported card along side the X-Fi to compare results with. In the end, it didn’t matter since things that appeared not to work, simply turned out to be my lack of understanding about digital vs analog signals and connection capabilities, rather then non-functioning hardware.

*When running a speaker-test, I would only hear audio out of 2 speakers and not the other 3 + subwoofer.
-> This was because I was using a digital S/PDIF connection of which there are only 2 channels.

**
=== Connections === **
S/PDIF (digital): The S/PDIF connection can carry 2 PCM channels, or, with the help of some lossy formats, compressed surround sound. This is why its necessary to do some extra work to get those multi-channel soundtracks over to your receiver for decoding. You will need either a Coaxial or Optical (TOSLINK) cable to connect your receiver to your soundcard. S/PDIF can’t carry any of the new HD formats, so I’m guessing many consumer soundcards will phase it out in favor of HDMI.

HDMI (digital): HDMI supports 8 channel PCM streams and the newer lossless formats Dolby True-HD and DTS-HD. Since DD/DTS is only 6 channels, it seems reasonable to assume that the additional work needed to get DD/DTS over S/PDIF is not necessary with HDMI.

TRS (stereo/jack) (analog): Digital formats are first decoded and then converted to analog via your soundcards DAC (Digital-Audio-Converter). To get 6 individual channels (5.1), you will need 3 cables, or 4 cables for 7.1.

=== Step 1: Getting digital audio out of S/PDIF ===

  1. Connect your Optical or Coaxial cable, and make sure your receiver is set to to play audio from the appropriate input.
  2. Check your mixer for “IEC958”, this is what you’ll use to control S/PDIF. Some cards provide various options for output, if so, make sure it is set to “PCM Out”. Here’s an example from my M-Audio Delta 1010LT (My X-Fi has no options):

http://www.imgplace.com/img823/7165/85maudioiec958.th.png](http://www.imgplace.com/viewimg823/7165/85maudioiec958.png)

  1. Now test to ensure you are getting sound (you should only hear 2 channels):
$ speaker-test -D plug:spdif -c 6 -t wav

That’s it!
**

=== Step 2: Patents FTL ===**
Both Dolby Digital and DTS are patent encumbered. Consider this before continuing as there may be ramifications for using these plugins where you live.

If you want to continue, add the packman repo if you don’t have it already:
Additional package repositories - openSUSE

Now to get 5.1 working! Of the options, Step 2B is probably better because a) the Dolby Digital format is more common, b) this was what everyone else was doing. I came across no posts regarding the DTS option, however, there is a package for this plugin making it easier to set-up and test.

=== Step 2A: DTS Pass-through ===
Using the alsa dca plugin will allow you to send DTS encoded audio to your receiver.

  1. Install the DTS plugin & configure it:
# zypper in alsa-plugins-dca
  1. Configure it:
$ cp /usr/share/alsa/pcm/dca.conf > ~/.asoundrc
  1. Test:
$ speaker-test -D plug:dca -c 6 -t wav

At this point you should hear individual sound out of each speaker.
**

=== Step 2B: Dolby Digital Pass-Through ===**
Using the a52 alsa plugin will allow you to send Dolby Digital (AC3) encoded audio to your receiver. As of this writing, there isn’t an alsa-plugins-a52 package (maybe there never has been, or ever will be). So, you must build it yourself:

  1. Get the source code and dependecies:
 $ zypper lr | grep source 

| Alias | Name | Enabled | Refresh

----±-------------------------------------------±----------------------------------------------------±------------±-------
24 | repo-source | openSUSE-12.1-Source | No | Yes

If your source repo isn’t enabled, enable it:

 # zypper mr -e 'openSUSE-12.1-Source' 

Repository ‘repo-source’ has been successfully enabled.

# zypper in libffmpeg-devel
# zypper source-install alsa-plugins
  1. Compile:
# cd /usr/src/packages/SOURCES
# tar xvf alsa-plugins-*
# cd alsa-plugins-*
# ./configure
# make
  1. Install:
# cd a52/.libs
64: # cp libasound_module_pcm_a52.so /usr/lib64/alsa-lib/
32: # cp libasound_module_pcm_a52.so /usr/lib/alsa-lib/
  1. Restart alsa:
# rcalsasound restart
  1. Add an entry to ~/.asoundrc:

pcm.a52 {
  @args [CARD]
  @args.CARD {
    type string
  }
  type rate
  slave {
    pcm {
      type a52
      bitrate 448
      channels 6
      card $CARD
    }
  rate 48000 #required somehow, otherwise nothing happens in PulseAudio
  }
}

  1. Test:
$ speaker-test -D plug:a52 -c 6 -t wav

This is as far as I got. I get the error “[ac3 @ 0x60d460] Specified sample_fmt is not supported” and I haven’t invested any time to really figure it out. I’ll try again at some point in the future.

=== Additional Configurations ===
If you plan on using either, or both of the dca and a52 plugins, you’ll want to sift through some of the links below. There’s quite a bit more to concern yourself with beyond just getting them to “work”. For instance, configuring upmixing so your 2 channel audio isn’t sent to the receiver with 4 empty channels. I now understand why it sounded horribad!
**
=== Disclaimer ===**
← is an audio noob! Feel free to correct me!

**
=== References ===**
*https://en.wikipedia.org/wiki/Surround_sound
*https://en.wikipedia.org/wiki/5.1_surround_sound
*https://en.wikipedia.org/wiki/Dolby_Digital
*https://en.wikipedia.org/wiki/DTS_(sound_system)
*https://en.wikipedia.org/wiki/S/PDIF
*https://en.wikipedia.org/wiki/PCM_audio
*https://en.wikipedia.org/wiki/Digital-to-analog_converter
*Dmix - ALSA wiki
*SurroundSound - ALSA wiki
*DigitalOut - ALSA wiki
*https://wiki.archlinux.org/index.php/Advanced_Linux_Sound_Architecture
*Surround sound in Linux
*http://www.piotrkrzyzek.com/solved-creative-x-fi-titanium-ctxfi-on-ubuntu-11-10
*https://help.ubuntu.com/community/DigitalAC-3Pulseaudio
*Gentoo Wiki Archives - HOWTO_Dolby_Digital_and_DTS
*Dolby Digital with Linux and ALSA