Next Previous Contents

## 7. Configuring Sound.

If your video doesn't appear to be in-sync with your audio and you're using an analog video capture card and a soundcard to capture audio, it could be because you are listening to the real-time audio from your video card rather than after it's been processed and synchronized to the video by MythTV. Because MythTV is a personal video recorder, "Live TV" isn't really live - to let you pause live TV, MythTV is actually encoding the video, saving to disk, and then playing it back. This procedure puts your MythTV "live" TV about 2 seconds behind real-time, so it's important that you're not listening to the live audio. However, if you're having an issue where the audio and video aren't synchronized by small but varying amount, it's most likely because the sound driver that you're using doesn't have the DSP_CAP_REALTIME capability. This was the case with ALSA (0.5), but not with newer versions. See the Troubleshooting Audio section for more information if you're having issues with sound. Also, ensure that no other programs are grabbing the audio output, like arts or esd.

What you need to do is to mute the "line-in" of your sound card and also set it as the recording source.

There are two ways to do this. Graphically, and from the command line.

## 7.1 Graphically setting up the mixer

### Mandriva and Red Hat Linux/Fedora Core

Open Kmix by clicking K->Multimedia->Sound->Kmix for Mandriva, or

    RedHat Menu>Sound & Video>Volume Control

on Red Hat/Fedora.

Click on Settings->Configure Make sure that "Tick Marks" and "Show labels" have "X"'s in them. This will make it easier to find the correct audio source. Click OK.

On the mixer page, look for Line-In on your sound card. You should see two LED's - a green one at the top, and a red one at the bottom. The green one at the top is for muting; you want to make sure that the green LED is a dark green, meaning that it's "off". You also want to click on the red LED so that it turns bright red, indicating that it's "ON"; this insures that the Line-in is used as the source. Click OK, and make sure that you save the settings so that this is your default.

### Using ALSA.

To use ALSA, you'll need to correctly setup your `asoundrc` file. Configuring this file is beyond the scope of this HOWTO. Once ALSA is working correctly, change the output sound device in mythfrontend->setup->Audio from `/dev/dsp` to `ALSA:default`. This field may be edited to suit your ALSA requirements.

## 7.2 Setting the mixer from the command line

If you have installed the alsa-utils package, then the amixer program can be used to setup the mixer. The "Master" volume setting is only required on a frontend machine to ensure that the sound channels are unmuted and configured for outputting sound. The "Line" and "Capture" controls are required for your sound card to actually capture audio from the external Line-in if it's connected to an analog frame grabber. Not all sound cards have a "Capture" control, but if yours does and you don't set it then MythTV will not capture audio.

    Note the spelling in the following commands.

> `

>     $ amixer set Master,0 100%,100% unmute
>     $ amixer set PCM,0 100%,100% unmute
>     $ amixer set Line,0 75%,75% mute captur
>     $ amixer set Capture,0 100%,100% captur
>     $ su
>     # alsactl store
>     # exit
>     $

> `

If you have multiple sound cards, then use the `-c` parameter to specify which card to adjust. Note that the first card will be "0", the second will be "1", etc.

That takes care of setting the volume correctly, and the ALSA startup script will restore the volume after a reboot. If you find that your sound is distorted, it's possible that the levels in the above examples are too high for your particular hardware combination. Try reducing the percentages by 5-10% and checking again. Once you're satisfied, re-run the `alsactl store` command.

You may also use the alsamixer program to set the volume. If you are using an ALSA version after 1.0.6, use alsamixer -V all First, start alsamixer from the command line. You should start out on the "Master" volume control slider. Use the up and down cursor to set the master volume to around 75%. Next, use the left and right cursor keys to move around on the screen until you find the "Line" slider. Press SPACE to set it as the capture source, set the level to around 50-75% and press "M" to mute it. You can now press ESC to exit out of the alsamixer program. You can also have MythTV manage all volume and mute settings, but this will only affect the "Master" or PCM volume, not the capture volume. See the mythfrontend setup page for options.

Finally, if you've performed all of the above steps, and you still don't seem to have any sound, it's possible that your video capture device is muting the audio output.

> `

>     $ v4lctl -c /dev/video0 setattr mute off

> `

Next Previous Contents