HOW-TO:Remap HDMI audio on Gen 1 ION - Linux

Some early Nvidia ION based motherboards have their HDMI audio channels mapped incorrectly. There are two relatively simple methods to remap HDMI audio on Nvidia ION-based systems. Which one you use depends on your setup. If you require passthrough, disabling Pulseaudio (if your distribution uses it by default) is necessary to configure ALSA to remap the channels. Configuring Pulseaudio to remap the channels is another option if you don't require passthrough.

It should be noted, that whenever editing config files it's best to backup the original.

Remapping Surround Channels (ALSA)
The following steps require the removal of Pulseaudio if your distribution uses it by default.

HDMI audio output requires several steps to configure properly. My requirements were passthrough, non-passthrough and menu sounds all coming over HDMI to my receiver (fairly common). Some challenges were that the Gen 1 ION had incorrect channel mappings (e.g. Center came out of Left Rear) and menu sounds do not default to HDMI.

I first noticed the audio channels were mis-mapped while watching a movie - all the voices were coming out of the left rear channel, not center. To verify this, I ran the following command:

speaker-test -D hdmi -c 6

To correct the output, I created the following channel mapping in ~/.asoundrc or /etc/asound.conf(.asoundrc overrides the default alsa settings per user, while /etc/asound.conf is a global settings override)

ALSA Configuration
Untested in Frodo. pcm.hdmi-remap { 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 ttable.6.6 1 ttable.7.7 1 }




 * To test our new configuration, we can run:

speaker-test -D hdmi-remap -c 6

Hopefully the channels will now be mapped correctly.

XBMC Configuration
Within Settings -> System -> Audio Output, I set the following values:


 * Audio Output : HDMI
 * Speaker Configuration : 7.1
 * Boost volume level on downmix : No
 * Dolby Digital (AC3) capable receiver : Yes
 * DTS capable receiver : Yes
 * Audio output device : Custom
 * Custom audio device : hdmi-remap
 * Passthrough output device : hdmi(ALSA)

Menu Sounds


To configure menu sounds, I told alsa to use the hdmi-remap device as default. I did this by adding the following section to my ~/.asoundrc file:

pcm.!default { type plug slave.pcm hdmi-remap }

ALSA Configuration
pcm.!default { type plug slave { pcm both } }

pcm.both { 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 }

speaker-test -D hdmi -c 6
 * To test our new configuration, we can run:

XBMC Configuration
Within Settings -> System -> Audio Output, I set the following values:


 * Audio Output : HDMI
 * Speaker Configuration : 5.1
 * Boost volume level on downmix : No
 * Dolby Digital (AC3) capable receiver : Yes
 * DTS capable receiver : Yes
 * Audio output device : HDA NVidia HDMI 0
 * Passthrough output device : HDA NVidia HDMI 0

After a reboot, sound should be working as expected. Feel free to update this information as needed.

ALSA Configuration
The following .asoundrc settings will allow XBMC to use exclusive HDMI passthrough, while defaulting to a dmix plugin for the XBMCbuntu desktop mode (so that multiple applications can share HDMI access):

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" }


 * Test passthrough mode with:

speaker-test -D hdmi_direct -c 6


 * And default/shared mode with:

speaker-test -c 6


 * It may also be worth testing each with -c 2 instead of -c 6 to ensure that 2-channel inputs will work.

XBMC Configuration
Within Settings -> System -> Audio Output, I set the following values:


 * Audio Output : HDMI
 * Speaker Configuration : 5.1
 * Boost volume level on downmix : No
 * Dolby Digital (AC3) capable receiver : Yes
 * DTS capable receiver : Yes
 * AAC capable receiver : Yes (note that AAC appears to reach my receiver as 5.1 LPCM, regardless of this setting)
 * MultiChannel LPCM capable receiver : Yes
 * Audio output device : HDA NVidia HDMI(hdmi_direct)
 * Passthrough output device : HDA NVidia HDMI(hdmi_direct) (note that this setting apparently doesn't matter, as Frodo seems to use the "Audio output device" setting for both passthrough and non-passthrough modes when "Audio Output" is set to "HDMI")

After a reboot, sound should be working as expected in both XBMC and in XBMCbuntu desktop applications. Feel free to update this information as needed.

Remapping Surround Channels (Pulseaudio)
Some may find that removing Pulseaudio breaks other programs and causes problems. If your setup does not require passthrough and your receiver supports multichannel PCM, you may want to configure Pulseaudio instead. These directions were adapted from here.

Configure Pulseaudio
1. Run from the command-line: speaker-test -c6 -twav

2. Note which channels need to be remapped, I just wrote them down like so: SOUND                     SPEAKER Left Front         ————-> Left Front Center Front       ————-> Left Rear Right Front        ————-> Right Front Left Rear          ————-> Center Front Subwoofer (lfe)    ————-> Right Rear Right Rear         ————-> Subwoofer (lfe)

3. Edit "/usr/share/pulseaudio/alsa-mixer/profile-sets/extra-hdmi.conf" with your favorite text editor as root. I'm using xubuntu 12.04, so I'll be using leafpad: sudo leafpad /usr/share/pulseaudio/alsa-mixer/profile-sets/extra-hdmi.conf

4. This file contains the Pulseaudio profiles for your HDMI audio outputs. There should be a few entries that say something about 5.1 or 7.1 audio over HDMI. Like this: [Mapping hdmi-surround] description = Digital Surround 5.1 (HDMI) device-strings = hdmi:%f paths-output = hdmi-output-0 channel-map = front-left,front-right,rear-left,rear-right,front-center,lfe priority = 3 direction = output

Edit them to fit your needs based on the channel map you wrote down earlier. I edited all of them (except the 7.1 ones, as I only have a 5.1 setup, I would assume things would be similar for 7.1) like so: [Mapping hdmi-surround] description = Digital Surround 5.1 (HDMI) device-strings = hdmi:%f paths-output = hdmi-output-0 channel-map = front-left,front-right,front-center,lfe,rear-left,rear-right priority = 3 direction = output

5. Restart Pulseaudio to load your new channel maps and run a speaker test: pulseaudio -k pulseaudio --start speaker-test -c6 -twav If everything is coming out of the right channel then you're all set!

Configure XBMC
Within Settings -> System -> Audio Output, set:


 * Audio Output : HDMI
 * Speaker Configuration : 5.1 (or 7.1 depeding on your setup)
 * Boost volume level on downmix : Yes
 * Dolby Digital (AC3) capable receiver : No
 * DTS capable receiver : No
 * Audio output device : defaults(Pulseaudio)
 * Passthrough output device : hdmi(ALSA) (won't be used, you can set it to whatever you'd like)

Tested with Xubuntu 12.04, XBMC Eden, on an ASRock ION330 motherboard