红联Linux门户
Linux帮助

Linux used to mixing

发布时间:2007-10-13 21:31:09来源:红联作者:hearer
This one seems to stump most linux newbies..."Why can't I hear sounds from two applications at once?" This is because your sound card requires something called "software mixing." Thankfully, ALSA provides software mixing, so this shouldn't be very hard.

The first thing to do is install the package libesd-alsa0. Use synaptic, a sudo apt-get install, or whatever. Its available in the Ubuntu repositories.

Then, create the following file using "sudo gedit" or your favorite text editor, and save it as /etc/asound.conf. (Make sure you use sudo, you need root priviledges to do this.)

pcm.card0 {
type hw
card 0
}

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

}

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

(the above file should work with most sound cards...I've tried it with 3 different ones with success. I can't guarantee it'll work in all cases, though.)

Next, execute a "sudo gedit /etc/esound/esd.conf" and change the file to the following:

[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_wait_ms=100
# default options are used in spawned and non-spawned mode
default_options=

Next, go to your Sound control panel in Gnome and enable sound server startup. After this, go to your Multimedia Systems Selector control panel and set it to either ALSA or ESD. Then, reboot your computer.

After doing this, you can set any application to use alsa or ESD, and you'll hear multiple sounds at once! No more problems playing games that use ALSA and hearing sounds from a Gnome app that uses ESD...

If someone has problem with no sound in mozilla/firefox/epiphany with this setup on hoary, I've found that firefox seeks for libesd.so.1 at startup while there is only libesd.so.0.
sudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1 should solve the problem.
文章评论

共有 2 条评论

  1. 奶茶dsk 于 2007-10-13 22:24:38发表:

    very good,it's the right way to slove this program.........
    :0L :0L

  2. gxf 于 2007-10-13 21:53:07发表:

    Here is for fedora user to solve this problem

    1.install alsa-oss(if you come up with the problem of one application just takes up the soundcard alone):

    code:
    sudo yum install alsa-oss

    2.modify ESD configuration file:

    code:

    sudo vim /etc/esd.conf

    modify as:

    [esd]
    auto_spawn=1
    spawn_options=-terminate -nobeeps -as 2 -d default #modify here
    spawn_wait_ms=100
    # default options are used in spawned and non-spawned mode
    default_options=

    [ 本帖最后由 gxf 于 2007-10-13 22:27 编辑 ]