Tuesday, January 29, 2008

MythTV and USB Audio Problem [Resolved]

So, I have been struggling for months to get MythTV to play all my videos and audio correctly!! and i Finally got it figured out this evening ! Hurrah!

I was getting the following error message:

AudioOutput Error: Rate doesn't match (requested 44100Hz, got 48000Hz)

My current setup consists of the follow 2 sound cards:

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SI7012 [SiS SI7012], device 0: Intel ICH [SiS SI7012]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: UA1D [EDIROL UA-1D], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

The second of which is a USB Audio device with only SPDIF in and outputs. I want all my audio to go through this SPDIF interface and into my Surround Sound AMP. Sadly, The above error was preventing most of my media to play correctly through mythtv... especially when it came to music.

This error message appears becasue mythtv tries to set the spdif interfaces to 44100khz when spdif only supports 48000khz audio modes.

The following .asoundrc in my mythtv frontend users account ~mythtv/.asoundrc solved the problem once and for all.

pcm.!default {
type plug slave {
pcm "hw:1,0"
rate 48000
format S16_LE

So simple huh. This basically sets the default soundcard to be second (in this case USB) card and then informs ALSA to set re-sample all input to 48000khz in 16bit Little Endian format.

Then I simply set the sound devices in mythtv and mythmusic to use ALSA:default to seal the deal.

You might need to change the above to your specific hardware numbers. If so, don't forget to use the card number show in aplay -l (number start from 0).

1 comment:

Bill said...

Thanks for the write up. Your solution fixed the popping and crackling when using MythTV or mplayer. I had to change the rate setting to 44100.

I'm using a Samsung SyncMaster 225UW LCD monitor which has built in USB speakers and microphone. The alsa driver only appears to provide basic PCM output and it doesn't allow access to the microphone.

This is with Ubuntu 8.04 which contains alsa 1.0.16.

Bill Farrow