如何在Ubuntu下混音

简介:
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”后就可以解决这个问题了



本文转自 firehare 51CTO博客,原文链接:http://blog.51cto.com/firehare/588117,如需转载请自行联系原作者

相关文章
|
2月前
|
Kubernetes Ubuntu Linux
日常玩Ubuntu小记
日常玩Ubuntu小记
19 0
|
8月前
|
Linux
Ubuntu19.10 改源
Ubuntu19.10 改源
|
Ubuntu 应用服务中间件 Apache
Ubuntu 22.04
Ubuntu 22.04
298 0
|
Ubuntu
Ubuntu 20.04
Ubuntu 20.04
99 0
|
Ubuntu
ubuntu 20.04
ubuntu 20.04
75 0
|
域名解析 Ubuntu Unix
Ubuntu 使用小技巧
本文主要为大家介绍 Ubuntu Linux 在使用中的一些小技巧。
793 0
Ubuntu 使用小技巧
|
Ubuntu Unix Linux
Ubuntu小技巧
ubuntu linux使用的一些小技巧
1128 0