PCI TV audio

From MythTV Official Wiki
Jump to: navigation, search

If your analog TV capture card doesn't support a physical connection to the soundcard, (either through an internal connector or an external jack), or if you just don't want to use that connection, most cards supported by v4l2 allow you read the audio directly from the card using the ALSA sound system.

This may improve your sound quality. Your computer may cause interference with your analog sound card's line input. But getting your audio directly from the card over the PCI bus means the audio is sent in digital form thus avoiding the interference.

Also if you only have one sound card but more than one TV capture card, then you can connect only one capture card to your single audio card. Instead of buying a second sound card, try using the technique described here to get your audio directly from the capture card over PCI.


The following kernel modules support capturing digitized audio directly from the bttv based cards.

If you are unsure of which one to use, you probably want the ALSA driver. ALSA in the Advanced Linux Sound Architecture and is the default sound subsystem for Linux, starting with version 2.6.0. ALSA also supports OSS emulation for those applications that require it.


For all saa7134 cards, you can load saa7134-alsa (from kernel 2.6.15 on), and it'll give you a sound device you can use with Myth. The number of the device can be found at /proc/asound/cards, for example:

# cat /proc/asound/cards
 0 [IXP            ]: ATIIXP - ATI IXP
                      ATI IXP rev 1 with AD1888 at 0xfe800000, irq 18
 1 [SAA7134        ]: SAA7134 - SAA7134
                      saa7133[0] at 0xfdf00000 irq 18

here, the SAA7134 took device 1. You can use /dev/dsp1 as the audio device for this capture card, and it should just work. If it doesn't, try fiddling with it's controls by running alsamixer -c 1 (or the number your card got). Pushing all volume knobs to the max and setting "Capture" on all of them usually helps. For saa7134, the audiorate must be set to 32000.


For most cx88xx cards, the cx88-alsa module does the same as saa7134-alsa. Some (cheaper) cx88 cards don't support PCI audio, though... Again:

# cat /proc/asound/cards
 0 [SI7012         ]: ICH - SiS SI7012
                      SiS SI7012 with ALC655 at 0xf400, irq 20
 1 [CX8811         ]: CX88x - Conexant CX8811
                      Conexant CX8811 at 0xfa000000

You should get a card at /proc/asound/cards after loading cx88-alsa. If you don't, you probably have a card that doesn't support PCI audio, and will have to use a cable. If you do, set /dev/dspX in the capture card's configuration as the audio device. For cx88, the audiorate must be set to 48000.

CX88 with HD-3000 / HD-5500

While the HD-3000 / HD-5500 are used to capture MPEG streams with the ATSC / QAM tuner, there is also an analog tuner on the card as well. Both HD-3000 and HD-5500 are capable of passing sound from the analog tuner over the PCI bus, saving a precious line-in jack on a sound card.

The problem is that many cards were shipped with DMA sound turned off in the prom. To check if this is the case for your card, run lspci from a command prompt. Take note of the portion of the output that is in square brackets - you're looking for [Audio Port] like in the sample below:

Multimedia controller: Conexant CX23880/1/2/3 PCI Video and Audio Decoder [Audio Port] (rev 05)

If you see this, then you have working DMA Sound and can skip the next paragraph...

Luckily, a very kind fellow named xyzzy on a PCHDTV forum wrote a program to toggle this capability in the prom for HD3000 cards that don't have it turned on. The forum thread is here. He was kind enough to post a link to his program, cx88_eeprom from within the thread. Note this program uses the module i2c-dev so it will need to be loaded before the program can read/write to the prom. Trent (program author) has kindly put some instructions in the program if it is run without any arguments. Just read and do...

One problem though, there is a kernel bug that creates a race condition when the channel is changed (or when the card is switched from Digital to Analog capture inputs). This results in no sound and some other strange picture behaviors. Again though, a kind soul, nybbler from the same forum has posted some diff's [1] and [2]. These are a bit out of date now, so you may have to manually review the files and apply the changes in the kernel source. I did this with and it worked perfectly for me.

So, to review:

  1. Build new kernel with diff's listed above
  2. Download cx88_eeprom - run it for good instructions on how to proceed - summary:
    • modprobe i2c-dev
    • Discover which device is the cx88
    • cx88_eeprom device - follow instructions to toggle audio on
  3. Shutdown and power cycle (yes, actually turn the machine off)
  4. Ensure cx88-alsa is loaded - make sure new /dev/dspX device is present
  5. mythtv-setup - use new sound device /dev/dspX for sound under analog settings for DVB device
  6. Get a bag of chips, go to the couch, sit, watch!

Hope I didn't forget anything - feel free to edit if I have left anything out or gotten anything wrong here...

EM28xx and other USB adapters

For most USB adapters, the snd-usb-audio can be loaded and used in the same way as the previously mentioned cards.

Driver Configuration

For all the supported cards, it's advisable to take care so that the capture card doesn't become the primary sound card in the system (i.e., card 0). If it does, most applications (including MythTV) will try to use it as a playout card, and it won't work. Adding this to /etc/modprobe.conf is enough to solve this:

alias snd-card-1 ''modulename''
options snd-card-1 index=1

For example, for cx88-alsa

alias snd-card-1 cx88-alsa
options snd-card-1 index=1

To automate the loading of the modules, you can also use /etc/modprobe.conf. For example, for saa7134, add this line:

install saa7134 /sbin/modprobe --first-time --ignore-install saa7134 && /sbin/modprobe saa7134-alsa

MythTV Configuration

For each capture card, you need to specify a device for audio capture. Specify it in mythtv-setup->Capture cards->V4L->Audio Device.

Mythtv supports either OSS audio capture or ALSA capture. ALSA is recommended.

To use ALSA, set Audio Device to the new audio device. For example, if the card index specified is index=1, set it to ALSA:plughw:1,0.

To use OSS, soundcard devices will appear as /dev/dsp0, /dev/dsp1 etc. based on the card index specified. For example, if index=1, then you would specify /dev/dsp1. Some Linux Kernel versions may not have files like /dev/dsp0, /dev/dsp1 etc. If so, then use the alsa-oss compatibility layer.