Welcome to the new location of Alien's Wiki, sharing a single dokuwiki install with the SlackDocs Wiki.

Welcome to Eric Hameleers (Alien BOB)'s Wiki pages.

If you want to support my work, please consider a small donation:

no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Last revision
slackware:alsa [2006/03/18 22:21] – created alien
Line 1: Line 1:
 +====== Mixed Sound with ARTS and ALSA ======
 +
 +A small HOWTO found at http://wiki.splitbrain.org/alsa and which I edited according to my own views. It explains to configure your system to play sounds from various applications simultanously. Think of applications like XMMS, GAIM, MPlayer and Firefox (with Flashplugin).
 +
 +ALSA comes with a method to mix multiple sound streams which is called //dmix//. ALSA-enabled applications should be able to all access the device at the same time when it is set up. To do this you'll need to set up either a system-wide ''/etc/asound.conf'' or a ''~/.asoundrc'' file in your home directory.
 +
 +
 +===== /etc/asound.conf (1st version) =====
 +
 +Here is an example ''/etc/asound.conf'' which I took from http://alsa.opensrc.org/index.php?page=Dmix+Kde+-+arts%2C+ESD+and+SDL+quick+and+dirty+HOWTO . It works for me, but you might also want to have a look at the rest of this page.
 +
 +<file>
 +pcm.ossmix {
 +    type dmix
 +    ipc_key 1027       # must be unique!
 +    slave {
 +        pcm "hw:0,0"   # you cannot use a "plug"
 +                       # device here, darn.
 +        period_time 0
 + period_size 1024
 + buffer_size 4096
 +        #format "S32_LE"
 +        #periods 128   # dito.
 +        rate 44100     # with rate 8000 you *will* 
 +                       # hear, if ossmix is used :)
 +    }
 +    bindings {
 +        0 0            # from 0 => to 0
 +        1 1            # from 1 => to 1
 +    }
 +}
 +pcm.!default {
 +    type plug
 +    slave.pcm "ossmix"
 +}
 +# mixer0 like above
 +ctl.mixer0 {
 +    type hw
 +    card 0
 +}
 +</file>
 +
 +
 +===== /etc/asound.conf (2nd version) =====
 +
 +The instructions at http://alsa.opensrc.org/index.php?page=asym are the source of what follows on the rest of this page. If the above does not work for you, you might want to take a look at the story below.
 +
 +This is what ''/etc/asound.conf'' could look like also:
 +
 +<file>
 +#asym fun start here. we define one pcm device called "dmixed"
 +pcm.dmixed {
 +    ipc_key 1025
 +    type dmix
 +    slave {
 +        pcm "hw:0,0"
 +        period_time 0
 +        period_size 1024
 +        buffer_size 8192
 +        rate 48000
 +    }
 +}
 +
 +#one called "dsnooped" for capturing
 +pcm.dsnooped {
 +    ipc_key 1026
 +    type dsnoop
 +    slave.pcm "hw:0,0"
 +}
 +
 +#and this is the real magic
 +pcm.asymed {
 +    type asym
 +    playback.pcm "dmixed"
 +    capture.pcm "dsnooped"
 +}
 +
 +#a quick plug plugin for above device to do the converting magic. saves
 +#typing when settng the pcm name in an alsa app
 +pcm.pasymed {
 +    type plug
 +    slave.pcm "asymed"
 +}
 +
 +#a ctl device to keep xmms happy
 +ctl.pasymed {
 +    type hw
 +    card 0
 +}
 +
 +#here we try to point the aoss script to our asymed device
 +pcm.dsp0 {
 +    type plug
 +    slave.pcm "asymed"
 +}
 +
 +ctl.mixer0 {
 +    type hw
 +    card 0
 +}
 +
 +#this sets the default device
 +pcm.!default {
 +    type plug
 +    slave.pcm "asymed"
 +}
 +</file>
 +
 +It's pretty much the same as decribed in the given link. However, a problem is to get applications to work with it that do not support ALSA.
 +
 +
 +===== ARTS =====
 +
 +The solution to the above mentioned problems is to use a sound daemon, like KDE's ARTS.
 +
 +Arts needs to be started on login. You can do that for instance from your ''~/.xsession'' file. Just add the following line before your the where your windowmanager gets started:
 +
 +<code>/opt/kde/bin/artsd -b 16 -r 48000 -a alsa -D asymed &</code>
 +
 +
 +===== Application Setup =====
 +
 +==== Firefox ====
 +
 +To make firefox use the ARTS daemon we use a library wrapper called ''artsdsp'' - so for running Firefox with ARTS just run the following command:
 +
 +<code>artsdsp firefox</code>
 +
 +To be sure it works install the Flash Plugin and try any Flash animation - like this [[http://sox.homeip.net/lick.html|cute kitten]]. If you don't hear sound then something is wrong.
 +
 +
 +==== XMMS ====
 +
 +For xmms, you need to select the //aRts-Output// as output plugin in your //Preferences//.
 +
 +
 +==== GAIM ====
 +
 +Also easy - in the //Sound// preferences tab, select //Automatic// as the //Sound Method//.
 +
 +
 +==== MPlayer ====
 +
 +The [[http://mplayerhq.hu/DOCS/HTML/en/devices.html#audio-dev|MPlayer documentation]] says there is an ''arts'' driver. Running <code>mplayer -ao help</code> shows something like this:
 +
 +  Available audio output drivers:
 + mpegpes Mpeg-PES audio output
 + oss OSS/ioctl audio output
 + alsa9 ALSA-0.9.x audio output
 + esd EsounD audio output
 + sdl SDLlib audio output
 + null Null audio output
 + pcm RAW PCM/WAVE file writer audio output
 + plugin Plugin audio output
 +
 +Now the dmix feature configured above comes in handy again. We just use the ''asymed'' device which is able to mix multiple sources. So it's possible to have both - ARTS with multiple Soundsources __and__ MPlayer - accessing the same ALSA device.
 +
 +Just add this to the ''~/.mplayer/config''
 +
 +<file>
 +  ao=alsa9:asymed            #or ao=alsa1x ...
 +  srate=48000
 +</file>
  
 Mixed Sound with ARTS and ALSA ()
SlackDocs