如何混音

参与到Ubuntu的翻译中来
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

如何混音

#1

帖子 oneleaf » 2005-04-07 15:21

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
上次由 oneleaf 在 2005-04-13 22:05,总共编辑 1 次。
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
Templar
帖子: 1
注册时间: 2005-04-07 16:23

#2

帖子 Templar » 2005-04-07 16:33

我能翻译么?
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#3

帖子 oneleaf » 2005-04-07 19:55

欢迎之极
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#4

帖子 firehare » 2005-04-12 12:50

翻译好了之后
只要贴上去就OK了吗?

如果翻得不好的话
是不是只要跟帖修改就可以了?
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#5

帖子 oneleaf » 2005-04-12 12:51

没错的,只要参与就好
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
头像
firehare
帖子: 2625
注册时间: 2005-04-10 16:54
来自: 温州大学
联系:

#6

帖子 firehare » 2005-04-12 15:22

水平有限,本来不敢来献丑,只是看到没人,所以就大致翻译一下,也让大家觉得他翻得这么差都敢放上来,我又有什么不敢放呢?希望这块砖能引来真正的美玉!

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 在 2005-05-04 0:15,总共编辑 1 次。
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#7

帖子 oneleaf » 2005-04-13 22:08

当净其意如虚空,远离妄想及诸取,令心所向皆无碍
soboy
帖子: 16
注册时间: 2005-04-13 21:25

#8

帖子 soboy » 2005-04-13 23:03

头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#9

帖子 oneleaf » 2005-04-13 23:06

这是我整理的,回在上面表示整理完成地址,呵呵,让大家误会了,不好意思
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
头像
stormelf
帖子: 21
注册时间: 2005-05-22 16:07
来自: 西电
联系:

重要提示

#10

帖子 stormelf » 2005-05-22 16:22

兄弟们,我好惨阿,按照本帖设置了混音,重试了N次都没有成功(intel8x0 ac97),郁闷到极点。
每次运行启动或运行与 alsa有关的命令,都会有如下类似的提示:

代码: 全选

ALSA lib conf.c:1566:(snd_config_load1) _toplevel_:22:2:Unexpected char ......
后来,一起之下把asound.conf给删了,#alsamixer竟然不报错了,在后来去网上随便搜了一个asound.conf,重启竟然混音搞定了. Great!
本来应该很高兴的,可是郁闷的事来了,我想看看究竟是那一句配置错了,比来比去,没什么差别,但是网上搜来的 .conf就可以运行,帖子上的就是不行!天哪“Unexpected char”,不会是有全角的空格吧! :cry: :cry: 于是把全角的空格替换了一下,搞定!估计yongyi兄弟的问题也是如此。大家一定注意阿!
版主不如把asound.conf中的文本修改一下吧,要不然有的兄弟又有的郁闷了!
头像
oneleaf
论坛管理员
帖子: 10441
注册时间: 2005-03-27 0:06
系统: Ubuntu 12.04

#11

帖子 oneleaf » 2005-05-22 16:28

已经修正,多谢提醒,更新链接:
http://www.ubuntu.org.cn/docs/littleval ... 208807065/
当净其意如虚空,远离妄想及诸取,令心所向皆无碍
yongyi
帖子: 3025
注册时间: 2005-05-07 23:57
联系:

#12

帖子 yongyi » 2005-05-22 16:48

哈哈,原来问题出在空格上!晕死啦!
怪不得上次我还是做了同样的步骤(代码不是从这里CP)却又可以。我都以为是之前做错了哪步呢。 :oops:
头像
millenniumdark
论坛版主
帖子: 4159
注册时间: 2005-07-02 14:41
系统: Ubuntu 14.04 (Kylin)
联系:

#13

帖子 millenniumdark » 2006-07-31 20:10

应该已经过时了
头像
haige
帖子: 315
注册时间: 2006-03-16 16:29

在哪打开Gnome声音控制面板

#14

帖子 haige » 2006-08-05 16:23

在哪打开Gnome声音控制面板,我找不到啊
baodl
帖子: 5
注册时间: 2006-08-14 12:31

Re: 在哪打开Gnome声音控制面板

#15

帖子 baodl » 2006-08-14 12:37

haige 写了:在哪打开Gnome声音控制面板,我找不到啊
刚开始我也是找不到,后来发现了
点击应用程序--附件--ALACARTE菜单编辑器--系统--下面有个“首选项”--右面有个“多媒体系统选择器“把它选上--确定--然后再点桌面工具栏的系统--首先项,就会看到那个多媒体系统选择器了,选择ALSA就可以了,重启。
回复