ALSA Software Mixing
Set up the dmix plugin with these config files:
~/.asoundrc:
# .asoundrc for use with ALSA and the dmix plugin, for ALSA-level # software mixing across all apps. # # http://alsa.opensrc.org/index.php?page=AlsaSharing # http://alsa.opensrc.org/index.php?page=DmixPlugin pcm.dmix0 { type dmix ipc_key 219345 # any unique number here slave { pcm "hw:0,0" period_time 0 buffer_time 0 period_size 2048 # jm: much smoother than 1024/8192! buffer_size 32768 rate 44100 } bindings { 0 0 # from 0 => to 0 1 1 # from 1 => to 1 } } pcm.dsp0 { type plug slave.pcm "dmix0" } # this makes native ALSA apps default to using dmix pcm.!default { type plug slave.pcm "dmix0" } ctl.dsp0 { type hw card 0 } ctl.!default { type hw card 0 }
Setting up ESD
(Warning: if you're using Ubuntu Hoary, you can use the improved polypaudio server instead. skip this section and see below)
~/.esd.conf:
# .esd.conf for use with ALSA and the dmix plugin, for ALSA-level # software mixing across all apps. esd is required to support the # Flash plugin and Java, along with other old applications. # # Run with: # # aoss esd -nobeeps & [esd] auto_spawn=0 spawn_options=-nobeeps spawn_wait_ms=100 default_options=
Then change your session-start script to run aoss esd -nobeeps &.
Setting up polypaudio
Ubuntu Hoary: don't use esd, you can use polypaudio instead. Edit the following files:
/etc/polypaudio/daemon.conf:
verbose = 1 daemonize = 1 fail = 0
/etc/polypaudio/client.conf:
# (just a comment so this is an empty file!)
Then change your session-start script to run aoss polypaudio.
Applications
KDE
For KDE apps, enter the KDE Control Center, go to Sound & Multimedia -> Sound System and set the options according to these screenshots:
Hit 'Test Sound' on the 'General' tab to restart artsd and try it out.
JuK
In current versions of JuK (version 2.2, KDE version 3.4), you need to edit ~/.kde/share/config/jukrc and add these lines to the end:
[GStreamerPlayer] SinkName=alsasink
In older versions of JuK, use Arts output, not GStreamer. The GStreamer layer in those versions supports exclusive access to the device only.
GNOME
Run gnome-sound-properties, go to the General tab, and un-tick Enable sound server startup. Then hit Close.
Run gstreamer-properties, go to the Audio tab, and select Output: ESD - Enlightenment Sound Daemon. Then hit Close.
Other apps
For output, never select OSS if possible; instead, use any of ESounD, Arts, or ALSA output. Use ESounD (aka ESD) if possible, Arts as a second-best, and try to avoid ALSA because many apps still seem to have trouble with software mixing (possibly a version compatibility issue).
If all else fails, run the app using aoss. This is required for RealPlayer for example: aoss realplay http://url.of.file.ram. (readers: edit the page or mail me if you get this working without aoss!)
Testing
To test multiple apps playing through all of artsd, esd, and direct ALSA, you can do the following:
run "alsaplayer nameofsong.mp3 &" to play via ALSA
run "artsplay nameofsong.mp3 &" to play via artsd
Go visit All Your Base (Flash video with sound) in Firefox with the Flash plugin, to play via esd