个人工具

“UbuntuHelp:EnableSoftwareMixing”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
(新页面: {{From|https://help.ubuntu.com/community/EnableSoftwareMixing}} {{Languages|UbuntuHelp:EnableSoftwareMixing}} == HOWTO: Hear multiple sounds using both esd and ALSA == (taken from http:/...)
 
第2行: 第2行:
 
{{Languages|UbuntuHelp:EnableSoftwareMixing}}
 
{{Languages|UbuntuHelp:EnableSoftwareMixing}}
 
== HOWTO: Hear multiple sounds using both esd and ALSA ==
 
== HOWTO: Hear multiple sounds using both esd and ALSA ==
 
 
(taken from http://www.ubuntuforums.org/printthread.php?t=32063&pp=40)
 
(taken from http://www.ubuntuforums.org/printthread.php?t=32063&pp=40)
 
 
These are the instructions on enabling software mixing, to avoid application problems like Audacity needing killall esd to work while another application is playing music.
 
These are the instructions on enabling software mixing, to avoid application problems like Audacity needing killall esd to work while another application is playing music.
 
 
(1) libesd-alsa0 should be installed (it already is in dapper)
 
(1) libesd-alsa0 should be installed (it already is in dapper)
 
 
(2) We need to create /etc/asound.conf, including the following lines:
 
(2) We need to create /etc/asound.conf, including the following lines:
 
<pre><nowiki>
 
<pre><nowiki>
第16行: 第12行:
 
# mmap_emulation true
 
# mmap_emulation true
 
}
 
}
 
 
#pcm.dmix0 {
 
#pcm.dmix0 {
 
#  type dmix  
 
#  type dmix  
第24行: 第19行:
 
#  }
 
#  }
 
#}
 
#}
 
 
pcm.dmix0 {
 
pcm.dmix0 {
 
type dmix
 
type dmix
第38行: 第32行:
 
#slowptr true
 
#slowptr true
 
}
 
}
 
 
pcm.dsnoop0 {
 
pcm.dsnoop0 {
 
type dsnoop  
 
type dsnoop  
第47行: 第40行:
 
}
 
}
 
}
 
}
 
 
pcm.asym0 {
 
pcm.asym0 {
 
type asym  
 
type asym  
第53行: 第45行:
 
capture.pcm "dsnoop0"
 
capture.pcm "dsnoop0"
 
}
 
}
 
 
pcm.pasym0 {
 
pcm.pasym0 {
 
type plug  
 
type plug  
 
slave.pcm "asym0"
 
slave.pcm "asym0"
 
}
 
}
 
 
# 'dsp0' is expected by OSS emulation etc.
 
# 'dsp0' is expected by OSS emulation etc.
 
pcm.dsp0 {
 
pcm.dsp0 {
第64行: 第54行:
 
slave.pcm            "asym0"
 
slave.pcm            "asym0"
 
}
 
}
 
 
ctl.dsp0 {
 
ctl.dsp0 {
 
type                hw
 
type                hw
 
card                0
 
card                0
 
}
 
}
 
 
pcm.!default {
 
pcm.!default {
 
type                  plug
 
type                  plug
 
slave.pcm            "asym0"
 
slave.pcm            "asym0"
 
}
 
}
 
 
ctl.!default {
 
ctl.!default {
 
type                hw
 
type                hw
第80行: 第67行:
 
}
 
}
 
</nowiki></pre>
 
</nowiki></pre>
 
 
(3) Also, we need to change /etc/esound/esd.conf contents so:
 
(3) Also, we need to change /etc/esound/esd.conf contents so:
 
<pre><nowiki>
 
<pre><nowiki>
 
[esd]
 
[esd]
 
 
auto_spawn=1
 
auto_spawn=1
 
 
spawn_options=-terminate -nobeeps -as 2 -d default
 
spawn_options=-terminate -nobeeps -as 2 -d default
 
 
spawn_wait_ms=100
 
spawn_wait_ms=100
 
 
# default options are used in spawned and non-spawned mode
 
# default options are used in spawned and non-spawned mode
 
 
default_options=
 
default_options=
 
</nowiki></pre>
 
</nowiki></pre>
 
 
(4) Now we need to change ubuntu sound server to alsa (we can leave it ESD but we better use alsa because it has better sound handling): "gstreamer-properties" -- Change both (in the Audio Tab not the Video) from ESD to ALSA.
 
(4) Now we need to change ubuntu sound server to alsa (we can leave it ESD but we better use alsa because it has better sound handling): "gstreamer-properties" -- Change both (in the Audio Tab not the Video) from ESD to ALSA.
 
 
(5) All that's left now is to restart computer (after restart you must hear sound) to enable these changes. Also configure XMMS or Beep-media-player (or any player) to use ALSA instead of eSound/ESD. If you hear a strange sound, just change everything back to ESD. If everything worked correctly, now Audacity & Skype will work normally and all the program will play sound using either Alsa or ESD.
 
(5) All that's left now is to restart computer (after restart you must hear sound) to enable these changes. Also configure XMMS or Beep-media-player (or any player) to use ALSA instead of eSound/ESD. If you hear a strange sound, just change everything back to ESD. If everything worked correctly, now Audacity & Skype will work normally and all the program will play sound using either Alsa or ESD.
 
 
 
=== Notes ===
 
=== Notes ===
 
 
* If you couldn't play any sounds using ALSA then your /etc/asound.cond & /etc/esound/esd.conf needs some more advanced tweaking (or your sound card just won't support it).
 
* If you couldn't play any sounds using ALSA then your /etc/asound.cond & /etc/esound/esd.conf needs some more advanced tweaking (or your sound card just won't support it).
 
 
* if realplayer still doesn't work after switching to alsa, this is because it is looking for /dev/dsp which is the oss device. Fortunately, alsa includes oss emulation. to enable it, just type "modprobe -v snd-pcm-oss"; this will create the /dev/dsp device, routed to alsa. Realplayer (and other oss only apps, no doubt) then works. If that works fine, then just add snd-pcm-oss to the file /etc/modules; it will be loaded automatically at boot.
 
* if realplayer still doesn't work after switching to alsa, this is because it is looking for /dev/dsp which is the oss device. Fortunately, alsa includes oss emulation. to enable it, just type "modprobe -v snd-pcm-oss"; this will create the /dev/dsp device, routed to alsa. Realplayer (and other oss only apps, no doubt) then works. If that works fine, then just add snd-pcm-oss to the file /etc/modules; it will be loaded automatically at boot.
 
 
* Also you might find sdl games no longer have sound here's a fix: SDL tries to use hw:0, and without intervention, it fails to open audio device. But SDL uses AUDIODEV environment variable, so it placed such file to /etc/profile.d/, example dmix_sdl.sh: "export AUDIODEV=default".
 
* Also you might find sdl games no longer have sound here's a fix: SDL tries to use hw:0, and without intervention, it fails to open audio device. But SDL uses AUDIODEV environment variable, so it placed such file to /etc/profile.d/, example dmix_sdl.sh: "export AUDIODEV=default".
 
 
Note that for sdl games you should have libsdl1.2debian-alsa installed. You could install the esd version but both will work and this way you can have sdl games work in another window manager where you might not be running esd. It defaulted to libsdl1.2debian-oss. Not sure exactly why that doesn't work when alsa has oss emulation.  
 
Note that for sdl games you should have libsdl1.2debian-alsa installed. You could install the esd version but both will work and this way you can have sdl games work in another window manager where you might not be running esd. It defaulted to libsdl1.2debian-oss. Not sure exactly why that doesn't work when alsa has oss emulation.  
 
 
* and finally mplayer can be modified within the gui (gmplayer) but mplayer alone won't read that. Here's my ~/.mplayer/config:
 
* and finally mplayer can be modified within the gui (gmplayer) but mplayer alone won't read that. Here's my ~/.mplayer/config:
 
<pre><nowiki>
 
<pre><nowiki>
第117行: 第89行:
 
</nowiki></pre>
 
</nowiki></pre>
 
The vo="xv" will set mplayer to use xv hardware overlay for video so most of you will want that as well if you haven't set it as such. I'm mainly use totem but it's nice to have mplayer working with this setup.
 
The vo="xv" will set mplayer to use xv hardware overlay for video so most of you will want that as well if you haven't set it as such. I'm mainly use totem but it's nice to have mplayer working with this setup.
 
 
And the gstreamer-properties test with this setup will work for both playback and recording.
 
And the gstreamer-properties test with this setup will work for both playback and recording.
 
 
 
=== Comments ===
 
=== Comments ===
 
 
NOW REALLY, can we not just purge oss completely from a distribution yet?
 
NOW REALLY, can we not just purge oss completely from a distribution yet?
 
 
----
 
----
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
 
[[category:CategoryDocumentation]] [[category:CategoryCleanup]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2007年11月30日 (五) 17:05的版本

HOWTO: Hear multiple sounds using both esd and ALSA

(taken from http://www.ubuntuforums.org/printthread.php?t=32063&pp=40) These are the instructions on enabling software mixing, to avoid application problems like Audacity needing killall esd to work while another application is playing music. (1) libesd-alsa0 should be installed (it already is in dapper) (2) We need to create /etc/asound.conf, including the following lines:

pcm.card0 {
type hw
card 0
# mmap_emulation true
}
#pcm.dmix0 {
#  type dmix 
#  ipc_key 34521 
#  slave {
#    pcm "card0" 
#  }
#}
pcm.dmix0 {
type dmix
ipc_key 1024 ## needs to be a power of 2
slave {
pcm "hw:0"
period_time 0
period_size 1024
buffer_size 8192
# format S16_LE
rate 44100 ## not necessary
}
#slowptr true
}
pcm.dsnoop0 {
type dsnoop 
ipc_key 2048
slave {
pcm "card0" 
#  rate 48000
}
}
pcm.asym0 {
type asym 
playback.pcm "dmix0" 
capture.pcm "dsnoop0"
}
pcm.pasym0 {
type plug 
slave.pcm "asym0"
}
# 'dsp0' is expected by OSS emulation etc.
pcm.dsp0 {
type                  plug
slave.pcm            "asym0"
}
ctl.dsp0 {
type                hw
card                0
}
pcm.!default {
type                  plug
slave.pcm            "asym0"
}
ctl.!default {
type                hw
card                0
}

(3) Also, we need to change /etc/esound/esd.conf contents so:

[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=

(4) Now we need to change ubuntu sound server to alsa (we can leave it ESD but we better use alsa because it has better sound handling): "gstreamer-properties" -- Change both (in the Audio Tab not the Video) from ESD to ALSA. (5) All that's left now is to restart computer (after restart you must hear sound) to enable these changes. Also configure XMMS or Beep-media-player (or any player) to use ALSA instead of eSound/ESD. If you hear a strange sound, just change everything back to ESD. If everything worked correctly, now Audacity & Skype will work normally and all the program will play sound using either Alsa or ESD.

Notes

  • If you couldn't play any sounds using ALSA then your /etc/asound.cond & /etc/esound/esd.conf needs some more advanced tweaking (or your sound card just won't support it).
  • if realplayer still doesn't work after switching to alsa, this is because it is looking for /dev/dsp which is the oss device. Fortunately, alsa includes oss emulation. to enable it, just type "modprobe -v snd-pcm-oss"; this will create the /dev/dsp device, routed to alsa. Realplayer (and other oss only apps, no doubt) then works. If that works fine, then just add snd-pcm-oss to the file /etc/modules; it will be loaded automatically at boot.
  • Also you might find sdl games no longer have sound here's a fix: SDL tries to use hw:0, and without intervention, it fails to open audio device. But SDL uses AUDIODEV environment variable, so it placed such file to /etc/profile.d/, example dmix_sdl.sh: "export AUDIODEV=default".

Note that for sdl games you should have libsdl1.2debian-alsa installed. You could install the esd version but both will work and this way you can have sdl games work in another window manager where you might not be running esd. It defaulted to libsdl1.2debian-oss. Not sure exactly why that doesn't work when alsa has oss emulation.

  • and finally mplayer can be modified within the gui (gmplayer) but mplayer alone won't read that. Here's my ~/.mplayer/config:
vo="xv"
ao="alsa:device=default"

The vo="xv" will set mplayer to use xv hardware overlay for video so most of you will want that as well if you haven't set it as such. I'm mainly use totem but it's nice to have mplayer working with this setup. And the gstreamer-properties test with this setup will work for both playback and recording.

Comments

NOW REALLY, can we not just purge oss completely from a distribution yet?