spdif ALSA sound inside KDE 3.4 using kernel 2.6.14

If you run a Linux desktop with linux kernel 2.6.14 or higher, things have become more easy, as the OSS-Emulation features have improved significantly, giving oldfashioned audio applications like macromedia flash 9 a new life. Newcomers into Linux audio programming are welcomed with a jump start. Start dusting off your oss sound programming manuals.

Below is an updated and simplified method to get ac3, DTS and Dolby surround sound going inside your KDE Linux Desktop, using the new OSS-Emulation inside Linux kernel 2.6.14 or higher, for older audio applications and mono audio files.

1. make sure you run Linux kernel 2.4.14 or higher where the ALSA
   driver should be configured like this :
ALSA Kernel driver configuration using 'make menuconfig'
  Make sure all items called OSS are selected as linux kernel 2.6.14
  and higher have a pretty decent OSS-Emulation. You might want to
  run this at home when booting your KDE/Linux workstation :

  echo 1024 > /proc/sys/dev/rtc/max-user-freq

2. Nex fire up your KDE Desktop and configure your sound system
   like this :
KDE Sound System Configuration using ALSA
  Note that the 'Override device location' box/form is not used anymore.

3. Remove your .xine files from your home directory $HOME. Better make
   a copy just in case first. Next Fire Up Xine which will write
   a new fresh vanilla standard config template inside $HOME/.xine/config .
   Select "Advanced"  Experience level inside Settings => Setup.
   Close xine, and make manual adjustments to $HOME/.xine/config to
   tweak to your needs. I only adjusted this :

        [jackson:stock]:(~/.xine)$ cat config | grep -v "^#" | sed '/^$/d' 
        audio.speaker_arrangement:Pass Through

   The only real difference is that now plug:dmix is used in case
   ALSA is feeded with mono sound, like online Internet streaming
   radio. The quality of plug:dmix has improved dramaticly inside 
   the newer ALSA Linux kernel drivers.

        # device used for mono output
        # string, default: default

   You can activate the dmix plugin for all audio applications
   inside KDE, not only amarok or xine, by using a simple .asoundrc
   file in your home ( $HOME ) directory :

	[jackson:stock]:(~)$ cat .asoundrc
	pcm.dsp {      type plug      slave.pcm "dmix" }

4. Start amarok , rightclick your mouse , and select "Configure Amarok".
   Select the Engine icon/button on the left. Select <no engine>
   and click "Apply" and shutdown amarok. Fire amarok up again and
   now go back from <no engine> to "xine Engine", where you
   will see the plug:mdix device see showup for mono output :
Amarok Setup for mono output using ac3/DTS/Dolby Digital audio hardware
   Please be take notice that Amarok 1st tries to copy the xine config
   from inside $HOME/.kaffeine/config. If that one doesn't exist then
   it will adapt the settings from $HOME/.xine/config :


        path  = QFile::exists( path.arg( "kaffeine" ) )
                       ? path.arg( "kaffeine" ) : path.arg( "xine" );

5. Install all these old fashioned oss sound system only applications,
   like flashplayer 9, realplayer 10, and enjoy as snd_pcm_oss and
   snd_mixer_oss finally work like expected. I could not hear anything
   that OSS is actually embedded as a Emulation inside ALSA.
   Hat's off and kudos to the kernel programmers for this.
   Here's what is loaded as modules :

        [jackson:stock]:(~)$ /sbin/lsmod | grep snd 
	snd_pcm_oss            51616  0 
        snd_mixer_oss          16640  1 snd_pcm_oss
        snd_intel8x0           34208  2 
        snd_ac97_codec        105304  1 snd_intel8x0
        snd_ac97_bus            2944  1 snd_ac97_codec
        snd_pcm                88584  4 snd_pcm_oss,snd_intel8x0,
        snd_timer              23048  2 snd_pcm
        snd                    55688  8 snd_pcm_oss,snd_mixer_oss,
        soundcore               9504  1 snd
        snd_page_alloc          9744  2 snd_intel8x0,snd_pcm

   Here's what's inside my /etc/modprobe.conf :

        alias sound-slot-0 snd-intel8x0
        remove snd-intel8x0 /sbin/modprobe -r snd-pcm-oss; /sbin/modprobe \
	  --first-time -r --ignore-remove snd-intel8x0
        install snd-intel8x0 /sbin/modprobe --first-time --ignore-install \
	   snd-intel8x0 && { /sbin/modprobe snd-pcm-oss; /bin/true; }
        remove i810_audio /sbin/modprobe --first-time -r --ignore-removei810_audio
        install i810_audio /sbin/modprobe --first-time --ignore-install i810_audio

Robert M. Stockmann
Last changed Tue Feb 26 23:24:28 CET 2008

[1] Programming Linux Games
by Loki Software Inc, John R. Hall

Paperback: 415 pages
Publisher: No Starch Press; 1 edition (August 2001)
Language: English
ISBN-10: 1886411492
ISBN-13: 978-1886411494