PDA

View Full Version : Playing two sound files simultaneously



Pratik
23rd July 2004, 07:44 PM
Hi !

I am a newbie to Linux. I am using Xfce4 as my desktop manager. I want to play two sound files simultaneously. I am listening to some mp3 file. And when I try to play some wave file from shell, using "playwave <filename>", I get the following error.

$ playwave ~/Misc/Mail01.wav
ALSA lib pcm_hw.c:1056:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
ALSA lib pcm_hw.c:1056:(snd_pcm_hw_open) open /dev/snd/pcmC0D0p failed: Device or resource busy
Couldn't open audio: No available audio device

I am not running artsd or esd daemon. Actually, I am writing a perl scipt that would notify me on arrival of new message in my inbox.

Please help.

-Pratik

deuch
23rd July 2004, 08:37 PM
try this add a file named .asoundrc in your home directory
http://alsa.opensrc.org/index.php?page=DmixPlugin
http://www.alsa-project.org/alsa-doc/doc-php/asoundrc.php

the .asoundrc contain something like that :

pcm.!default {
type plug
slave.pcm "dmixer"
}


pcm.dmixer {
type dmix
ipc_key 1024
slave {
pcm "hw:1,0"
period_time 0
period_size 1024
buffer_size 4096
rate 44100
}
bindings {
0 0
1 1
}
}

ctl.dmixer {
type hw
card 0
}


Nom play a file with : aplay -D plug:dmix some.wav & and a another at the same time ...

you can also use alsaplayer :

alsaplayer -o alsa -d plug:dmix some.mp3 &

You can configure your software to use alsa and normally if you use default ouput (now the dmix plugin :) ) all will be ok ....

hope it helps,

deuch

superbnerd
23rd July 2004, 08:48 PM
unless your sound card suppurts hardwere acceleration you ought to use one of those deamon. if it is a high quality sound card then you just need to find out how to config ure the drivers to enable the hardware acceleration.

deuch
23rd July 2004, 09:48 PM
More details here : http://fedoranews.org/contributors/andre_costa/alsa/

deuch