Difference between revisions of "Digital Audio Tutorial"
(→Set up ALSA for these settings) |
(→Special system specific things) |
||
Line 188: | Line 188: | ||
− | If you have problems test without myth | + | If you have problems test without myth. Here are some example test lines: |
− | mplayer -ao alsa:device=hw=0.3 -afm hwac3 /some/dolbydigital/audio/file.wav | + | $ mplayer -ao alsa:device=hw=0.3 -afm hwac3 /some/dolbydigital/audio/file.wav |
− | + | $ mplayer -ac hwac3 -ao alsa:device=iec958=1 -vo xv -fs /some/dolbydigital/audio/file.mpg | |
+ | $ aplay -Dplughw:0,1 file.wav | ||
+ | $ aplay -Dspdif file.wav | ||
+ | $ aplay -Diec958 file.wav | ||
+ | $ mplayer -cache 500 -cdrom-device /dev/cdrom cdda:// | ||
+ | |||
+ | The last line will play a CD from the drive. It will play if everything is set up correctly. Use these tests to determine if the problem is in the hardware, the config file, or the program. | ||
=== AGP and XvMC=== | === AGP and XvMC=== |
Revision as of 17:43, 14 February 2009
This is the new and simplified audio interface tutorial for digital sound with MythTV (Allen Edwards 2/11/2009)
Contents
Overview
The goal here is to set up myth to output the digital stream without doing anything with it. Myth passes this stream to ALSA where a new default configuration will cause that stream to pass to the sound card digital output also without modification. This will ensure that the fidelity of the digital stream is not changed by the computer and puts the burden of decoding, changing volume, determining speaker setup, etc on the sound processor preamp.
Update your system
Set up BIOS
If you have both HDMI and SPDIF outputs, you may need to make a selection in your BIOS
Update alsa
For HDMI you may need 1.0.18 or later. Straight spdif works with 1.0.16.
Check your version first by doing this:
$ cat /proc/asound/version
You can upgrade to the latest version in the depository by doing this:
$ sudo apt-get upgrade alsa
If that doesn't do it, you can upgrade your alsa configuration under mythbuntu 8.10 is with the script available in this thread.
http://ubuntuforums.org/showthread.php?p=6589810#post6589810
Download the script AlsaUpgrade-1.0.x-rev-1.16.tar extract the script from the tar file and execute it like so...
sudo ./AlsaUpgrade-1.0.x-rev-1.16.sh -di
It will take about 15 minutes to complete and afterwards everything works....
This will upgrade ALSA to version 1.0.19
Once you have your system upgraded, you should see the outputs listed in alsamixer that you want to use. You may have to configure your BIOS first. This is mainly for HDMI outputs. SPDIF has been supported for some time so it is unlikely that any new system would have a problem with spdif in this regard.
Update nvidia drivers
It has been suggested by some that you update the nvidia driver if you are using HDMI. Most have said this is not necessary. Upgrading broke one of my systems so you might do this only if needed. See AGP and XvMC note below.
Mythbuntu users can use envy and select install Nvidia driver.
$ envyng -t
You can check the version you have with this command
cat /proc/driver/nvidia/version
Enable desired iec958 output
Run alsamixer and enable iec958. Use the right arrow key to see it.
$ alsamixer
Remove .asoundrc
Remove or rename .asoundrc if it exists. It probably does not exist.
$ locate .asoundrc $
Notes
A note on these upgrades. It is good practice to upgrade your system if it is not working and to not upgrade it if it is working without problems.
Users have reported needing ALSA 1.0.18 and Nvidia 180.22 for HDMI on at least one MB. Others have reported HDMI working with Nvidia 177.xxx but ALSA 1.0.18 or later is necessary to get the HDMI output to show in alsamixer.
SPDIF works fine with versions at least several months older than these. I am running spdif with nvidia 173.14.12 and alsa 1.0.16
Set Myth up for digital sound
There are several ways to the same end on this but the method below is the most straight forward at this point.
Audio output device: ALSA:default Passthrough output device: ALSA:default Max Audio Channels: Stereo (MUST BE SET IN STEREO as of 2/10/2009 as there is a bug in surround) Upmix: Passive Enable AC3 to SPDIF passthrough checked Enable DTS to SPDIF passthrough checked Aggressive sound card buffering off Use internal volume controls off
Discover what settings your sound card wants
run aplay -l and look for an output like this:
$ aplay -l **** List of PLAYBACK Hardware Devices **** card 0: SB [HDA ATI SB], device 0: ALC883 Analog [ALC883 Analog] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SB [HDA ATI SB], device 1: ALC883 Digital [ALC883 Digital] Subdevices: 0/1 Subdevice #0: subdevice #0
If you have HDMI, you might see something like this:
Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
You need to find the digital output you want to use, Digital or HDMI and note the card and device numbers. In my case it is card 0 and device 1
Set up ALSA for these settings
Edit the ALSA config files using your favorite editor. For example:
$ sudo nano /etc/asound.conf
And edit it to match this:
pcm.!default { type hw card 0 device 1 }
Where you use the card and device numbers from the aplay -l step.
If you do not get sound out of your processor with the above setup, it could be because the processor is having an issue with the formatting. I tested the above on two processors and one worked, one did not. Adding a format line made it so both processors I tested with work. The format line says serial, 32 bit, least significant bit first.
pcm.!default { type plug slave { pcm "hw:0,1" format S32_LE } }
The following two plugins also worked in my system. These plugins do extensive formatting to insure the data meets the standard. I don't know if it is better to use them or not. For now I am using the above version as it works for all my programs (MythTV, MythMusic, Firefox) and both my processors.
pcm.!default { type plug slave.pcm "iec958" }
This also worked
pcm.!default { type plug slave.pcm "spdif" }
I am looking forward to having someone with an HDMI system tell me if either or both of these next two files work.
pcm.!default { type plug slave.pcm "hdmi" }
and the following where the iec958=1 corresponds to the desired output in alsamixer
pcm.!default { type plug slave.pcm "iec958=1" }
If you hear digital noise or what sounds like static from an old sci-fi movie, it is the digital spdif data stream being sent to the analog part of your sound card. Check your output aplay -l output again for the digital device.
Special system specific things
Troubleshooting
If you have problems test without myth. Here are some example test lines:
$ mplayer -ao alsa:device=hw=0.3 -afm hwac3 /some/dolbydigital/audio/file.wav $ mplayer -ac hwac3 -ao alsa:device=iec958=1 -vo xv -fs /some/dolbydigital/audio/file.mpg $ aplay -Dplughw:0,1 file.wav $ aplay -Dspdif file.wav $ aplay -Diec958 file.wav $ mplayer -cache 500 -cdrom-device /dev/cdrom cdda://
The last line will play a CD from the drive. It will play if everything is set up correctly. Use these tests to determine if the problem is in the hardware, the config file, or the program.
AGP and XvMC
Nvidia drivers for some time and up to at least 173.14.13 do not work with XvMC. The work around is to disable XvMC with this option:
Option "NvAGP" "0"
There is a discussion on it here: NVNEWS
m3n78-em
1st post: For the m3n78-em with the optical spdif connector on the MB the kernel module must be loaded with this option: options snd-hda-intel model=6stack-dig
2nd post: in MythBuntu i added the same line to /etc/modprobe.d/alsa-base, or, i should say, the script i ran to update my alsa drivers added it for me.
Fedora
If you are running Fedora, remove pulseaudio and all its files. There was a post that outlined the process but it is gone. A copy is here: RemovePulseAudio.