如何在Ubuntu下混音

博客主要针对Linux初学者遇到的同时打开两个应用程序无法听到声音的问题进行解答。指出是声卡需要“软混音”,ALSA可提供该功能。详细介绍了解决步骤,包括安装软件包、创建配置文件、修改设置等,还提及了特定浏览器无声问题的解决办法。

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.
大多数Linux初学者都遇到这样一个问题:“为什么我在同时打开两个应用程序时不能听到声音呢?”这是因为你的声卡需要“软混音”。值得庆幸的是,ALSA提供了这项功能,这使得解决这个问题并不是很难。

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.
首先需要安装libesd-alsa0,用Synaptic或sudo apt-get install等方式都可以进行安装,它就在Ubuntu官方软件库中。

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.)
然后,用sudo gedit或您喜欢的文本编辑器创建文件/etc/asound.conf(请确定您使用了sudo,因为您需要root权限)

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:
接下来,运行"sudo gedit /etc/esound/esd.conf",将文件改成下面的内容:

[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.
然后打开您的Gnome声音控制面板并启用声音服务器,接着到多媒体系统选择控制面板,将其设成ALSA或ESD,并重启计算机。

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...
接下来您就可以将应用程序设成使用ALSA或ESD,这样您就可以一次听到多个声音了。就算是玩着用ALSA发音的游戏并听到使用ESD的GNOME应用发出的声音也没有任何问题!

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
有些朋友在hoary上按照上述的方法设置却遇到了问题,他们不能在mozilla/firefox/epiphany程序中听到声音,结果我发现在启动firefox时,程序查找libesd.so.1而系统却只有libesd.so.0,所以只要运行命令“sudo ln -s /usr/lib/libesd.so.0 /usr/lib/libesd.so.1”后就可以解决这个问题了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值