alsa
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| alsa [2006/12/10 18:06] – 221.223.180.243 | alsa [2008/04/18 08:24] (current) – old revision restored 195.35.72.54 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Mixed Sound with ARTS and ALSA ====== | ||
| + | This is how I set up my desktop system to play sounds from various applications simultanously. Namely these applications are XMMS, GAIM, MPlayer and Firefox (with Flashplugin). All working on my Intel onboard soundcard: | ||
| + | |||
| + | From ''/ | ||
| + | |||
| + | Bus 0, device | ||
| + | Multimedia audio controller: Intel Corp. 82801DB (ICH4) AC'97 Audio Controller (rev 2). | ||
| + | IRQ 9. | ||
| + | I/O at 0xa800 [0xa8ff]. | ||
| + | I/O at 0xa400 [0xa43f]. | ||
| + | Non-prefetchable 32 bit memory at 0xe4000000 [0xe40001ff]. | ||
| + | Non-prefetchable 32 bit memory at 0xe3800000 [0xe38000ff]. | ||
| + | |||
| + | |||
| + | |||
| + | ===== Kernel ===== | ||
| + | |||
| + | I use the new [[Kernel2.6|2.6 Kernel]] on my Desktop System which comes with Alsa. Compiling is straight forward here are the options I used for the soundcard (only selected ones shown): | ||
| + | |||
| + | Device Drivers | ||
| + | Sound ---> | ||
| + | <*> Sound card support | ||
| + | Advanced Linux Sound Architecture | ||
| + | <M> Advanced Linux Sound Architecture | ||
| + | <M> Sequencer support | ||
| + | < | ||
| + | <M> OSS Mixer API | ||
| + | <M> OSS PCM (digital audio) API | ||
| + | [*] OSS Sequencer API | ||
| + | <M> RTC Timer support | ||
| + | Generic devices | ||
| + | < | ||
| + | < | ||
| + | PCI devices | ||
| + | < | ||
| + | |||
| + | I load the modules in my ''/ | ||
| + | |||
| + | < | ||
| + | snd-intel8x0 | ||
| + | snd-pcm-oss | ||
| + | snd-seq-oss | ||
| + | </ | ||
| + | |||
| + | ===== .asoundrc ===== | ||
| + | |||
| + | For using alsa you should install some tools, too. | ||
| + | |||
| + | #> apt-get install alsa-utils alsa-oss | ||
| + | |||
| + | 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. Do this you'll need to set up an '' | ||
| + | |||
| + | This is what my .asoundrc looks like: | ||
| + | |||
| + | < | ||
| + | #asym fun start here. we define one pcm device called " | ||
| + | pcm.dmixed { | ||
| + | ipc_key 1025 | ||
| + | type dmix | ||
| + | slave { | ||
| + | pcm " | ||
| + | period_time 0 | ||
| + | period_size 1024 | ||
| + | buffer_size 8192 | ||
| + | rate 48000 | ||
| + | } | ||
| + | } | ||
| + | |||
| + | #one called " | ||
| + | pcm.dsnooped { | ||
| + | ipc_key 1026 | ||
| + | type dsnoop | ||
| + | slave.pcm " | ||
| + | } | ||
| + | |||
| + | #and this is the real magic | ||
| + | pcm.asymed { | ||
| + | type asym | ||
| + | playback.pcm " | ||
| + | capture.pcm " | ||
| + | } | ||
| + | |||
| + | #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 " | ||
| + | } | ||
| + | |||
| + | #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 " | ||
| + | } | ||
| + | |||
| + | ctl.mixer0 { | ||
| + | type hw | ||
| + | card 0 | ||
| + | } | ||
| + | |||
| + | #this sets the default device | ||
| + | pcm.!default { | ||
| + | type plug | ||
| + | slave.pcm " | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | It's pretty much the same as decribed in the given link. However I did not work very reliable for me. XMMS with using the ALSA output plugin did play a half song fine but then suddenly stopped playing without reason. Another problem was getting applications to work with it which doesn' | ||
| + | |||
| + | ===== ARTS ===== | ||
| + | |||
| + | The solution to the above mentioned problems is to use a sound daemon. the only one I found working as expected is ARTS. | ||
| + | |||
| + | #> apt-get install arts | ||
| + | |||
| + | To give it the needed permission for realtime scheduling make it's startwrapper SUID root: | ||
| + | |||
| + | #> dpkg-statoverride --add --update root root 4755 / | ||
| + | |||
| + | Arts needs to be started on login. Either do it from your '' | ||
| + | |||
| + | $> mkdir -p ~/ | ||
| + | $> ln -s / | ||
| + | |||
| + | ===== Application Setup ===== | ||
| + | |||
| + | ==== Firefox ==== | ||
| + | |||
| + | To make firefox use the ARTS daemon we use a library wrapper similar to the above mentioned '' | ||
| + | |||
| + | $> artsdsp ./firefox | ||
| + | |||
| + | To be sure it works install the Flash Plugin and try my silly animation at http:// | ||
| + | |||
| + | Note: If you're using a debian package of Firefox you can set the soundwrapper in ''/ | ||
| + | |||
| + | # which /dev/dsp wrapper to use | ||
| + | FIREFOX_DSP=" | ||
| + | |||
| + | ==== XMMS ==== | ||
| + | |||
| + | Easy - just install the plugin: | ||
| + | |||
| + | #> apt-get install xmms-arts | ||
| + | |||
| + | ==== GAIM ==== | ||
| + | |||
| + | More easy - go to the preferences and select '' | ||
| + | |||
| + | |||
| + | ==== MPlayer ==== | ||
| + | |||
| + | Well the [[http:// | ||
| + | |||
| + | Available audio output drivers: | ||
| + | mpegpes Mpeg-PES audio output | ||
| + | oss OSS/ | ||
| + | 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 '' | ||
| + | |||
| + | Just add this to the '' | ||
| + | |||
| + | < | ||
| + | ao=alsa9: | ||
| + | srate=48000 | ||
| + | </ | ||
