# Need help to get it working: "x-fi surround 5.1"

## keenblade

I have an x-fi surround 5.1 which is a usb sound card. I want to use it with analog outputs. Actually I can get stereo sound using mplayer like this:

```
mplayer -ao alsa:device=hw=1.0 blabla.mp3
```

and also I can get all the 6 output working with some confusion (rear acts as csub and vice verse):

```

speaker-test -Dplughw:1,0 -c6 -t wav

speaker-test 1.0.23

Playback device is plughw:1,0

Stream parameters are 48000Hz, S16_LE, 6 channels

WAV file(s)

Rate set to 48000Hz (requested 48000Hz)

Buffer size range from 96 to 87381

Period size range from 48 to 43690

Using max buffer size 87380

Periods = 4

was set period_size = 21845

was set buffer_size = 87380

 0 - Front Left

 4 - Center

 1 - Front Right

 3 - Rear Right

 2 - Rear Left

 5 - LFE

Time per period = 7,294890

```

I believe media-sound/xfi-drivers does not work for usb x-fi card. So is there a solution to use it as a system wide sound card with 5.1 sound?

What is the current procedure, if there is one for a usb x-fi surround 5.1?

I've read threads here for x-fi driver, but it does not cover the usb one. There are posts for ubuntu, but obviously I won't install ubuntu.

Actually the hardware volume knob and mute button do not work on the card, too. Alsamixer does not have any control for the card. I guess the snd_usb_audio module  makes the card working somewhat.

And I hope I won't end up using pulseaudio. Any pointers?

Some info:

```

aplay -l

**** List of PLAYBACK Hardware Devices ****

card 0: Intel [HDA Intel], device 0: ALC861-VD Analog [ALC861-VD Analog]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

card 1: S51 [SB X-Fi Surround 5.1], device 0: USB Audio [USB Audio]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

card 1: S51 [SB X-Fi Surround 5.1], device 1: USB Audio [USB Audio #1]

  Subdevices: 1/1

  Subdevice #0: subdevice #0

```

```

aplay -L

null

    Discard all samples (playback) or generate zero samples (capture)

default:CARD=Intel

    HDA Intel, ALC861-VD Analog

    Default Audio Device

front:CARD=Intel,DEV=0

    HDA Intel, ALC861-VD Analog

    Front speakers

surround40:CARD=Intel,DEV=0

    HDA Intel, ALC861-VD Analog

    4.0 Surround output to Front and Rear speakers

surround41:CARD=Intel,DEV=0

    HDA Intel, ALC861-VD Analog

    4.1 Surround output to Front, Rear and Subwoofer speakers

surround50:CARD=Intel,DEV=0

    HDA Intel, ALC861-VD Analog

    5.0 Surround output to Front, Center and Rear speakers

surround51:CARD=Intel,DEV=0

    HDA Intel, ALC861-VD Analog

    5.1 Surround output to Front, Center, Rear and Subwoofer speakers

surround71:CARD=Intel,DEV=0

    HDA Intel, ALC861-VD Analog

    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

default:CARD=S51

    SB X-Fi Surround 5.1, USB Audio

    Default Audio Device

front:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    Front speakers

surround40:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    4.0 Surround output to Front and Rear speakers

surround41:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    4.1 Surround output to Front, Rear and Subwoofer speakers

surround50:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    5.0 Surround output to Front, Center and Rear speakers

surround51:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    5.1 Surround output to Front, Center, Rear and Subwoofer speakers

surround71:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers

iec958:CARD=S51,DEV=0

    SB X-Fi Surround 5.1, USB Audio

    IEC958 (S/PDIF) Digital Audio Output

```

----------

## keenblade

Ok, for x-fi surround 5.1, here is my tweaked .asoundrc file that I am quite happy with:

```

pcm.!default {

    type            plug

    slave.pcm       "softvol"

}

ctl.!default {

    type hw

    card 1

}

ctl.softvol

{

type hw

card 1

} 

pcm.softvol {

type softvol

slave {

pcm "upmix_20to51"

}

control {

name "Master" #override the PCM slider to set the softvol volume level globally

card 1

}

}

pcm.dmixed {

    type   asym

    playback.pcm {

           type   dmix

           ipc_key 5678293

       ipc_perm 0660

       ipc_gid audio

       slave {

                      channels 6

                pcm {

               format S16_LE

          rate 48000

          type hw

              card 1

              device 0

              subdevice 0

              }

          }

 

      }

   }

pcm.!surround20 {

   type plug

   slave.pcm "dmixed"

}

pcm.!surround40 {

   type plug

   slave.pcm "dmixed"

}

pcm.!surround51 {

   type plug

   slave.pcm "dmixed"

}

pcm.ch51dup {

        slave.pcm "dmixed"

        slave.channels 6

        type route

 

        # Front

        ttable.0.0 0.5

        ttable.1.1 0.5

        # Rear

        ttable.2.4 2

        ttable.3.5 2

        # Front left/right to rear

        ttable.0.4 1

        ttable.1.5 1

        # Center

        ttable.4.2 0.5

        # Front left/right to center

        ttable.0.2 0.5

        ttable.1.2 0.5

 

        # LFE

        ttable.5.3 1

        # Front to LFE

        ttable.0.3 0.5

        ttable.1.3 0.5

}

# speaker-test -D upmix_20to51 -c 2 -t wav

pcm.upmix_20to51 {

   type plug

   slave.pcm "lowpass_21to21"

   slave.channels 3

   ttable {

      0.0     0.5       # left channel

      1.1     0.5       # right channel

      0.3     2     # mix left and right ...

      1.3     2     # ... channel for subwoofer

   }

}

pcm.lowpass_21to21 {

   type ladspa

   slave.pcm upmix_21to51

   # Set the path to ladspa, to fix this error:

   # Playback open error: -2,No such file or directory

   path "/usr/lib/ladspa"

   channels 3

   plugins {

      0 {

         id 1098  # Identity (Audio) (1098/identity_audio)

         policy duplicate

         input.bindings.0 "Input";

         output.bindings.0 "Output";

      }

      1 {

         id 1052  # High-pass filter front left

         policy none

         input.bindings.0 "Input";

         output.bindings.0 "Output";

         input {

            controls [ 200 ]

         }

      }

      2 {

         id 1052  # High-pass filter front right

         policy none

         input.bindings.1 "Input";

         output.bindings.1 "Output";

         input {

            controls [ 200 ]

         }

      }

      3 {

         id 1672  # Low-pass filter.

         policy none

         input.bindings.2 "Input";

         output.bindings.2 "Output";

         input {

            controls [ 300 2 ]

         }

      }

   }

}

# Debugging:  speaker-test -D upmix_21to51 -c 3 -t wav

pcm.upmix_21to51 {

   type plug

   slave.pcm "dmixed"

#   slave.pcm "lowpass_21to21"

   slave.channels 6

   ttable {

      0.0     1       # front left

      1.1     1       # front right

      0.4     2       # rear left

      1.5     2       # rear right

      # Front left/right to center.

      # Imbalanced because is to the left of the monitor!

      # Would normally be 0.5 each.

      0.2     0.5

      1.2     0.5

      # Subwoofer, more powerful to compensate for bass-removal from other speakers.

      2.3     2

    }

}

```

high and low pass filters are now in my config. 

Anyway, I am happy with the music that surrounds me coming all off my six output  :Smile: 

Btw, "U2 - Pride" is playing here. Great song though.

I use mpd + gmpc for music. So I need to use this config for ~/.mpdconf:

```

audio_output {

          type    "alsa"

          device  "plug:ch51dup"

          name    "ch51dup"

        }

audio_output {

          type    "alsa"

          device  "plug:lowpass_21to21"

          name    "lowpass_21to21"

        }

```

If I choose "ch51dup" stereo music is converted to 5.1 sound. If I choose " lowpass_21to21" also frequencies are adjusted which makes sound great on my logitech sound system. I don't know why this does not work in .mpdconf?

device  "plug:upmix_20to51"

----------

## PaulBredbury

 *keenblade wrote:*   

> I am happy with the music that surrounds me coming all off my six output 

 

It can be improved - use your subwoofer and tweeters for their appropriate frequencies.

----------

## keenblade

 *PaulBredbury wrote:*   

> 
> 
> It can be improved - use your subwoofer and tweeters for their appropriate frequencies.

 

Thanks, PaulBredbury. I'll try to borrow your config to adjust frequencies. It is not easy to understand and apply it though.

Although, I have read many of your useful threads about sound, I should have missed that one.

----------

## keenblade

I think .asoundrc file is very hard to manage and I confess I could not manage to apply high and low pass filters to my above config.

So, I will have to live with no frequency filtering unless somebody help me with it.

----------

## PaulBredbury

Well, debug it. *Look* at my config. Notice the packages that you need to install, and the debugging commands shown. E.g.:

listplugins

speaker-test -D plug:lowpass_21to21 -c 3 -t wav

----------

## keenblade

Frequency filtering works now. Only I can't use volume adjustment within sound mixer (alsamixer or any other mixer.)

I need to understand how to relate softvol with ch51dup and lowpass_21to21?

Actually, lowpass_21to21 is using ch51dup and I have six output working. But how can I relate softvol and lowpass_21to21, so I can use them globally with a working volume mixer?

----------

## PaulBredbury

 *keenblade wrote:*   

> lowpass_21to21 is using ch51dup

 

Er, that sounds pointless and wrong.

The point of lowpass is that the low sounds go only to *one* speaker, the subwoofer.

You should be playing with all the speaker-test commands in my config, so you can get an understanding of how all the PCMs work individually and together.

----------

## keenblade

 *PaulBredbury wrote:*   

>  *keenblade wrote:*   lowpass_21to21 is using ch51dup 
> 
> Er, that sounds pointless and wrong.
> 
> The point of lowpass is that the low sounds go only to *one* speaker, the subwoofer.
> ...

 

I tried your speaker-test commands. Actually I used your config as a basis. I think I got it working finally globally.

Could you take a look at my config above? I updated it. If you look at "pcm.lowpass_21to21" it is using lowpass filter for sub, but it is also using high pass filters for left and right channels. The thing I can't understand what is happening with the rest of channels. Are the highpass filters are applied to center and rear speakers?

----------

## PaulBredbury

 *keenblade wrote:*   

> Actually I used your config as a basis

 

And then tweaked it until you broke it  :Shocked: 

Telling the music player to use lowpass_21to21 is wrong. It's just a processing stage! The music program should output to upmix_20to51. And if that doesn't work for you, test it with speaker-test and SHOW AN ERROR MESSAGE!

Here's my latest ~/.asoundrc, FWIW. The ALSA wiki URLs have changed slightly (removed "index.php\").

 *Quote:*   

> Are the highpass filters are applied to center and rear speakers?

 

See explanation in ALSA wiki entry.

----------

