MythTV the GT220, HDMI and ALSA

Grabbed a Gigabyte GT220 based card for the MythTV box. $86AUD from msy.com.au. Dropped it in the Mythbox and it fires straight up for video, configure for VDPAU and we are good to go. The driver was NVidia’s 185 which produced a lot of tearing/vsync issues and an upgrade was in order. They’ve done some repackaging of the NVidia drivers which caused a bit of grief with one of the libraries (I ended up using dpkg – r to remove it as apt-get remove or aptitiude would try and remove MythTV, the packagers of Mythbuntu binding the NVidia drivers to MythTV itself, oh well).

So the upgrade to NVidia 195.36 allows me to fully use VDPAU on the GT220, the output quality is great and the CPU (C2D E4600) runs at about 5-10%. Happy with that 😉

So next is the HDMI audio. A little bit of a task of recompiling ALSA with the GT220 patch from XBMC (check out XBMC btw, create software I’ve been using it on my modded XBox-1 for years now and have always been impressed). So for those with a GT220 and wanting HDMI Audio on ALSA check this out http://wiki.xbmc.org/?title=HOW-TO_set_up_HDMI_audio_on_nVidia_GeForce_G210,_GT220,_or_GT240

Now the .asoundrc for ALSA. I have a bit of a funny setup, I run 5.1 analog surround from the onboard audio and I wanted to run the HDMI audio into the Plas along with the video. Looking to retain the 5.1 analog, 2 ch stereo from the plas and monitor the audio out for the wireless headphones. Having got the hardware settled it was onto the audio config (~/.asoundrc) . Was an afternoon well spent with the following result: (update not so good after all see below)

######################################
#
# .asoundrc
#
# 21-Feb-2010 Ross Dawson (c) GPL you can use it
#
# ALSA sound configuration
#
# using onboard Intel HDA hardware & NVidia GT220 HDMI card
#
# Audio out is via both cards the HDMI goes to the tell and play 100% volume
# so the TV can handle the volume and my wireless headphones work at 100%
# volume. They have their own volume control
# HDMI is also mapped to Stereo until I get a good receiver. The panasonic
# TV does not downmix the audio from 5.1 to stereo (bah!)
#
# The onboard analog sound is used to drive my surround system in 5.1 config
# and employs a softvol volume control “Master” for use with MythTV
# Set MythTV to Alsa:Default and “Master” and you should be good to go
# Default device
pcm.!default {
type plug
slave.pcm “both”
}
#softvol
pcm.softvol {
type softvol
# only for the onboard analog
slave.pcm “onboard”
control.name “Master”
control.card 0
}
# router to both oboard and GT220
pcm.both {
type route;
slave.pcm {
type multi;
# onboard analog via softvol
slaves.a.pcm “softvol”;
slaves.a.channels 6;
bindings.0.slave a;
bindings.0.channel 0;
bindings.1.slave a;
bindings.1.channel 1;
bindings.2.slave a;
bindings.2.channel 2;
bindings.3.slave a;
bindings.3.channel 3;
bindings.4.slave a;
bindings.4.channel 4;
bindings.5.slave a;
bindings.5.channel 5;
# GT220 HDMI
slaves.b.pcm “gt220”;
slaves.b.channels 6;
bindings.6.slave b;
bindings.6.channel 0;
bindings.7.slave b;
bindings.7.channel 1;
bindings.8.slave b;
bindings.8.channel 2;
bindings.9.slave b;
bindings.9.channel 3;
bindings.10.slave b;
bindings.10.channel 4;
bindings.11.slave b;
bindings.11.channel 5;
}
# Onboard 5.1 surround
ttable.0.0 1; #LF
ttable.1.1 1; #RF
ttable.2.2 1; #LR
ttable.3.3 1; #RR
ttable.4.4 1; #CTR
ttable.5.5 1; #LFE
# # GT220 5.1 surround
# ttable.0.6 1; #LF
# ttable.1.7 1; #RF
# ttable.2.8 1; #LR
# ttable.3.9 1; #RR
# ttable.4.10 1; #CTR
# ttable.5.11 1; #LFE

# Upmix 5.1 to stereo for the TV
# GT220 5.1 surround
ttable.0.6 1; #LF
ttable.1.7 1; #RF
# Centre channel
ttable.4.6 0.7; #CTR -> LF
ttable.4.7 0.7; #CTR -> RF
# Rears
ttable.2.6 0.2; #LR -> LF
ttable.3.7 0.2; #RR -> RF
# LFE
ttable.5.6 0.2; #LFE -> LF
ttable.5.7 0.2; #LFE -> RF
}
ctl.both {
type hw;
card 0
}
pcm.onboard {
type dmix
ipc_key 1024
slave {
pcm “hw:0”
period_time 0
# period_size 2048
period_size 1024
buffer_size 4096
# buffer_size 8192
# buffer_size 65536
buffer_time 0
periods 128
rate 48000
channels 6
}
# the channels of this card are mixed-up
bindings {
0 0
1 1
2 2
3 3
4 4
5 5
}
}
pcm.gt220 {
type dmix
ipc_key 2048
slave {
pcm “hw:1,7”
#device 7
period_time 0
period_size 1024
buffer_size 4096
# period_size 2048
# buffer_size 8192
# buffer_size 65536
buffer_time 0
periods 128
rate 48000
channels 6
# channels 2
}
bindings {
0 0
1 1
2 2
3 3
4 4
5 5
}
}
ctl.onboard {
type hw
card 0
}
ctl.gt220 {
type hw
card 1
}
#pcm.!hdmi {
# @args [ AES0 AES1 AES2 AES3 ]
# @args.AES0 {
# type integer
# # consumer, not-copyright, emphasis-none, mode=0
# default 0x04
# }
# @args.AES1 {
# type integer
# # original, PCM coder
# default 0x82
# }
# @args.AES2 {
# type integer
# # source and channel
# default 0x00
# }
# @args.AES3 {
# type integer
# # fs=48000Hz, clock accuracy=1000ppm
# default 0x02
# }
# type hooks
# slave.pcm {
# type hw
# card 1
# device 7
# }
# hooks.0 {
# type ctl_elems
# hook_args [
# {
# name “IEC958 Playback Default”
# lock true
# preserve true
# value [ $AES0 $AES1 $AES2 $AES3 ]
# }
# {
# name “IEC958 Playback Switch”
# lock true
# preserve true
# value true
# }
# ]
# }
#}

Update on this as running dual channels together did not work well. Channels would drop out and stop working so I resorted to running separate configurations and if needed I change them to suit. I still need to put together something that is driven from the remote so I can swap between all the different configurations (HDMI, Analog and different channel mappings for AAC audio in MythTV (tis broken on 0.21, 0.22 but may be fixed on 0.23).

So my config is as follows:-

######################################
#
# .asoundrc
#
# 21-Feb-2010 Ross Dawson (c) GPL you can use it
#
# ALSA sound configuration
#
# using onboard Intel HDA hardware & NVidia GT220 HDMI card
#
# Audio out is via both cards the HDMI goes to the tell and play 100% volume
# so the TV can handle the volume and my wireless headphones work at 100%
# volume. They have their own volume control
# HDMI is also mapped to Stereo until I get a good receiver. The panasonic
# TV does not downmix the audio from 5.1 to stereo (bah!)
#
# The onboard analog sound is used to drive my surround system in 5.1 config
# and employs a softvol volume control "Master" for use with MythTV
# Set MythTV to Alsa:Default and "Master" and you should be good to go

# Default device
#pcm.!default {
# type plug
# slave.pcm "onboard"
#}

# map 6 channel down to stereo for TV
pcm.51toStereo {
type route
slave.pcm gt220
slave.channels 6
ttable.0.0 1; #LF
ttable.1.1 1; #RF
# Centre channel
ttable.4.0 0.7; #CTR -> LF
ttable.4.1 0.7; #CTR -> RF
# Rears
ttable.2.0 0.5; #LR -> LF
ttable.3.1 0.5; #RR -> RF
# LFE
ttable.5.0 0.5; #LFE -> LF
ttable.5.1 0.5; #LFE -> RF
}

pcm.51toStereoAAC {
type route
slave.pcm gt220
slave.channels 6

# AAC comes out the wrong channels
# Map Centre on ChO
ttable.0.0 0.7;
ttable.0.1 0.7;
# Map FL on Ch1
ttable.1.0 1;
#Map RR on Ch 2
ttable.2.1 0.5;
#Map LFE on C3
ttable.3.0 0.5;
ttable.3.1 0.5;
#Map FR on C4
ttable.4.1 1;
#Map RL on C5
ttable.5.0 0.5;

}

pcm.surround51AAC {
type route
slave.pcm surround51
slave.channels 6

# AAC comes out the wrong channels
# Map Centre on ChO
ttable.0.4 1;
# Map FL on Ch1
ttable.1.0 1;
#Map RR on Ch 2
ttable.2.3 1;
#Map LFE on C3
ttable.3.5 1;
#Map FR on C4
ttable.4.1 1;
#Map RL on C5
ttable.5.2 1;

}

#pcm.onboard {
# type dmix
# ipc_key 1024
# slave {
# pcm "hw:0"
# period_time 0
# period_size 1024
# buffer_size 4096
# buffer_time 0
# periods 128
# rate 48000
# channels 6
# }
# bindings {
# 0 0
# 1 1
# 2 2
# 3 3
# 4 4
# 5 5
# }
#}

pcm.gt220 {
type dmix
ipc_key 2048
slave {
pcm "hw:1,7"
period_time 0
period_size 1024
buffer_size 4096
buffer_time 0
periods 128
rate 48000
channels 6
}
bindings {
0 0
1 1
2 2
3 3
4 4
5 5
}
}

#ctl.defaultAAC {
# type hw
# card 0
#}
#
#ctl.onboard {
# type hw
# card 0
#}

ctl.gt220 {
type hw
card 1
}
#pcm.!hdmi {
# @args [ AES0 AES1 AES2 AES3 ]
# @args.AES0 {
# type integer
# # consumer, not-copyright, emphasis-none, mode=0
# default 0x04
# }
# @args.AES1 {
# type integer
# # original, PCM coder
# default 0x82
# }
# @args.AES2 {
# type integer
# # source and channel
# default 0x00
# }
# @args.AES3 {
# type integer
# # fs=48000Hz, clock accuracy=1000ppm
# default 0x02
# }
# type hooks
# slave.pcm {
# type hw
# card 1
# device 7
# }
# hooks.0 {
# type ctl_elems
# hook_args [
# {
# name "IEC958 Playback Default"
# lock true
# preserve true
# value [ $AES0 $AES1 $AES2 $AES3 ]
# }
# {
# name "IEC958 Playback Switch"
# lock true
# preserve true
# value true
# }
# ]
# }
#}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: