Problem with 5.1 channel mapping, help configuring asound.conf
#1
I'm in a curiously similar situation as the OP of this other thread. When I play files with FLAC audio, the channel mapping is all over the place: speech comes from the left rear surround and surround sound seems to be coming from the front speakers (right rear surround has no sound). AFAIK it only happens with these files with FLAC in them; the rest of my files (that are not FLAC) have no problem with channel mapping.

I'm using XBMCFreak's maverickv3 build on a Foxconn 330i, connected to a Sony 5.1 HTIB system via HDMI.

There is no asound.conf files in /etc/, but there is one in /usr/share/xbmc/system:

Code:
# downmixing to 2 channels
pcm.xbmc_71to2 {
  @args.0 SLAVE
  @args.SLAVE {
    type string
    default "default"
  }
  type plug
  slave.pcm $SLAVE
  slave.channels 2
  route_policy duplicate
  ttable.0.0 1          # front left speaker
  ttable.1.1 1          # front right speaker
  ttable.2.0 0.7        # rear left speaker
  ttable.3.1 0.7        # rear right speaker
  ttable.4.0 0.7        # center to left mapping
  ttable.4.1 0.7        # center to right mapping
  ttable.5.0 0.5        # LFE (base) to left mapping
  ttable.5.1 0.5        # LFE to right mapping
  ttable.6.0 0.6    # SL to left mapping
  ttable.7.0 0.6    # SR to right mapping
}

# downmixing to 2 channels
pcm.xbmc_51to2 {
  @args.0 SLAVE
  @args.SLAVE {
    type string
    default "default"
  }
  type plug
  slave.pcm $SLAVE
  slave.channels 2
  route_policy duplicate
  ttable.0.0 1          # front left speaker
  ttable.1.1 1          # front right speaker
  ttable.2.0 0.7        # rear left speaker
  ttable.3.1 0.7        # rear right speaker
  ttable.4.0 0.7        # center to left mapping
  ttable.4.1 0.7        # center to right mapping
  ttable.5.0 0.5        # LFE (base) to left mapping
  ttable.5.1 0.5        # LFE to right mapping
}

# downmixing to 2 channels
pcm.xbmc_50to2 {
  @args.0 SLAVE
  @args.SLAVE {
    type string
    default "default"
  }
  type plug
  slave.pcm $SLAVE
  slave.channels 2
  route_policy duplicate
  ttable.0.0 1          # front left speaker
  ttable.1.1 1          # front right speaker
  ttable.2.0 0.7        # rear left speaker
  ttable.3.1 0.7        # rear right speaker
  ttable.4.0 0.7        # center to left mapping
  ttable.4.1 0.7        # center to right mapping
}
Reply
#2
You will need to add an /etc/asound.conf

Code:
pcm.!hdmi-remap {
  type asym
  playback.pcm {
    type plug
    slave.pcm "remap-surround71"
  }
}

pcm.!remap-surround71 {
  type route
  slave.pcm "hw:0,3"
  ttable {
    0.0= 1
    1.1= 1
    2.4= 1
    3.5= 1
    4.2= 1
    5.3= 1
    6.6= 1
    7.7= 1
  }
}

and reboot or

Code:
sudo alsa-utils restart

Then set youir XBMC audio output to 'hdmi-remap'

Now, are your FLAC files straight up multichannel FLAC audio or in audio from an MKV container etc?

If straight up audio - test with both PAPlayer and DVDPlayer. You will get correct channel mapping (IIRC) with DVDplayer. Let me know.

If they are audio files then you will need to either:

a) use DVDPlayer to play them or

b) re-map them and use PAPlayer or a 3rd party audio player.

You can use 'route' in your asound.conf to map them correctly or re-map the FLAC files. If you use the 'route' method, please keep in mind other formats that are decoded and sent as LPCM by XBMC may map incorrectly.
Reply
#3
The audio is contained inside a MKV file.

Here's the "MediaInfo" from MPC-HC when I check its properties through Windows (issue is @ XBMC Live of course)
Quote:Audio #1
ID : 2
Format : FLAC
Format/Info : Free Lossless Audio Codec
Codec ID : A_FLAC
Duration : 59mn 5s
Bit rate mode : Variable
Channel(s) : 6 channels
Sampling rate : 48.0 KHz
Bit depth : 24 bits
Title : 5.1 FLAC
Writing library : libFLAC 1.2.1 (UTC 2007-09-17)
Language : Japanese

I made a new asound.conf in /etc/ but I am unable to select it via XBMC->Settings->System->Audio Output. Only options are still HDMI, Optical/Coax, Analog.
Reply
#4
OK, you need to set 'HDMI' for the Audio Output setting (top of screen) and for 'Audio Device' (bottom of screen), you will need to select 'custom' audio output and manually enter 'hdmi-remap'.
Reply
#5
An overdue thanks. Audio has been working well for all the different files I've played thus far.
Reply
#6
Thanks, this fixed Eden's HDMI mode for me so that AAC 5.1 audio plays as 5.1 LPCM on my A/V receiver. I previously had to switch to Optical/Coax mode over HDMI to transcode to 5.1 Dolby Digital AC3, but this is better.
Reply
#7
I just upgraded to XBMCbuntu 12.0 Frodo and am experiencing this issue again. Is this still the best/only way to fix it? I'm disappointed it didn't get fixed with the introduction of AudioEngine, especially since AE was used as an excuse to close a bug report I had previously opened on the issue.

Edit: Might give this a shot: http://wiki.xbmc.org/index.php?title=HOW...5.1:_Frodo

Edit 2: Yep, the wiki fix worked for me.
Reply
#8
I think this warrants an additional post. After a ton of effort, I've built an ~/.asoundrc that gets me the following:
  • Correct LPCM/AAC 5.1 channel mapping.
  • Proper 2.0/5.1 HDMI passthrough of PCM/AC3/DTS/LPCM/AAC.
  • Menu sounds.
  • Sound in multiple applications running simultaneously in XBMCbuntu desktop mode.

Here it is:
Code:
pcm.hdmi_direct {
        type route
        slave {
                pcm "hdmi"
        }
        ttable.0.0 1
        ttable.1.1 1
        ttable.2.4 1
        ttable.3.5 1
        ttable.4.2 1
        ttable.5.3 1
}

pcm.hdmi_shared {
        type route
        slave {
                pcm "hdmi_dmixer"
        }
        ttable.0.0 1
        ttable.1.1 1
        ttable.2.4 1
        ttable.3.5 1
        ttable.4.2 1
        ttable.5.3 1
}

pcm.hdmi_dmixer {
        type dmix
        ipc_key 1024
        ipc_key_add_uid false
        ipc_perm 0660
        slave {
                pcm "hw:0,3"
        }
}

pcm.!default {
        type plug
        slave.pcm "hdmi_shared"
}

In XBMC's audio output settings, set:
  • Audio output = HDMI. This is required to gain access to LPCM/TrueHD/DTS-HD passthrough options.
  • Speaker Configuration = 5.1.
  • Audio output device = hdmi_direct. It turns out that AudioEngine uses this setting for HDMI passthrough, instead of the Passthrough output device (WTF?).
  • Passthrough output device = anything. It doesn't matter at all, because XBMC AudioEngine apparently doesn't use this for HDMI.

You should be able to log out (exit) from XBMC and then log back in to make the .asoundrc and XBMC changes take effect, but rebooting never hurts.

The main thing that drove me to do this was that I wanted to be able to play games via the Steam Linux client. It seems that Steam (at least in Big Picture mode) holds onto an ALSA stream, so games launched from it aren't able to have sound unless everything is going through a dmix plugin.

Edit: Made some fixes, as LPCM/AAC 5.1 passthrough was not working after all. Turns out I made a bad assumption, as XBMC "Passthrough output device" is not used at all for Audio output = HDMI. Also, 'type plug' should apparently be used by the pcm.!default setting in .asoundrc to accommodate both 2- and 6-channel usage of shared mode (wasn't able to do 6-channel speaker-test without it).

Edit 2: Note that on Gen 1 ION, AAC passthrough doesn't seem to be supported. XBMC implicitly converts to LPCM when possible, or AC3 otherwise. If you have a 5.1 LPCM capable receiver, this is OK because it means that it's just decoding the AAC on the XBMC side and passing the result through as uncompressed 5.1 LPCM.

Edit 3: As a follow-up to this, I should note that 5.1 LPCM seems to be working but is not necessarily using perfect passthrough. Normally, it is not possible to adjust the volume of passthrough streams in XBMC itself, but I seem to be able to do so for 5.1 LPCM streams. Hopefully XBMC is not altering the stream when the volume is set to full.
Reply
#9
After a lot of searching for solutions and trying them to find them not working for me, I found this via the Frodo FAQ and the How To remap HDMI audio on gen 1 ION . Unfortunately this does not work for me either and made me register so I could ask for help.

I have an Asrock ION 330 BD.
And a receiver that supports all multichannel audio XBMC can offer.

With XBMC 11.0 I had a mapping problem (center speaker from left rear) with AAC files which was easily solved by setting Audio Output to optical/coax and Audio Output Device to HDMI.

With XBMC 12.0 I have a problem with AC3 files. No center speaker (mostly speech dialog) at all.
The optical/coax trick doesn't seem to work
The .asoundrc files that are mentioned in the remap wiki don't seem to work either.

What else can I try?
Reply
#10
Questions:
  • What exact XBMC audio settings are you trying to use in conjunction with the .asoundrc above?
  • Do you get any sound at all when using it?
  • Are you using XBMCbuntu, or XBMC installed on top of another Linux distro?

I don't think the optical/coax trick is applicable in XBMC 12 due to the new AudioEngine.
Reply
#11
Always run speaker-test first to figure out which channels are coming from where. After that, start working on an asound.conf. I had this very same problem with FLAC 5.1 over HDMI back in the Eden days, although that was a bug in ALSA (which eventually got fixed), not XBMC.
Reply
#12
When I tried the above .asoundrc I set:
Audio output = HDMI
Speaker Configuration = 5.1.
Audio output device = hdmi_direct
Passthrough output device = hdmi_direct

Stereo and Multichannel works just fine with the exception for files with AC3 audio.
With AC3 multichannel I hear nothing from the center speaker. So most dialogue is muted.

I had XBMCbuntu 11 and upgraded to 12. For some reason it had worked fine on 12 until recently.
I don't know what might have caused it. The only thing I do is an occasional apt-get upgrade, which had not broken anything whenever I did that on Eden. Maybe it did break something in Frodo.

Also about the speaker test. Do I have to be in the terminal? because when I run the command from putty while my XBMC is up, it doesn't work.
Reply
#13
You need to run it when XBMC is closed, otherwise it can't open the audio device. And yes, it should be run from the terminal.
Reply
#14
In Frodo, you have to change your asound.conf file (or.asroundrc), since you can't specify a custom device anymore. See here:

http://wiki.xbmc.org/index.php?title=HOW...5.1:_Frodo
Reply
#15
Thanks.
I found that wiki page already and tried the configuration as specified under 1.2.1 ALSA Configuration.
What happened is that it wouldn't boot to XBMC and show me the desktop, after a while I found out that
Code:
pcm.both {
    type route
    slave {
        pcm hdmi
was wrong because it should say pcm "hdmi"

After I boot to XBMC, then ctrl+alt+f1 to the terminal and run speaker-test -D hdmi -c 6 it gives me an error Device or Resource busy.
What do I need to do to close XBMC after I switched to the terminal?

I tried the configuration and setup as specified under 1.2.1 ALSA configuration as well as 1.3.1 ALSA Configuration.
With All 3 the configurations (Old, 1.2.1 and 1.3.1) The stereo and multichannel is just fine as it should be for all files except for AC3. The center channel produces nothing.

What else can I try?
Maybe reset the whole alsa stuff or reinstall it?
Or use pulseaudio?
Or even revert back to 11 Eden?
Reply

Logout Mark Read Team Forum Stats Members Help
Problem with 5.1 channel mapping, help configuring asound.conf0