<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pigeon</id>
	<title>FlightGear wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.flightgear.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Pigeon"/>
	<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/Special:Contributions/Pigeon"/>
	<updated>2026-05-09T09:54:00Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.6</generator>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Multiplayer&amp;diff=6225</id>
		<title>Howto:Multiplayer</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Multiplayer&amp;diff=6225"/>
		<updated>2008-08-03T13:29:20Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* Using fgfs from the command line */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using the Windows launcher / fgrun =&lt;br /&gt;
Select your [[aircraft]] and starting airport as normal.  On the next screen, tick the &amp;quot;Multiplayer&amp;quot; box. Also tick the &amp;quot;AI models&amp;quot; box or you will not be able to see the other pilots' aircraft.  Enter the callsign of your choice, enter mpserver01.flightgear.org in the &amp;quot;Hostname&amp;quot; box and 5000 into both the &amp;quot;in&amp;quot; and &amp;quot;out&amp;quot; boxes.  Click run and you'll soon be flying with other pilots!&lt;br /&gt;
&lt;br /&gt;
To confirm that it's working, you can go to the multiplayer map at; http://mpmap02.flightgear.org/ (in Hong Kong).&lt;br /&gt;
You will also notice chat messages that say &amp;quot;Hello&amp;quot; indicating pilots that are online and then as they join.  &lt;br /&gt;
[[Image:Multiplayer.jpg|thumb|300px|Multiplayer options in [[FlightGear Wizard|FG Launcher]]]]&lt;br /&gt;
You may wish to use a different server (i.e. &amp;quot;Hostname&amp;quot; entry); &lt;br /&gt;
&lt;br /&gt;
  mpserver01.flightgear.org (in Germany)&lt;br /&gt;
  mpserver02.flightgear.org (in Hong Kong)  [T]&lt;br /&gt;
  mpserver03.flightgear.org (in Germany)    [T]&lt;br /&gt;
  mpserver04.flightgear.org (UK)&lt;br /&gt;
  mpserver06.flightgear.org (Sweden)&lt;br /&gt;
&lt;br /&gt;
Servers marked with [T] above log all flights in the [http://fgfs.i-net.hu/modules/fgtracker/ FlighGear flight tracker].&lt;br /&gt;
&lt;br /&gt;
'''Please Note:''' The multiplayer servers are interconnected; you '''do not''' need to connect to a specific server in order to see other pilots who are on that server.  For best performance, you should connect to the server that is geographically closest to you or has the lowest latency (ping time).&lt;br /&gt;
[[Image:MP_Server.jpg|thumb|300px]]&lt;br /&gt;
&lt;br /&gt;
= Multiplayer Chat =&lt;br /&gt;
&lt;br /&gt;
To chat with other pilots, go to the &amp;quot;View&amp;quot; menu and select &amp;quot;Chat&amp;quot; at the bottom of the menu.  Note that the other pilots may not have their chat box open, so they may not see your messages.&lt;br /&gt;
NOTE: Multiplayer chat is not supported by FlightGear 0.9.10 or older.&lt;br /&gt;
&lt;br /&gt;
= Using fgfs from the command line =&lt;br /&gt;
&lt;br /&gt;
First, for those who are very impatient and have a vague idea about what they're doing, the basic arguments to pass to fgfs for multiplayer are these;&lt;br /&gt;
&lt;br /&gt;
    --multiplay=out,10,server.ip.address,portnumber&lt;br /&gt;
    --multiplay=in,10,your.ip.address,portnumber&lt;br /&gt;
    --callsign=anything &lt;br /&gt;
&lt;br /&gt;
Where portnumber is usually 5000 and your.ip.address is the ip address of the network interface being used by FG to connect to the server - even if that's a local 192.168 type address.  Please note that although this limitation has been removed in the most recent versions of the FG server; you should still specify a valid (non-loopback, i.e. not 127.0.0.1) IP address to keep the FG client happy.&lt;br /&gt;
&lt;br /&gt;
With the latest FlightGear (at least with OSG), you can also leave your.ip.address blank. FlightGear will then listen on all network interfaces:&lt;br /&gt;
&lt;br /&gt;
    --multiplay=in,10,,5000&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Now, going more slowly for those who are completely lost... ==&lt;br /&gt;
&lt;br /&gt;
Try the above first, and if it doesn't work, read on.&lt;br /&gt;
&lt;br /&gt;
First of all, you need to know the IP address of the network interface you'll be using for multiplayer FG. If your Internet connection is via an ADSL modem that plugs directly into your computer with a USB connection, you should be able to find your IP address by visiting http://www.whatismyip.com . Please note that your ISP might not give you the same IP address each time - if MP stops working, check this first.&lt;br /&gt;
&lt;br /&gt;
Otherwise, your connection is likely via some kind of router that connects to your computer via an RJ-45, or &amp;quot;Ethernet&amp;quot; connector (similar shape to most Western telephone plugs), or by a wireless link. You need to find the IP address of that network interface.&lt;br /&gt;
&lt;br /&gt;
Under linux, this can be found by logging in as root and typing &amp;quot;ifconfig&amp;quot;. You may find more than one interface listed, beginning with &amp;quot;lo&amp;quot; - ignore that one. You should have something like &amp;quot;eth0&amp;quot; or &amp;quot;wlan0&amp;quot; also listed - look through this block of text for &amp;quot;inet addr&amp;quot;. This will be followed directly by the number you're looking for, e.g. &amp;quot;inet addr:192.168.0.150&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Under Windows XP, click start, run, and type &amp;quot;cmd&amp;quot;. In the terminal window which appears, type &amp;quot;ipconfig&amp;quot; This should show you your IP address - write it down.&lt;br /&gt;
&lt;br /&gt;
With Windows 98, click start, run, and type &amp;quot;winipcfg&amp;quot; to get information about your IP address.&lt;br /&gt;
&lt;br /&gt;
This section _ought_ to be unnecessary now with recent versions of the FG server.  If you have problems though, it won't hurt to follow through.&lt;br /&gt;
&lt;br /&gt;
Now, all(!) that remains is to configure your router to forward UDP port 5000 to the IP address you've just found. This is not something that can be described in step-by-step detail, because each manufacturer's configuration interfaces differ greatly. Some tips are given here - if you get stuck, ask nicely on the [irc://irc.flightgear.org/flightgear FlightGear IRC channel] for help (details on the flightgear website).&lt;br /&gt;
&lt;br /&gt;
You should know how to log on to your router's configuration page, usually via a web browser. You are looking for settings pertaining to &amp;quot;port forwarding&amp;quot; &amp;quot;virtual server&amp;quot; &amp;quot;Forwarding Rules&amp;quot; or similar. When you have found the relevant settings, you need to add a rule that forwards port 5000 to the IP address you discovered earlier. If there is a choice given, ensure it is UDP ports that are forwarded. If there is no choice, you may assume that both TCP and UDP are being forwarded. Save your configuration, and most routers will probably then need to be rebooted to apply the changes.&lt;br /&gt;
&lt;br /&gt;
Note: (for BSD users) If you are using a ADSL modem, you might have to put the port forward command into the ppp.conf file rather than firewall. This is because the firewall script will only run each time the machine is booted rather than the ppp line coming back online.&lt;br /&gt;
&lt;br /&gt;
Finally, start FG using the command line given right at the start (if you're using the windows launcher you will find entry boxes for Multiplayer arguments - insert the relevant details there). You will end up with something like this;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    fgfs --callsign=MyName --multiplay=in,10,192.168.0.2,5000   --multiplay=out,10,mpserver02.flightgear.org,5000 --airport=KSFO --runway=28R   --aircraft=hunter &lt;br /&gt;
&lt;br /&gt;
Choose your own callsign - this is currently limited to seven characters.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once you have started FG, you should, if others are flying, see messages in the terminal from which FG was started, similar to the following;&lt;br /&gt;
&lt;br /&gt;
    Initialising john51a using 'Aircraft/ufo/Models/ufo.xml'  &lt;br /&gt;
    FGMultiplayRxMgr::ProcessRxData - Add new player. IP: 10.0.0.36,  &lt;br /&gt;
    Call: john51a,model: Aircraft/ufo/Models/ufo.xml &lt;br /&gt;
&lt;br /&gt;
You MUST give your local, behind-the-router IP address for MultiPlayer to work. Trust me on this one!&lt;br /&gt;
&lt;br /&gt;
You should check that your firewall is not causing problems - either turn it off _temporarily_ or add an exception to allow incoming connections on port 5000.&lt;br /&gt;
&lt;br /&gt;
If it's still just not working for you, ask nicely on the [irc://irc.flightgear.org/flightgear FlightGear IRC channel] and someone should be able to assist.&lt;br /&gt;
Multiplayer Map&lt;br /&gt;
There is a very nice online map which displays the location of online pilots at http://mpmap02.flightgear.org .  You will also find this useful to check that you are successfully connecting to the server.&lt;br /&gt;
&lt;br /&gt;
THE FLIGHTGEAR MULTIPLAYER ROUGH HOWTO&lt;br /&gt;
&lt;br /&gt;
2006-05-27&lt;br /&gt;
&lt;br /&gt;
[[Category:Howto|Multiplayer]]&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Howto:Multiplayer&amp;diff=3251</id>
		<title>Howto:Multiplayer</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Howto:Multiplayer&amp;diff=3251"/>
		<updated>2007-01-16T10:56:37Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* Using the Windows launcher / fgrun */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Using the Windows launcher / fgrun =&lt;br /&gt;
&lt;br /&gt;
Select your aircraft and starting airport as normal.  On the next screen, tick the &amp;quot;Multiplayer&amp;quot; box, enter a callsign of your choice, enter mpserver01.flightgear.org in the &amp;quot;Hostname&amp;quot; box and 5000 into both the &amp;quot;in&amp;quot; and &amp;quot;out&amp;quot; boxes.  Click run and you're hopefully sorted!&lt;br /&gt;
&lt;br /&gt;
To confirm that it's working, you can go to:&lt;br /&gt;
http://mpmap01.flightgear.org/ (in Germany) or http://mpmap02.flightgear.org/ (in Hong Kong) and use the multiplayer map there.&lt;br /&gt;
&lt;br /&gt;
You may wish to use a different server (i.e. &amp;quot;Hostname&amp;quot; entry); currently available are:&lt;br /&gt;
&lt;br /&gt;
mpserver01.flightgear.org (in Germany)&lt;br /&gt;
&lt;br /&gt;
mpserver02.flightgear.org (in Hong Kong)&lt;br /&gt;
&lt;br /&gt;
mpserver03.flightgear.org (East Coast USA)&lt;br /&gt;
&lt;br /&gt;
mpserver04.flightgear.org (UK)&lt;br /&gt;
&lt;br /&gt;
mpserver05.flightgear.org (Portsmouth, UK)&lt;br /&gt;
&lt;br /&gt;
= Using fgfs from the command line =&lt;br /&gt;
&lt;br /&gt;
First, for those who are very impatient and have a vague idea about what they're doing, the basic arguments to pass to fgfs for multiplayer are these;&lt;br /&gt;
&lt;br /&gt;
    --multiplay=out,10,server.ip.address,portnumber&lt;br /&gt;
    --multiplay=in,10,your.ip.address,portnumber&lt;br /&gt;
    --callsign=anything &lt;br /&gt;
&lt;br /&gt;
Where portnumber is usually 5000 or 5002 and your.ip.address is the ip address of the network interface being used by FG to connect to the server - even if that's a local 192.168 type address.  Please note that although this limitation has been removed in the most recent versions of the FG server; you should still specify a valid (non-loopback, i.e. not 127.0.0.1) IP address to keep the FG client happy.&lt;br /&gt;
&lt;br /&gt;
Port 5000 is usually for the latest stable version of FlightGear. Currently 0.9.10&lt;br /&gt;
&lt;br /&gt;
Port 5002 is mainly used for development, i.e. stable version of FlightGear might or might not work with this server, depending on the server's development stage.&lt;br /&gt;
&lt;br /&gt;
== Now, going more slowly for those who are completely lost... ==&lt;br /&gt;
&lt;br /&gt;
Try the above first, and if it doesn't work, read on.&lt;br /&gt;
&lt;br /&gt;
First of all, you need to know the IP address of the network interface you're going to be running FG multiplayer over. If your Internet connection is via an ADSL modem that plugs directly into your computer with a USB connection, you should be able to find your IP address by visiting http://www.whatismyip.com . Please note that this address may very well change every now and again - if MP stops working, check this first.&lt;br /&gt;
&lt;br /&gt;
Otherwise, your connection is likely via some kind of router that connects to your computer via an RJ-45, or &amp;quot;Ethernet&amp;quot; connector (similar shape to most Western telephone plugs), or by a wireless link. You need to find the IP address of that network interface.&lt;br /&gt;
&lt;br /&gt;
Under linux, this can be found by logging in as root and typing &amp;quot;ifconfig&amp;quot;. You may find more than one interface listed, beginning with &amp;quot;lo&amp;quot; - ignore that one. You should have something like &amp;quot;eth0&amp;quot; or &amp;quot;wlan0&amp;quot; also listed - look through this block of text for &amp;quot;inet addr&amp;quot;. This will be followed directly by the number you're looking for, e.g. &amp;quot;inet addr:192.168.0.150&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Under Windows XP, click start, run, and type &amp;quot;cmd&amp;quot;. In the terminal window which appears, type &amp;quot;ipconfig&amp;quot; This should show you your IP address - note it down.&lt;br /&gt;
&lt;br /&gt;
With Windows 98, click start, run, and type &amp;quot;winipcfg&amp;quot; to get information about your IP address.&lt;br /&gt;
&lt;br /&gt;
This section _ought_ to be unnecessary now with recent versions of the FG server.  If you have problems though, it won't hurt to follow through.&lt;br /&gt;
&lt;br /&gt;
Now, all(!) that remains is to configure your router to forward UDP port 5000 or 5002 to the IP address you've just found. This is not something that can be described in step-by-step detail, because each manufacturer's configuration interfaces differ greatly. Some tips are given here - if you get stuck, ask nicely on the FlightGear IRC channel for help (details on the flightgear website).&lt;br /&gt;
&lt;br /&gt;
You should know how to log on to your router's configuration page, usually via a web browser. You are looking for settings pertaining to &amp;quot;port forwarding&amp;quot; &amp;quot;virtual server&amp;quot; &amp;quot;Forwarding Rules&amp;quot; or similar. When you have found the relevant settings, you need to add a rule that forwards port 5000 or 5002 (depending on which server you wish to join - add both if you like) to the IP address you discovered earlier. If there is a choice given, ensure it is UDP ports that are forwarded. If there is no choice, you may assume that both TCP and UDP are being forwarded. Save your configuration, and most routers will probably then need to be rebooted to apply the changes.&lt;br /&gt;
&lt;br /&gt;
Note: (for BSD users) If you are using a ADSL modem, you might have to put the port forward command into the ppp.conf file rather than firewall. This is because the firewall script will only run each time the machine is booted rather than the ppp line coming back online.&lt;br /&gt;
&lt;br /&gt;
Finally, start FG using the command line given right at the start (if you're using the windows launcher you will find entry boxes for Multiplayer arguments - insert the relevant details there). You will end up with something like this;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    fgfs --callsign=MyName --multiplay=in,10,192.168.0.2,5000   --multiplay=out,10,mpserver02.flightgear.org,5000 --airport=KSFO --runway=28R   --aircraft=hunter &lt;br /&gt;
&lt;br /&gt;
Choose your own callsign - this is currently limited to seven characters.&amp;lt;br&amp;gt;&lt;br /&gt;
NOTE: Windows users also might have to add the option --enable-ai-models on their command line in order to see other multiplayer aircraft(or in fgrun, check the box that says &amp;quot;AI Models&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
Once you have started FG, you should, if others are flying, see messages in the terminal from which FG was started, similar to the following;&lt;br /&gt;
&lt;br /&gt;
    Initialising john51a using 'Aircraft/ufo/Models/ufo.xml'  &lt;br /&gt;
    FGMultiplayRxMgr::ProcessRxData - Add new player. IP: 10.0.0.36,  &lt;br /&gt;
    Call: john51a,model: Aircraft/ufo/Models/ufo.xml &lt;br /&gt;
&lt;br /&gt;
You MUST give your local, behind-the-router IP address for MultiPlayer to work. Trust me on this one!&lt;br /&gt;
&lt;br /&gt;
You should check that your firewall is not causing problems - either turn it off _temporarily_ or add an exception to allow incoming connections on port 5000 and 5002.&lt;br /&gt;
&lt;br /&gt;
If it's still just not working for you, ask nicely on the FlightGear IRC channel and someone should be able to assist.&lt;br /&gt;
Multiplayer Map&lt;br /&gt;
There is a very nice online map which displays the location of online pilots at http://mpmap01.flightgear.org .  You will also find this useful to check that you are successfully connecting to the server.&lt;br /&gt;
&lt;br /&gt;
THE FLIGHTGEAR MULTIPLAYER ROUGH HOWTO&lt;br /&gt;
&lt;br /&gt;
2006-05-27&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=3204</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=3204"/>
		<updated>2006-12-26T10:19:11Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
== Quick start ==&lt;br /&gt;
&lt;br /&gt;
* [[#FlightGear|Getting FlightGear to use ALSA, esd (Gnome), or arts (KDE)]].&lt;br /&gt;
* [[#Festival|Getting Festival to use ALSA]].&lt;br /&gt;
* [[#TeamSpeak|Getting TeamSpeak to use ALSA]].&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -D plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ldd /usr/bin/aplay&lt;br /&gt;
linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
/lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(alsa))&lt;br /&gt;
(define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(esd))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(arts))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esddsp festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
(Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aoss TeamSpeak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ #~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
Usually you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pcm.duplex {&lt;br /&gt;
    type asym&lt;br /&gt;
    playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
    capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pcm.!default {&lt;br /&gt;
    type plug&lt;br /&gt;
    slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins.&lt;br /&gt;
&lt;br /&gt;
With FlightGear/OpenAL, however, I'm not sure what the issue is, but you may still need to specify &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;, which is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(alsa))&lt;br /&gt;
(define alsa-out-device &amp;quot;plug:duplex&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3132</id>
		<title>OpenSceneGraph</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3132"/>
		<updated>2006-11-16T23:21:24Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* Current Issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting a patched version of OpenSceneGraph ==&lt;br /&gt;
&lt;br /&gt;
Thanks to Mathias Fröhlich, we can use an updated OpenSceneGraph version that &lt;br /&gt;
contains 3 additional patches.&lt;br /&gt;
* most important an updated ac3d loader - that is our most used one ...&lt;br /&gt;
* a fix to the RGB Loader&lt;br /&gt;
* a small backport of OpenSceneGraph-CVS doing the right OpenGL version checks ...&lt;br /&gt;
OpenSceneGraph-CVS it now up to date with the required patches and should serve as well for running FlightGear. Please note that the &amp;quot;Producer&amp;quot; build system is currently in the works, you probably want to check out with the &amp;quot;-D 20061113&amp;quot; tag.&lt;br /&gt;
&lt;br /&gt;
You can find that tarball at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061114/OSG_OP_OT-1.2-Flightgear.tar.gz&lt;br /&gt;
&lt;br /&gt;
Diff can be found at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061114/OSG_OP_OT-1.2-Flightgear.diff&lt;br /&gt;
&lt;br /&gt;
Mathias is working on getting the remaining patch upstream ...&lt;br /&gt;
&lt;br /&gt;
And the MSVC8 win32 build dependencies for OpenSceneGraph can be found at http://www.oflebbe.de/oflebbe/FlightGear. Look out for the link to 3rdParty.zip.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If you get errors when compiling the patched OpenSceneGraph after having compiled (and installed) OpenThreads and Producer successfully (happens on Arch Linux), you may have to add the following to your 'make':&lt;br /&gt;
&lt;br /&gt;
     '''make PRODUCER_INC_DIR=/usr/local/include/Producer \'''&lt;br /&gt;
     '''PRODUCER_LIB_DIR=/usr/local/lib \'''&lt;br /&gt;
     '''OPENTHREADS_INC_DIR=/usr/local/include/OpenThreads \'''&lt;br /&gt;
     '''OPENTHREADS_LIB_DIR=/usr/local/lib'''&lt;br /&gt;
&lt;br /&gt;
== Compilation workaround ==&lt;br /&gt;
&lt;br /&gt;
FIXME&lt;br /&gt;
&lt;br /&gt;
Do not forget to run autogen.sh when updating sources.&lt;br /&gt;
&lt;br /&gt;
=== Installing FlightGear and OSG with --prefix workaround ===&lt;br /&gt;
&lt;br /&gt;
If you use --prefix to choose were to install FlightGear and do not want to install OSG globally on the system this can be done with the following method&lt;br /&gt;
(description for Linux):&lt;br /&gt;
&lt;br /&gt;
1. Build OpenScenGraph. I do it directly in the OSG source directory without installing anything (when the next version comes I can just delete the old directory without any worries). Adjust as needed:&lt;br /&gt;
 export OSG_BASE=$HOME/FlightGear/build/OpenSceneGraph/OSG_OP_OT-1.2-Flightgear&lt;br /&gt;
 export OPENTHREADS_INC_DIR=$OSG_BASE/OpenThreads/include&lt;br /&gt;
 export OPENTHREADS_LIB_DIR=$OSG_BASE/OpenThreads/lib/Linux32&lt;br /&gt;
 export PRODUCER_INC_DIR=$OSG_BASE/Producer/include&lt;br /&gt;
 export PRODUCER_LIB_DIR=$OSG_BASE/Producer/lib/Linux32&lt;br /&gt;
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$OPENTHREADS_LIB_DIR:$PRODUCER_LIB_DIR&lt;br /&gt;
&lt;br /&gt;
 cd OpenThreads; make&lt;br /&gt;
 cd ../Producer; make&lt;br /&gt;
 cd ../OpenScenGraph; make&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. Copy or (soft)link OpenThreads/include/OpenThreads into your $PREFIX/include/ directory.&lt;br /&gt;
&lt;br /&gt;
3. Copy or (soft)link Producer/include/Producer into your $PREFIX/include/ directory.&lt;br /&gt;
&lt;br /&gt;
4. Copy or (soft)link OpenSceneGraph/include/osg* into your $PREFIX/include/ directory.&lt;br /&gt;
&lt;br /&gt;
5. Copy or (soft)link OpenThreads/lib/&amp;lt;system&amp;gt;/lib*.so into your $PREFIX/lib/ directory.&lt;br /&gt;
&lt;br /&gt;
6. Copy or (soft)link Producer/lib/&amp;lt;system&amp;gt;/lib*.so into your $PREFIX/lib/ directory.&lt;br /&gt;
&lt;br /&gt;
7. Copy or (soft)link OpenSceneGraph/lib/&amp;lt;system&amp;gt;/lib*.so into your $PREFIX/lib/ directory.&lt;br /&gt;
&lt;br /&gt;
8. Add $PREFIX/lib to LD_LIBRARY_PATH.&lt;br /&gt;
 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$PREFIX/lib&lt;br /&gt;
&lt;br /&gt;
9. Configure and build SimGear and FlightGear with --prefix as usual.&lt;br /&gt;
&lt;br /&gt;
No need to install any quickly changing software globally.&lt;br /&gt;
&lt;br /&gt;
Installing with --prefix is a very nice way to keep several distinct and independent versions of FlightGear around. To start a new $PREFIX directory you'll also need to install plib in it, but that is easy. Most other needed dependencies are usually available through the package system of most Linux distributions (e.g. FreeGLUT, SDL, ALSA, etc).&lt;br /&gt;
&lt;br /&gt;
FIXME: Maybe it is enough to copy only the OpenSceneGraph/include/osg* and OpenSceneGraph/lib/&amp;lt;system&amp;gt;/lib*.so stuff into $PREFIX?&lt;br /&gt;
&lt;br /&gt;
== Current Issues ==&lt;br /&gt;
&lt;br /&gt;
* OSG Rendering Performance is roughly up to a factor of 2 slower for some scenes. This seems to have more dramatic on the Windows MVC8 build. Rendering ist faster now...&lt;br /&gt;
&lt;br /&gt;
* some buildings are with day texture, and other with night texture. i'm landing onto Paris center and, with the external view, i rotate around the aircraft. the sun position is not fixed at the same time, left side of aircraft is on shadow, with another camera position, it's the right side. that can explain why some building are day textured, and some others night textured&lt;br /&gt;
&lt;br /&gt;
* Some scenes do not work: The view is black. The default scene c172p on KSFO is working, however. It seems to be a terrain/ground problem since it disappears by using the UFO. This is fixed now by the ground-cache fix in CVS (061107)'''&lt;br /&gt;
&lt;br /&gt;
* There are also missing ground tiles: For instance located between EDDF and Feldberg.&lt;br /&gt;
&lt;br /&gt;
* Rendering order of instruments / ... is wrong.&lt;br /&gt;
&lt;br /&gt;
* At least at the present season with &amp;quot;--timeofday=noon&amp;quot;, sitting at KSFO 28R, I look straight into the moon with FlightGear/PLIB, but the moon isn't there with FG/OSG&lt;br /&gt;
&lt;br /&gt;
* In the external view(s) the HUD position is shifted to the left&lt;br /&gt;
&lt;br /&gt;
* transparency issues:&lt;br /&gt;
** runway lights shine through panel:&lt;br /&gt;
** runway lights shine through cloud layers in an awkward way:&lt;br /&gt;
** 2D-cloud layers flood into cockpit&lt;br /&gt;
** The prop of the C172 block the view on the waves of the carrier&lt;br /&gt;
** The reflector gun sight on the Seahawk causes other transparent objects (carrier wake etc.) to disappear&lt;br /&gt;
** A new overhead window in the C172 (inside out)&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Near clipping problem&amp;quot; (nearby objects are partially clipped at left and right window boarder, ie seats in C172 inside)&lt;br /&gt;
&lt;br /&gt;
* Some textures are to dark, runway for instance, c172 prop disk as well.&lt;br /&gt;
&lt;br /&gt;
* Runway lighting seems to have rendering artefacts on ATI Cards.&lt;br /&gt;
&lt;br /&gt;
* Enhanced runway lighting option in the drop-down menu seems to have no effect - light always appear enhanced.&lt;br /&gt;
&lt;br /&gt;
* compass working incorrectly&lt;br /&gt;
&lt;br /&gt;
* panel hotspots are not correctly displayed in 3D panels using the 2D hotspot hack; are hidden behind 3D model geometry&lt;br /&gt;
&lt;br /&gt;
* Aircraft issues&lt;br /&gt;
**  Hurricane/Spitfire/Seafire won't start. The starter spins continuously, but the engine won't fire.&lt;br /&gt;
&lt;br /&gt;
     '''Fixed: 061110'''&lt;br /&gt;
     '''Spoke too soon - not fixed - the bug is intermittent'''&lt;br /&gt;
 &lt;br /&gt;
With the Spit/Seafire I get&lt;br /&gt;
&lt;br /&gt;
Notice: Material::getDiffuse(FRONT_AND_BACK) called on material&lt;br /&gt;
        with separate FRONT and BACK diffuse colors.&lt;br /&gt;
&lt;br /&gt;
and a segfault;&lt;br /&gt;
&lt;br /&gt;
** A4F crashes FG, without any error message that I have found so far. ('''FIXED''' a4/Models/a4-blue.ac 1.18 groups are not supposed to have vertices)&lt;br /&gt;
**    Hunter and Seahawk have lost their exhausts (of course). &lt;br /&gt;
**     The Engage Launch-bar command (L) is broken.&lt;br /&gt;
**     The Mixture control (M/m) seems to be broken. &lt;br /&gt;
&lt;br /&gt;
* Seneca II HSI: upper instrument clipping issue for NAV/HDG flags, heading bug, pointer&lt;br /&gt;
&lt;br /&gt;
* Sky/Ephemeris &lt;br /&gt;
** Planets visible near the sun at noon&lt;br /&gt;
&lt;br /&gt;
* Clickable Hotspots &lt;br /&gt;
** Not visible at night&lt;br /&gt;
&lt;br /&gt;
* 3D cockpit instruments (I tried C172p's and 747's) seems to be scaled depending on the size of the window. This is most obvious when I change the FOV to its max (120) using the 'X' key. E.g. when I resize FG's window so that its width is much larger than its height (say, 1024x100), instruments all become a fat oval shape. Then if I resize the window the other way (say 100x910), instruments become narrower.&amp;lt;br&amp;gt;Screenshots: [http://pigeond.net/~pigeon/fg-osg-fat-window.png] [http://pigeond.net/~pigeon/fg-osg-thin-window.png] (20061117 pigeon)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[List of 'compatible' aircrafts]] TO BE CONTINUED&lt;br /&gt;
&lt;br /&gt;
== Missing Features == &lt;br /&gt;
&lt;br /&gt;
* 3D-billboard objects are not displayed right now (ie trees or radio masts)&lt;br /&gt;
&lt;br /&gt;
* 3D clouds&lt;br /&gt;
&lt;br /&gt;
* Rendering of some scenes is not perfect.&lt;br /&gt;
&lt;br /&gt;
* Shadows&lt;br /&gt;
&lt;br /&gt;
* Exhaust shader&lt;br /&gt;
&lt;br /&gt;
* Chrome Shader&lt;br /&gt;
&lt;br /&gt;
* Weather Radar&lt;br /&gt;
&lt;br /&gt;
* Menu Items have no effect&lt;br /&gt;
** Enhanced Runway Lights&lt;br /&gt;
** Bump Mapped Clouds&lt;br /&gt;
&lt;br /&gt;
== Miscelaneous OSG benefits ==&lt;br /&gt;
&lt;br /&gt;
Mathias: &amp;quot;I think that we should make use in the longer term of the Producers &lt;br /&gt;
capabilities for multiple view installations.&lt;br /&gt;
But not only multipipe installs will benefit from that. The Producer will also &lt;br /&gt;
help to get benefit from multicore SMP machines.&lt;br /&gt;
For that the following article is of huge interrest:&lt;br /&gt;
http://www.donburns.net/OSG/Articles/OSGMP/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Getting the PLIB Code ==&lt;br /&gt;
&lt;br /&gt;
Use the tag &amp;lt;tt&amp;gt;PRE_OSG_PLIB_20061029&amp;lt;/tt&amp;gt; for checking out the branch with the plib scenegraph.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For SimGear, this works (more or less) as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
     '''cvs -d :pserver:cvsguest@cvs.simgear.org:/var/cvs/SimGear-0.3 login'''&lt;br /&gt;
     '''CVS passwd: guest'''&lt;br /&gt;
     '''cvs -d :pserver:cvsguest@cvs.simgear.org:/var/cvs/SimGear-0.3 co source'''&lt;br /&gt;
     '''cd source'''&lt;br /&gt;
     '''cvs up -rPRE_OSG_PLIB_20061029'''&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For FlightGear, you have to update both the &amp;quot;data&amp;quot; and &amp;quot;source&amp;quot; directories.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3113</id>
		<title>OpenSceneGraph</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3113"/>
		<updated>2006-11-11T22:29:48Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* Current Issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting a patched version of OpenSceneGraph ==&lt;br /&gt;
&lt;br /&gt;
Thanks to Mathias Fröhlich, we can use an updated OpenSceneGraph version that &lt;br /&gt;
contains 3 additional patches.&lt;br /&gt;
* most important an updated ac3d loader - that is our most used one ...&lt;br /&gt;
* a fix to the RGB Loader, which is already in OpenSceneGraph-CVS&lt;br /&gt;
* a small backport of OpenSceneGraph-CVS doing the right OpenGL version checks ...&lt;br /&gt;
&lt;br /&gt;
You can find that tarball at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061108/OSG_OP_OT-1.2-Flightgear.tar.gz&lt;br /&gt;
&lt;br /&gt;
Diff can be found at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061108/OSG_OP_OT-1.2-Flightgear.diff&lt;br /&gt;
&lt;br /&gt;
Mathias is working on getting the remaining patch upstream ...&lt;br /&gt;
&lt;br /&gt;
And the MSVC8 win32 build dependencies for OpenSceneGraph can be found at http://www.oflebbe.de/oflebbe/FlightGear. Look out for the link to 3rdParty.zip.&lt;br /&gt;
&lt;br /&gt;
== Compilation workaround ==&lt;br /&gt;
&lt;br /&gt;
FIXME&lt;br /&gt;
&lt;br /&gt;
Do not forget to run autogen.sh when updating sources.&lt;br /&gt;
&lt;br /&gt;
== Current Issues ==&lt;br /&gt;
&lt;br /&gt;
* OSG Rendering Performance is roughly up to a factor of 2 slower for some scenes. This seems to have more dramatic on the Windows MVC8 build. Rendering ist faster now...&lt;br /&gt;
&lt;br /&gt;
* some buildings are with day texture, and other with night texture. i'm landing onto Paris center and, with the external view, i rotate around the aircraft. the sun position is not fixed at the same time, left side of aircraft is on shadow, with another camera position, it's the right side. that can explain why some building are day textured, and some others night textured&lt;br /&gt;
&lt;br /&gt;
* Some scenes do not work: The view is black. The default scene c172p on KSFO is working, however. It seems to be a terrain/ground problem since it disappears by using the UFO. This is fixed now by the ground-cache fix in CVS (061107)'''&lt;br /&gt;
&lt;br /&gt;
* There are also missing ground tiles: For instance located between EDDF and Feldberg.&lt;br /&gt;
&lt;br /&gt;
* Rendering order of instruments / ... is wrong.&lt;br /&gt;
&lt;br /&gt;
* At least at the present season with &amp;quot;--timeofday=noon&amp;quot;, sitting at KSFO 28R, I look straight into the moon with FlightGear/PLIB, but the moon isn't there with FG/OSG&lt;br /&gt;
&lt;br /&gt;
* In the external view(s) the HUD position is shifted to the left&lt;br /&gt;
&lt;br /&gt;
* transparency issues:&lt;br /&gt;
** runway lights shine through panel:&lt;br /&gt;
** runway lights shine through cloud layers in an awkward way:&lt;br /&gt;
** 2D-cloud layers flood into cockpit&lt;br /&gt;
** The prop of the C172 block the view on the waves of the carrier&lt;br /&gt;
** The reflector gun sight on the Seahawk causes other transparent objects (carrier wake etc.) to disappear&lt;br /&gt;
** A new overhead window in the C172 (inside out)&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Near clipping problem&amp;quot; (nearby objects are partially clipped at left and right window boarder, ie seats in C172 inside)&lt;br /&gt;
&lt;br /&gt;
* Some textures are to dark, runway for instance, c172 prop disk as well.&lt;br /&gt;
&lt;br /&gt;
* Runway lighting seems to have rendering artefacts on ATI Cards.&lt;br /&gt;
&lt;br /&gt;
* Enhanced runway lighting option in the drop-down menu seems to have no effect - light always appear enhanced.&lt;br /&gt;
&lt;br /&gt;
* compass working incorrectly&lt;br /&gt;
&lt;br /&gt;
* panel hotspots are not correctly displayed in 3D panels using the 2D hotspot hack; are hidden behind 3D model geometry&lt;br /&gt;
&lt;br /&gt;
* Aircraft issues&lt;br /&gt;
**  Hurricane/Spitfire/Seafire won't start. The starter spins continuously, but the engine won't fire.&lt;br /&gt;
&lt;br /&gt;
     '''Fixed: 061110'''&lt;br /&gt;
     '''Spoke too soon - not fixed - the bug is intermittent'''&lt;br /&gt;
 &lt;br /&gt;
With the Spit/Seafire I get&lt;br /&gt;
&lt;br /&gt;
Notice: Material::getDiffuse(FRONT_AND_BACK) called on material&lt;br /&gt;
        with separate FRONT and BACK diffuse colors.&lt;br /&gt;
&lt;br /&gt;
and a segfault;&lt;br /&gt;
&lt;br /&gt;
** A4F crashes FG, without any error message that I have found so far. ('''FIXED''' a4/Models/a4-blue.ac 1.18 groups are not supposed to have vertices)&lt;br /&gt;
**    Hunter and Seahawk have lost their exhausts (of course). &lt;br /&gt;
**     The Engage Launch-bar command (L) is broken.&lt;br /&gt;
**     The Mixture control (M/m) seems to be broken. &lt;br /&gt;
&lt;br /&gt;
* Sky/Ephemeris &lt;br /&gt;
** Planets visible near the sun at noon&lt;br /&gt;
&lt;br /&gt;
* Clickable Hotspots &lt;br /&gt;
** Not visible at night&lt;br /&gt;
&lt;br /&gt;
* 3D cockpit instruments (I tried C172p's and 747's) seems to be scaled depending on the size of the window. This is most obvious when I change the FOV to its max (120) using the 'X' key. E.g. when I resize FG's window so that its width is much larger than its height (say, 1024x100), instruments all become a fat oval shape. Then if I resize the window the other way (say 100x910), instruments become narrower. (20061111 pigeon)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[List of 'compatible' aircrafts]] TO BE CONTINUED&lt;br /&gt;
&lt;br /&gt;
== Missing Features == &lt;br /&gt;
&lt;br /&gt;
* 3D-billboard objects are not displayed right now (ie trees or radio masts)&lt;br /&gt;
&lt;br /&gt;
* 3D clouds&lt;br /&gt;
&lt;br /&gt;
* Rendering of some scenes is not perfect.&lt;br /&gt;
&lt;br /&gt;
* Shadows&lt;br /&gt;
&lt;br /&gt;
* Exhaust shader&lt;br /&gt;
&lt;br /&gt;
* Chrome Shader&lt;br /&gt;
&lt;br /&gt;
* Weather Radar&lt;br /&gt;
&lt;br /&gt;
* Menu Items have no effect&lt;br /&gt;
** Enhanced Runway Lights&lt;br /&gt;
** Bump Mapped Clouds&lt;br /&gt;
&lt;br /&gt;
== Miscelaneous OSG benefits ==&lt;br /&gt;
&lt;br /&gt;
Mathias: &amp;quot;I think that we should make use in the longer term of the Producers &lt;br /&gt;
capabilities for multiple view installations.&lt;br /&gt;
But not only multipipe installs will benefit from that. The Producer will also &lt;br /&gt;
help to get benefit from multicore SMP machines.&lt;br /&gt;
For that the following article is of huge interrest:&lt;br /&gt;
http://www.donburns.net/OSG/Articles/OSGMP/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Getting the PLIB Code ==&lt;br /&gt;
&lt;br /&gt;
Use the tag &amp;lt;tt&amp;gt;PRE_OSG_PLIB_20061029&amp;lt;/tt&amp;gt; for checking out the branch with the plib scenegraph.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3112</id>
		<title>OpenSceneGraph</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3112"/>
		<updated>2006-11-11T22:27:23Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* Current Issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting a patched version of OpenSceneGraph ==&lt;br /&gt;
&lt;br /&gt;
Thanks to Mathias Fröhlich, we can use an updated OpenSceneGraph version that &lt;br /&gt;
contains 3 additional patches.&lt;br /&gt;
* most important an updated ac3d loader - that is our most used one ...&lt;br /&gt;
* a fix to the RGB Loader, which is already in OpenSceneGraph-CVS&lt;br /&gt;
* a small backport of OpenSceneGraph-CVS doing the right OpenGL version checks ...&lt;br /&gt;
&lt;br /&gt;
You can find that tarball at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061108/OSG_OP_OT-1.2-Flightgear.tar.gz&lt;br /&gt;
&lt;br /&gt;
Diff can be found at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061108/OSG_OP_OT-1.2-Flightgear.diff&lt;br /&gt;
&lt;br /&gt;
Mathias is working on getting the remaining patch upstream ...&lt;br /&gt;
&lt;br /&gt;
And the MSVC8 win32 build dependencies for OpenSceneGraph can be found at http://www.oflebbe.de/oflebbe/FlightGear. Look out for the link to 3rdParty.zip.&lt;br /&gt;
&lt;br /&gt;
== Compilation workaround ==&lt;br /&gt;
&lt;br /&gt;
FIXME&lt;br /&gt;
&lt;br /&gt;
Do not forget to run autogen.sh when updating sources.&lt;br /&gt;
&lt;br /&gt;
== Current Issues ==&lt;br /&gt;
&lt;br /&gt;
* OSG Rendering Performance is roughly up to a factor of 2 slower for some scenes. This seems to have more dramatic on the Windows MVC8 build. Rendering ist faster now...&lt;br /&gt;
&lt;br /&gt;
* some buildings are with day texture, and other with night texture. i'm landing onto Paris center and, with the external view, i rotate around the aircraft. the sun position is not fixed at the same time, left side of aircraft is on shadow, with another camera position, it's the right side. that can explain why some building are day textured, and some others night textured&lt;br /&gt;
&lt;br /&gt;
* Some scenes do not work: The view is black. The default scene c172p on KSFO is working, however. It seems to be a terrain/ground problem since it disappears by using the UFO. This is fixed now by the ground-cache fix in CVS (061107)'''&lt;br /&gt;
&lt;br /&gt;
* There are also missing ground tiles: For instance located between EDDF and Feldberg.&lt;br /&gt;
&lt;br /&gt;
* Rendering order of instruments / ... is wrong.&lt;br /&gt;
&lt;br /&gt;
* At least at the present season with &amp;quot;--timeofday=noon&amp;quot;, sitting at KSFO 28R, I look straight into the moon with FlightGear/PLIB, but the moon isn't there with FG/OSG&lt;br /&gt;
&lt;br /&gt;
* In the external view(s) the HUD position is shifted to the left&lt;br /&gt;
&lt;br /&gt;
* transparency issues:&lt;br /&gt;
&lt;br /&gt;
** runway lights shine through panel:&lt;br /&gt;
    &lt;br /&gt;
** runway lights shine through cloud layers in an awkward way:&lt;br /&gt;
   &lt;br /&gt;
** 2D-cloud layers flood into cockpit&lt;br /&gt;
    &lt;br /&gt;
** The prop of the C172 block the view on the waves of the carrier&lt;br /&gt;
&lt;br /&gt;
** The reflector gun sight on the Seahawk causes other transparent objects (carrier wake etc.) to disappear&lt;br /&gt;
&lt;br /&gt;
** A new overhead window in the C172 (inside out)&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Near clipping problem&amp;quot; (nearby objects are partially clipped at left and right window boarder, ie seats in C172 inside)&lt;br /&gt;
&lt;br /&gt;
* Some textures are to dark, runway for instance, c172 prop disk as well.&lt;br /&gt;
&lt;br /&gt;
* Runway lighting seems to have rendering artefacts on ATI Cards.&lt;br /&gt;
&lt;br /&gt;
* Enhanced runway lighting option in the drop-down menu seems to have no effect - light always appear enhanced.&lt;br /&gt;
&lt;br /&gt;
* compass working incorrectly&lt;br /&gt;
&lt;br /&gt;
* panel hotspots are not correctly displayed in 3D panels using the 2D hotspot hack; are hidden behind 3D model geometry&lt;br /&gt;
&lt;br /&gt;
* Aircraft issues&lt;br /&gt;
**  Hurricane/Spitfire/Seafire won't start. The starter spins continuously, but the engine won't fire.&lt;br /&gt;
&lt;br /&gt;
     '''Fixed: 061110'''&lt;br /&gt;
     '''Spoke too soon - not fixed - the bug is intermittent'''&lt;br /&gt;
 &lt;br /&gt;
With the Spit/Seafire I get&lt;br /&gt;
&lt;br /&gt;
Notice: Material::getDiffuse(FRONT_AND_BACK) called on material&lt;br /&gt;
        with separate FRONT and BACK diffuse colors.&lt;br /&gt;
&lt;br /&gt;
and a segfault;&lt;br /&gt;
&lt;br /&gt;
** A4F crashes FG, without any error message that I have found so far. ('''FIXED''' a4/Models/a4-blue.ac 1.18 groups are not supposed to have vertices)&lt;br /&gt;
**    Hunter and Seahawk have lost their exhausts (of course). &lt;br /&gt;
**     The Engage Launch-bar command (L) is broken.&lt;br /&gt;
**     The Mixture control (M/m) seems to be broken. &lt;br /&gt;
&lt;br /&gt;
* Sky/Ephemeris &lt;br /&gt;
** Planets visible near the sun at noon&lt;br /&gt;
&lt;br /&gt;
* Clickable Hotspots &lt;br /&gt;
** Not visible at night&lt;br /&gt;
&lt;br /&gt;
* 3D cockpit instruments (I tried C172p's and 747's) seems to be scaled depending on the size of the window. This is most obvious when I change the FOV to its max (120) using the 'X' key. E.g. when I resize FG's window so that its width is much larger than its height (say, 1024x100), instruments all become a fat oval shape. Then if I resize the window the other way (say 100x910), instruments become narrower. (20061111 pigeon)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[List of 'compatible' aircrafts]] TO BE CONTINUED&lt;br /&gt;
&lt;br /&gt;
== Missing Features == &lt;br /&gt;
&lt;br /&gt;
* 3D-billboard objects are not displayed right now (ie trees or radio masts)&lt;br /&gt;
&lt;br /&gt;
* 3D clouds&lt;br /&gt;
&lt;br /&gt;
* Rendering of some scenes is not perfect.&lt;br /&gt;
&lt;br /&gt;
* Shadows&lt;br /&gt;
&lt;br /&gt;
* Exhaust shader&lt;br /&gt;
&lt;br /&gt;
* Chrome Shader&lt;br /&gt;
&lt;br /&gt;
* Weather Radar&lt;br /&gt;
&lt;br /&gt;
* Menu Items have no effect&lt;br /&gt;
** Enhanced Runway Lights&lt;br /&gt;
** Bump Mapped Clouds&lt;br /&gt;
&lt;br /&gt;
== Miscelaneous OSG benefits ==&lt;br /&gt;
&lt;br /&gt;
Mathias: &amp;quot;I think that we should make use in the longer term of the Producers &lt;br /&gt;
capabilities for multiple view installations.&lt;br /&gt;
But not only multipipe installs will benefit from that. The Producer will also &lt;br /&gt;
help to get benefit from multicore SMP machines.&lt;br /&gt;
For that the following article is of huge interrest:&lt;br /&gt;
http://www.donburns.net/OSG/Articles/OSGMP/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Getting the PLIB Code ==&lt;br /&gt;
&lt;br /&gt;
Use the tag &amp;lt;tt&amp;gt;PRE_OSG_PLIB_20061029&amp;lt;/tt&amp;gt; for checking out the branch with the plib scenegraph.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3103</id>
		<title>OpenSceneGraph</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=OpenSceneGraph&amp;diff=3103"/>
		<updated>2006-11-11T05:05:48Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* Current Issues */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Getting a patched version of OpenSceneGraph ==&lt;br /&gt;
&lt;br /&gt;
Thanks to Mathias Fröhlich, we can use an updated OpenSceneGraph version that &lt;br /&gt;
contains 3 additional patches.&lt;br /&gt;
* most important an updated ac3d loader - that is our most used one ...&lt;br /&gt;
* a fix to the RGB Loader, which is already in OpenSceneGraph-CVS&lt;br /&gt;
* a small backport of OpenSceneGraph-CVS doing the right OpenGL version checks ...&lt;br /&gt;
&lt;br /&gt;
You can find that tarball at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061108/OSG_OP_OT-1.2-Flightgear.tar.gz&lt;br /&gt;
&lt;br /&gt;
Diff can be found at:&lt;br /&gt;
ftp://ftp.uni-duisburg.de/FlightGear/Misc_maf/OpenSceneGraph-20061108/OSG_OP_OT-1.2-Flightgear.diff&lt;br /&gt;
&lt;br /&gt;
Mathias is working on getting the remaining patch upstream ...&lt;br /&gt;
&lt;br /&gt;
And the MSVC8 win32 build dependencies for OpenSceneGraph can be found at http://www.oflebbe.de/oflebbe/FlightGear. Look out for the link to 3rdParty.zip.&lt;br /&gt;
&lt;br /&gt;
== Compilation workaround ==&lt;br /&gt;
&lt;br /&gt;
FIXME&lt;br /&gt;
&lt;br /&gt;
Do not forget to run autogen.sh when updating sources.&lt;br /&gt;
&lt;br /&gt;
== Current Issues ==&lt;br /&gt;
&lt;br /&gt;
* OSG Rendering Performance is roughly up to a factor of 2 slower for some scenes. This seems to have more dramatic on the Windows MVC8 build. Rendering ist faster now...&lt;br /&gt;
&lt;br /&gt;
* some buildings are with day texture, and other with night texture. i'm landing onto Paris center and, with the external view, i rotate around the aircraft. the sun position is not fixed at the same time, left side of aircraft is on shadow, with another camera position, it's the right side. that can explain why some building are day textured, and some others night textured&lt;br /&gt;
&lt;br /&gt;
* Some scenes do not work: The view is black. The default scene c172p on KSFO is working, however. It seems to be a terrain/ground problem since it disappears by using the UFO. This is fixed now by the ground-cache fix in CVS (061107)'''&lt;br /&gt;
&lt;br /&gt;
* There are also missing ground tiles: For instance located between EDDF and Feldberg.&lt;br /&gt;
&lt;br /&gt;
* Rendering order of instruments / ... is wrong.&lt;br /&gt;
&lt;br /&gt;
* At least at the present season with &amp;quot;--timeofday=noon&amp;quot;, sitting at KSFO 28R, I look straight into the moon with FlightGear/PLIB, but the moon isn't there with FG/OSG&lt;br /&gt;
&lt;br /&gt;
* In the external view(s) the HUD position is shifted to the left&lt;br /&gt;
&lt;br /&gt;
* transparency issues:&lt;br /&gt;
&lt;br /&gt;
** runway lights shine through panel:&lt;br /&gt;
    &lt;br /&gt;
** runway lights shine through cloud layers in an awkward way:&lt;br /&gt;
   &lt;br /&gt;
** 2D-cloud layers flood into cockpit&lt;br /&gt;
    &lt;br /&gt;
** The prop of the C172 block the view on the waves of the carrier&lt;br /&gt;
&lt;br /&gt;
** The reflector gun sight on the Seahawk causes other transparent objects (carrier wake etc.) to disappear&lt;br /&gt;
&lt;br /&gt;
** A new overhead window in the C172 (inside out)&lt;br /&gt;
&lt;br /&gt;
* &amp;quot;Near clipping problem&amp;quot; (nearby objects are partially clipped at left and right window boarder, ie seats in C172 inside)&lt;br /&gt;
&lt;br /&gt;
* Some textures are to dark, runway for instance, c172 prop disk as well.&lt;br /&gt;
&lt;br /&gt;
* Runway lighting seems to have rendering artefacts on ATI Cards.&lt;br /&gt;
&lt;br /&gt;
* Enhanced runway lighting option in the drop-down menu seems to have no effect - light always appear enhanced.&lt;br /&gt;
&lt;br /&gt;
* compass working incorrectly&lt;br /&gt;
&lt;br /&gt;
* Aircraft issues&lt;br /&gt;
**  Hurricane/Spitfire/Seafire won't start. The starter spins continuously, but the engine won't fire.&lt;br /&gt;
&lt;br /&gt;
     '''Fixed: 061110''' &lt;br /&gt;
&lt;br /&gt;
With the Spit/Seafire I get&lt;br /&gt;
&lt;br /&gt;
Notice: Material::getDiffuse(FRONT_AND_BACK) called on material&lt;br /&gt;
        with separate FRONT and BACK diffuse colors.&lt;br /&gt;
&lt;br /&gt;
and a segfault;&lt;br /&gt;
&lt;br /&gt;
** A4F crashes FG, without any error message that I have found so far. ('''FIXED''' a4/Models/a4-blue.ac 1.18 groups are not supposed to have vertices)&lt;br /&gt;
**    Hunter and Seahawk have lost their exhausts (of course). &lt;br /&gt;
**     The Engage Launch-bar command (L) is broken.&lt;br /&gt;
**     The Mixture control (M/m) seems to be broken. &lt;br /&gt;
&lt;br /&gt;
* Sky/Ephemeris &lt;br /&gt;
** Planets visible near the sun at noon&lt;br /&gt;
&lt;br /&gt;
* Clickable Hotspots &lt;br /&gt;
** Not visible at night&lt;br /&gt;
&lt;br /&gt;
* C172p cockpit seems to be scaled depending on the size of the window. This is most obvious when I change the FOV to its max (120) using the 'X' key. E.g. when I resize FG's window so that its width is much larger than its height (say, 1024x100), instruments all become a fat oval shape. Then if I resize the window the other way (say 100x910), instruments become narrower. (20061111 pigeon)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[List of 'compatible' aircrafts]] TO BE CONTINUED&lt;br /&gt;
&lt;br /&gt;
== Missing Features == &lt;br /&gt;
&lt;br /&gt;
* 3D-billboard objects are not displayed right now (ie trees or radio masts)&lt;br /&gt;
&lt;br /&gt;
* 3D clouds&lt;br /&gt;
&lt;br /&gt;
* Rendering of some scenes is not perfect.&lt;br /&gt;
&lt;br /&gt;
* Shadows&lt;br /&gt;
&lt;br /&gt;
* Exhaust shader&lt;br /&gt;
&lt;br /&gt;
* Chrome Shader&lt;br /&gt;
&lt;br /&gt;
* Weather Radar&lt;br /&gt;
&lt;br /&gt;
== Miscelaneous OSG benefits ==&lt;br /&gt;
&lt;br /&gt;
Mathias: &amp;quot;I think that we should make use in the longer term of the Producers &lt;br /&gt;
capabilities for multiple view installations.&lt;br /&gt;
But not only multipipe installs will benefit from that. The Producer will also &lt;br /&gt;
help to get benefit from multicore SMP machines.&lt;br /&gt;
For that the following article is of huge interrest:&lt;br /&gt;
http://www.donburns.net/OSG/Articles/OSGMP/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Getting the PLIB Code ==&lt;br /&gt;
&lt;br /&gt;
Use the tag &amp;lt;tt&amp;gt;PRE_OSG_PLIB_20061029&amp;lt;/tt&amp;gt; for checking out the branch with the plib scenegraph.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2623</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2623"/>
		<updated>2006-07-01T05:46:10Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -D plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ldd /usr/bin/aplay&lt;br /&gt;
linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
/lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(alsa))&lt;br /&gt;
(define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(esd))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(arts))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esddsp festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
(Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aoss TeamSpeak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ #~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
Usually you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pcm.duplex {&lt;br /&gt;
    type asym&lt;br /&gt;
    playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
    capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pcm.!default {&lt;br /&gt;
    type plug&lt;br /&gt;
    slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins.&lt;br /&gt;
&lt;br /&gt;
With FlightGear/OpenAL, however, I'm not sure what the issue is, but you may still need to specify &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;, which is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(alsa))&lt;br /&gt;
(define alsa-out-device &amp;quot;plug:duplex&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2375</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2375"/>
		<updated>2006-06-17T11:03:54Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* The concept */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -D plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ldd /usr/bin/aplay&lt;br /&gt;
linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
/lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(alsa))&lt;br /&gt;
(define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(esd))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(arts))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esddsp festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
(Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aoss TeamSpeak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ #~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
Usually you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pcm.duplex {&lt;br /&gt;
    type asym&lt;br /&gt;
    playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
    capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pcm.!default {&lt;br /&gt;
    type plug&lt;br /&gt;
    slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2374</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2374"/>
		<updated>2006-06-17T11:00:47Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D hw:0,0 test.wav&lt;br /&gt;
aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ cat /proc/asound/pcm &lt;br /&gt;
00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ ldd /usr/bin/aplay&lt;br /&gt;
linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
/lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(alsa))&lt;br /&gt;
(define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(esd))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(define devices '(arts))&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esd -d plug:dmix&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ esddsp festival --server&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
(Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aoss TeamSpeak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ #~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
Usually you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
pcm.duplex {&lt;br /&gt;
    type asym&lt;br /&gt;
    playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
    capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
pcm.!default {&lt;br /&gt;
    type plug&lt;br /&gt;
    slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
$ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
$ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2373</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2373"/>
		<updated>2006-06-17T10:48:13Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* ~/.asoundrc */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
    aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
    00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
    00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
    00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
    00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
    01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
    00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
    00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
    $ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ #~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
Usually you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2372</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2372"/>
		<updated>2006-06-17T10:47:21Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
    aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
    00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
    00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
    00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
    00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
    01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
    00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
    00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
    $ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ #~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2371</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2371"/>
		<updated>2006-06-17T10:46:09Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* ESD */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
    aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
    00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
    00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
    00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
    00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
    01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
    00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
    00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
Test your festival server by:&lt;br /&gt;
&lt;br /&gt;
    $ echo '(SayText &amp;quot;Hello&amp;quot;)' | festival_client&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ ~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2370</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2370"/>
		<updated>2006-06-17T09:12:19Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Audio mixing what? ==&lt;br /&gt;
&lt;br /&gt;
One of the most common issues with soundcard and Linux is when you can only have one application playing sound at a time on some systems. This happens when the soundcard itself does not do audio mixing (i.e. hardware mixing).&lt;br /&gt;
&lt;br /&gt;
Audio mixing allows multiple audio (PCM) streams to be &amp;quot;mixed&amp;quot; together and to be played at the same time. It is generally better and more efficient for a soundcard, if available, to do audio mixing in the hardware.&lt;br /&gt;
&lt;br /&gt;
Software audio mixing is useful when you have a soundcard not capable of doing hardware mixing. Under Linux, software mixing can be done by ALSA's &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin, or by userspace applications, like ESD and ARTS. Software uses your CPU to do the work and mixes multiple audio streams into one, before passing the audio data onto your soundcard for playback.&lt;br /&gt;
&lt;br /&gt;
On Windows, software mixing is enabled by default transparently. Because of this, most people would have no idea about the capability of their sound cards in the Windows world. This is debatable whether this is good or bad, and is out of scope of this article.&lt;br /&gt;
&lt;br /&gt;
With ALSA, an easy to test whether your soundcard supports hardware mixing or not would be running this following twice, say in two different terminals:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
&lt;br /&gt;
This tells &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, the ALSA audio player, to play the file &amp;lt;code&amp;gt;test.wav&amp;lt;/code&amp;gt; using the first sound hardware directly, without using any plugin or any software mixing. For a soundcard without hardware mixing support, the second &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; would fail, and might look like this:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D hw:0,0 test.wav&lt;br /&gt;
    aplay: main:547: audio open error: Device or resource busy&lt;br /&gt;
&lt;br /&gt;
You could also find out from ALSA's driver info, by doing:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1&lt;br /&gt;
    00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1&lt;br /&gt;
    00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1&lt;br /&gt;
    00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1&lt;br /&gt;
    00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1&lt;br /&gt;
    01-00: Intel ICH - Modem : Intel 82801DB-ICH4 Modem - Modem : playback 1 : capture 1&lt;br /&gt;
&lt;br /&gt;
Notice the first line, &amp;quot;&amp;lt;code&amp;gt;playback 1&amp;lt;/code&amp;gt;&amp;quot;, indicating the device only supports one PCM audio playback at any time.&lt;br /&gt;
&lt;br /&gt;
With a soundcard that supports hardware audio mixing, the same check looks like this:&lt;br /&gt;
&lt;br /&gt;
    $ cat /proc/asound/pcm &lt;br /&gt;
    00-00: emu10k1 : EMU10K1 : playback 32 : capture 1&lt;br /&gt;
    00-01: emu10k1 mic : EMU10K1 MIC : capture 1&lt;br /&gt;
    00-02: emu10k1 efx : EMU10K1 EFX : playback 8 : capture 1&lt;br /&gt;
&lt;br /&gt;
As you can see, the first line suggests this device supports 32 simultaneous PCM audio playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ ~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2369</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2369"/>
		<updated>2006-06-17T06:00:08Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* ~/.asoundrc */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ ~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
So with this configuration, you do not have to specify which ALSA device applications should use. As long as the application uses ALSA, it will be using the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugins. (FlightGear/OpenAL for example, you could leave out the &amp;lt;code&amp;gt;alsa-out-device&amp;lt;/code&amp;gt; in the &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2368</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2368"/>
		<updated>2006-06-17T05:54:45Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ ~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;&amp;lt;code&amp;gt;plug:duplex&amp;lt;/code&amp;gt;&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. You need to restart &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; after making changes to &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2367</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2367"/>
		<updated>2006-06-17T05:50:18Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* FlightGear */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. However you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ ~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;plug:duplex&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2366</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2366"/>
		<updated>2006-06-17T05:46:51Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    $ aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    $ artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. Though, you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    $ festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    $ esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt;. It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;aoss&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    $ aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;arts&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You have to run &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt;, enabling full-duplex. So:&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&lt;br /&gt;
You'll need this [[ ~/.asoundrc ]] as well.&lt;br /&gt;
&lt;br /&gt;
Then you have you run TeamSpeak.bin, instead of TeamSpeak, because &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; can only handle binary. You will also need to have LD_LIBRARY_PATH set to where TeamSpeak is installed. For example, if you have TeamSpeak installed at /opt/TeamSpeak/, then you should run:&lt;br /&gt;
&lt;br /&gt;
    $ LD_LIBRARY_PATH=/opt/TeamSpeak artsdsp /opt/TeamSpeak.bin&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you shouldn't need a custom ALSA configuration. But just in case, here is a simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; to get you started:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;plug:duplex&amp;quot; as the audio device for all applications, for instance:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    $ aplay -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
    $ esd -d plug:duplex&lt;br /&gt;
&lt;br /&gt;
    $ artsd -d -D plug:duplex&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
(TODO: Anyone who uses GNOME or KDE could add more descriptions here, thanks)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2365</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2365"/>
		<updated>2006-06-17T05:09:17Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* The concept */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use the ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback, and sometimes also the &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin for audio recording.&lt;br /&gt;
&lt;br /&gt;
According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. Though, you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you do not need to change any ALSA configuration. But just in case things don't work, you could try this very simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;plug:duplex&amp;quot; as the audio device for ALSA, for instance:&lt;br /&gt;
&lt;br /&gt;
    aplay -D plug:duplex test.wav&lt;br /&gt;
    arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2364</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2364"/>
		<updated>2006-06-17T05:06:41Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (&amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. Though, you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== ~/.asoundrc ==&lt;br /&gt;
&lt;br /&gt;
With the above setup, you do not need to change any ALSA configuration. But just in case things don't work, you could try this very simple &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the same as specifying &amp;quot;plug:duplex&amp;quot; as the audio device for ALSA, for instance:&lt;br /&gt;
&lt;br /&gt;
    aplay -D plug:duplex test.wav&lt;br /&gt;
    arecord -D plug:duplex test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GNOME and KDE ==&lt;br /&gt;
&lt;br /&gt;
If you're using GNOME or KDE, you will probably have &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; running already. In this case, you may also want to try this [[ #~/.asoundrc ]], which set &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; as the default to use for ALSA. Make sure your &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; is using ALSA, too.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* Try this [[ #~/.asoundrc ]]&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2363</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2363"/>
		<updated>2006-06-17T02:33:56Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* When things don't work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. Though, you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* Try the following &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix (even if you're not using Gentoo). It's a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2362</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2362"/>
		<updated>2006-06-17T02:31:31Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* FlightGear to use ALSA */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL supports ALSA, ESD and ARTS. Though, you have to make sure your OpenAL is built with the audio support you need. Run &amp;lt;code&amp;gt;configure --help&amp;lt;/code&amp;gt; if you are building your own OpenAL.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use ESD:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(esd))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And to get OpenAL to use ARTS:&lt;br /&gt;
&lt;br /&gt;
    (define devices '(arts))&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* Try the following &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2361</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2361"/>
		<updated>2006-06-17T02:28:06Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* Try the following &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* See http://gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix a pretty detailed HOWTO with ALSA audio including &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;dsnoop&amp;lt;/code&amp;gt; configurations.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2360</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2360"/>
		<updated>2006-06-17T02:26:14Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* When things don't work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
* Try the following &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2359</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2359"/>
		<updated>2006-06-17T02:17:54Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* When things don't work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
* Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Try the following &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
    pcm.duplex {&lt;br /&gt;
        type asym&lt;br /&gt;
        playback.pcm &amp;quot;dmix&amp;quot;&lt;br /&gt;
        capture.pcm &amp;quot;dsnoop&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    pcm.!default {&lt;br /&gt;
        type plug&lt;br /&gt;
        slave.pcm &amp;quot;duplex&amp;quot;&lt;br /&gt;
    }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2358</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2358"/>
		<updated>2006-06-17T01:52:48Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* When things don't work */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;br /&gt;
&lt;br /&gt;
Any other thing to try is to temporarily rename or move away your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;, and then test everything again.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2357</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2357"/>
		<updated>2006-06-17T01:50:12Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Prerequisites ==&lt;br /&gt;
&lt;br /&gt;
This article assumes you have a basic understanding and knowledge of Linux. For instance:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; refers to your HOME directory. If your user name is &amp;lt;code&amp;gt;blah&amp;lt;/code&amp;gt;, then &amp;lt;code&amp;gt;~/&amp;lt;/code&amp;gt; normally would be &amp;lt;code&amp;gt;/home/blah/&amp;lt;/code&amp;gt;. And so &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt; would mean &amp;lt;code&amp;gt;/home/blah/.asoundrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* Files with names starting with a dot (&amp;quot;.&amp;quot;) are normally considered as hidden files. If you're using some sort of file manager application, remember to turn on or enable showing these hidden files.&lt;br /&gt;
&lt;br /&gt;
* If a &amp;quot;dot rc&amp;quot; file (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;.openalrc&amp;lt;/code&amp;gt;) does not exist, simply creates it.&lt;br /&gt;
&lt;br /&gt;
This article assumes you have ALSA setup and working with your soundcard(s).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
It's a good idea to run this to test if your &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; works.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;, with minor issues. Sometimes it gets stuck on exit, for example.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== When things don't work ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; honours your ALSA configurations, and hence your &amp;lt;code&amp;gt;~/.asoundrc&amp;lt;/code&amp;gt;. You want to make sure it is correct. Use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;arecord&amp;lt;/code&amp;gt; to test your setup.&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Main_Page&amp;diff=2356</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Main_Page&amp;diff=2356"/>
		<updated>2006-06-17T00:55:12Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: Added link to Linux_software_audio_mixing_with_FlightGear&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;__NOTOC__&lt;br /&gt;
__NOEDITSECTION__&lt;br /&gt;
'''FlightGear''' Flight Simulator project is an open-source, multi-platform, cooperative flight simulator development project. Source code for the entire project is available ([http://cvs.flightgear.org/cgi-bin/viewcvs/viewcvs.cgi/?cvsroot=FlightGear-0.9#dirlist CVS repository]) and licensed under the [http://www.gnu.org/copyleft/gpl.html GNU General Public License]. &lt;br /&gt;
&lt;br /&gt;
The goal of the '''FlightGear''' project is to create a sophisticated flight simulator framework for use in research or academic environments, for the development and pursuit of other interesting flight simulation ideas, and as an end-user application. We are developing a sophisticated, open simulation framework that can be expanded and improved upon by anyone interested in [[Volunteer|contributing]]. &lt;br /&gt;
&lt;br /&gt;
There are many exciting possibilities for an open, free flight sim. We hope that this project will be interesting and useful to many people in many areas.&lt;br /&gt;
&lt;br /&gt;
'''FlightGear''' comes with a set of illustrated documentation, notably&lt;br /&gt;
&amp;quot;The Manual&amp;quot;, which is available as&lt;br /&gt;
[http://www.flightgear.org/Docs/getstart/getstart.pdf PDF] and&lt;br /&gt;
[http://www.flightgear.org/Docs/getstart/getstart.html HTML]. If you&lt;br /&gt;
prefer to follow the 'bleeding edge' set of FlightGear instructions,&lt;br /&gt;
then the following articles are likely to make you happy. You will&lt;br /&gt;
notice that parts of this Wiki duplicate information that's alread&lt;br /&gt;
present in &amp;quot;The Manual&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
{|cellspacing=&amp;quot;10&amp;quot;&lt;br /&gt;
| width=&amp;quot;50%&amp;quot;|&lt;br /&gt;
== User Documentation ==&lt;br /&gt;
&lt;br /&gt;
=== Getting Started ===&lt;br /&gt;
* [[ New to FlightGear ]]&lt;br /&gt;
* [[ FAQ ]]&lt;br /&gt;
* [[ Hardware Recommendations ]]&lt;br /&gt;
* [[ Recommended Software ]]&lt;br /&gt;
* [[ Troubleshooting Problems ]]&lt;br /&gt;
* [[ Volunteer ]]&lt;br /&gt;
* [[ Real Life Experience ]]&lt;br /&gt;
&lt;br /&gt;
=== Using Flightgear ===&lt;br /&gt;
* [[ Aircraft ]]&lt;br /&gt;
* [[ Suggested Flights ]]&lt;br /&gt;
* [[ Starting in the Air ]]&lt;br /&gt;
* [[ Multiplayer Howto ]]&lt;br /&gt;
* [[ Carrier Howto ]]&lt;br /&gt;
* [[ Air-Air Refueling Howto ]]&lt;br /&gt;
* [[ AI Systems ]]&lt;br /&gt;
* [[ Installing Scenery ]]&lt;br /&gt;
* [[ Improving Framerates ]]&lt;br /&gt;
* [[ Instant Replay ]]&lt;br /&gt;
* [[ Command Line Parameters ]]&lt;br /&gt;
* [[ Preset Properties ]]&lt;br /&gt;
* [[ Realism ]]&lt;br /&gt;
* [[ Soaring ]]&lt;br /&gt;
* [[ Linux software audio mixing with FlightGear ]]&lt;br /&gt;
&lt;br /&gt;
=== Flying Resources ===&lt;br /&gt;
* [[ Definitions Acronyms ]]&lt;br /&gt;
* [[ Getting IFR Charts ]]&lt;br /&gt;
* [[ Understanding Altitude ]]&lt;br /&gt;
* [[ Understanding Navigation ]]&lt;br /&gt;
* [[ Understanding Propeller Torque and P-Factor ]]&lt;br /&gt;
* [[ Understanding Aerodynamics ]]&lt;br /&gt;
* [[ Communications ]]&lt;br /&gt;
* [[ Weather ]]&lt;br /&gt;
* [[ Avionics and Instruments ]] &lt;br /&gt;
&lt;br /&gt;
| width=&amp;quot;50%&amp;quot; valign=&amp;quot;top&amp;quot; |&lt;br /&gt;
== Developer Documentation ==&lt;br /&gt;
&lt;br /&gt;
=== Coding Guidelines ===&lt;br /&gt;
* [[ Building Flightgear ]]&lt;br /&gt;
* [[ Building Terragear ]]&lt;br /&gt;
* [[ Submitting Patches ]] &lt;br /&gt;
* [[ Janitors ]] &lt;br /&gt;
* [[ Development Resources ]]&lt;br /&gt;
* [[ Extension Support ]]&lt;br /&gt;
&lt;br /&gt;
=== Code Internals ===&lt;br /&gt;
* [[ Property Tree ]]&lt;br /&gt;
* [[ Subsystems ]] &lt;br /&gt;
* [[ Commands ]] &lt;br /&gt;
* [[ FDM API ]]&lt;br /&gt;
* [[ Nasal scripting language ]]&lt;br /&gt;
&lt;br /&gt;
=== Modeling ===&lt;br /&gt;
* [[ Modeling - Getting Started ]]&lt;br /&gt;
* [[ Model Import and Export ]]&lt;br /&gt;
* [[ Modeling Resources ]]&lt;br /&gt;
* [[ Aircraft Information Resources ]]&lt;br /&gt;
&lt;br /&gt;
=== Todo ===&lt;br /&gt;
* [[ Bugs ]]&lt;br /&gt;
* [[ FGFS Todo ]]&lt;br /&gt;
* [[ Aircraft Todo ]]&lt;br /&gt;
* [[ Goals ]]&lt;br /&gt;
* [[ Feature Requests / Proposals / Ideas ]]&lt;br /&gt;
&lt;br /&gt;
=== Miscellaneous ===&lt;br /&gt;
* [[ Glass Cockpit Projects ]]&lt;br /&gt;
* [[ Tutorial Resources ]]&lt;br /&gt;
* [[ Copyright Inquiry ]]&lt;br /&gt;
* [http://www.cafepress.com/fgfs_gear FlightGear - Gear] &lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2355</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2355"/>
		<updated>2006-06-17T00:50:39Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* TeamSpeak */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2354</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2354"/>
		<updated>2006-06-17T00:50:10Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* The concept */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2353</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2353"/>
		<updated>2006-06-17T00:49:37Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* TeamSpeak */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works with &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; as well, but there are a few tricks you have to do, and so it's not covered here at the moment.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2352</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2352"/>
		<updated>2006-06-17T00:48:18Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* TeamSpeak */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2351</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2351"/>
		<updated>2006-06-17T00:46:05Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with other audio applications, such as Festival for text-to-speech and running TeamSpeak at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;. It also works with &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; (so you have to run artsd as well).&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or, using artsd, do:&lt;br /&gt;
&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
where the &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; is to enable full-duplex operations.&lt;br /&gt;
&lt;br /&gt;
Then you run TeamSpeak:&lt;br /&gt;
&lt;br /&gt;
    artsdsp TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_FG_Festival_TS&amp;diff=2350</id>
		<title>Linux FG Festival TS</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_FG_Festival_TS&amp;diff=2350"/>
		<updated>2006-06-17T00:43:08Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: Linux FG Festival TS moved to Linux software audio mixing with FlightGear&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[Linux software audio mixing with FlightGear]]&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2349</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2349"/>
		<updated>2006-06-17T00:43:08Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: Linux FG Festival TS moved to Linux software audio mixing with FlightGear&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with Festival for text-to-speech and running TeamSpeak, (and possible any other applications that use audio) at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;. It also works with &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; (so you have to run artsd as well).&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or, using artsd, do:&lt;br /&gt;
&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
where the &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; is to enable full-duplex operations.&lt;br /&gt;
&lt;br /&gt;
Then you run TeamSpeak:&lt;br /&gt;
&lt;br /&gt;
    artsdsp TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2348</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2348"/>
		<updated>2006-06-17T00:41:39Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* The concept */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with Festival for text-to-speech and running TeamSpeak, (and possible any other applications that use audio) at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;. It also works with &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; (so you have to run artsd as well).&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or, using artsd, do:&lt;br /&gt;
&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
where the &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; is to enable full-duplex operations.&lt;br /&gt;
&lt;br /&gt;
Then you run TeamSpeak:&lt;br /&gt;
&lt;br /&gt;
    artsdsp TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2347</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2347"/>
		<updated>2006-06-17T00:38:46Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: /* FlightGear + Festival + TeamSpeak with software audio mixing on Linux */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt;FlightGear + Festival + TeamSpeak with software audio mixing on Linux&amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with Festival for text-to-speech and running TeamSpeak, (and possible any other applications that use audio) at the same time, with ALSA software mixing (the &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin for PCM audio playback. According to ALSA, &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to touch any ALSA configuration file, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;lt;code&amp;gt;&amp;quot;plug:dmix&amp;quot;&amp;lt;/code&amp;gt;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; : A wrapper script to run any application to use ALSA OSS. This works using simply via &amp;lt;code&amp;gt;LD_PRELOAD&amp;lt;/code&amp;gt; to preload &amp;lt;code&amp;gt;libaoss.so&amp;lt;/code&amp;gt;. It *seems* to use &amp;lt;code&amp;gt;dmix&amp;lt;/code&amp;gt; if available automatically.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; : A software audio mixing daemon, typically shipped with GNOME. You can use its wrapper &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
; &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt; : Another software audio mixing daemon, typically shipped with KDE. You can use its wrapper &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; with other applications. You could run:&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
However, not all apps work with all these wrappers. For example, festival does not seem to work properly with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;artsd&amp;lt;/code&amp;gt;. If possible it's a good idea to try all three approaches to get an OSS application to do ALSA.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly. So if you have an OSS application which does audio recording (say TeamSpeak), &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt; will probably not work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== OSS? ALSA? ==&lt;br /&gt;
&lt;br /&gt;
So how do you tell whether an application uses OSS or ALSA? There are a few simple ways.&lt;br /&gt;
&lt;br /&gt;
Usually if an application uses the audio device via &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt; (or &amp;lt;code&amp;gt;/dev/dsp0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/dsp1&amp;lt;/code&amp;gt;, etc), then it is probably using OSS. With ALSA, you normally specify an audio device using a string, which might look something like &amp;quot;&amp;lt;code&amp;gt;hw:0,0&amp;lt;/code&amp;gt;&amp;quot; or &amp;quot;&amp;lt;code&amp;gt;plug:dmix&amp;lt;/code&amp;gt;&amp;quot;, or sometimes &amp;quot;&amp;lt;code&amp;gt;ALSA:default&amp;lt;/code&amp;gt;&amp;quot;, depending on the application itself.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;ldd&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;ldd&amp;lt;/code&amp;gt; prints what shared libraries an application depends on.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; again as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ ldd /usr/bin/aplay&lt;br /&gt;
    linux-gate.so.1 =&amp;gt;  (0xffffe000)&lt;br /&gt;
    libasound.so.2 =&amp;gt; /usr/lib/libasound.so.2 (0x40037000)&lt;br /&gt;
    libm.so.6 =&amp;gt; /lib/tls/libm.so.6 (0x400f9000)&lt;br /&gt;
    libdl.so.2 =&amp;gt; /lib/tls/libdl.so.2 (0x4011f000)&lt;br /&gt;
    libpthread.so.0 =&amp;gt; /lib/tls/libpthread.so.0 (0x40123000)&lt;br /&gt;
    libc.so.6 =&amp;gt; /lib/tls/libc.so.6 (0x40135000)&lt;br /&gt;
    /lib/ld-linux.so.2 (0x40000000)&lt;br /&gt;
&lt;br /&gt;
Note the &amp;lt;code&amp;gt;libasound.so.2&amp;lt;/code&amp;gt;, which is the ALSA library, which *possibly* means &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; *CAN* use ALSA. It does not have to, however. It's up to an application to use whatever audio support it wants to use. An example would be applications like &amp;lt;code&amp;gt;mplayer&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;xine&amp;lt;/code&amp;gt;, which can do audio playback using many different audio libraries/approaches (OSS, ALSA, ESD, ARTS, and more).&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;code&amp;gt;&amp;lt;b&amp;gt;strace&amp;lt;/b&amp;gt;&amp;lt;/code&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; is a rather powerful tool, which traces and prints system calls of a running application.&lt;br /&gt;
&lt;br /&gt;
Take &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt; as an example, you do:&lt;br /&gt;
&lt;br /&gt;
    $ strace -f -e open /usr/bin/mpg123 -q test.mp3&lt;br /&gt;
    open(&amp;quot;/etc/ld.so.cache&amp;quot;, O_RDONLY)      = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libm.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/lib/tls/libc.so.6&amp;quot;, O_RDONLY)    = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 3&lt;br /&gt;
    open(&amp;quot;test.mp3&amp;quot;, O_RDONLY)           = 3&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
    open(&amp;quot;/dev/dsp&amp;quot;, O_WRONLY)              = 4&lt;br /&gt;
&lt;br /&gt;
This shows all calls to the system call &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; of this running instance of &amp;lt;code&amp;gt;mpg123&amp;lt;/code&amp;gt;. As you can see it is opening &amp;lt;code&amp;gt;/dev/dsp&amp;lt;/code&amp;gt;, which hints it is using OSS.&lt;br /&gt;
&lt;br /&gt;
For an ALSA application, you will see a lot of &amp;lt;code&amp;gt;open()&amp;lt;/code&amp;gt; calls to devices like &amp;lt;code&amp;gt;/dev/snd/controlC0&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/aloadC2&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;/dev/snd/pcmC0D0p&amp;lt;/code&amp;gt;, etc. (Try &amp;lt;code&amp;gt;strace&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;!)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Festival to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
There are two ways to get Festival to use ALSA.&lt;br /&gt;
&lt;br /&gt;
=== ESD ===&lt;br /&gt;
&lt;br /&gt;
Festival supports a couple of audio method for playback, and one of them is ESD support. To have it use ESD by default, put this in your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Method 'esdaudio)&lt;br /&gt;
&lt;br /&gt;
And then run &amp;lt;code&amp;gt;festival&amp;lt;/code&amp;gt; as usual. So:&lt;br /&gt;
&lt;br /&gt;
    festival --server&lt;br /&gt;
&lt;br /&gt;
Of course, you'll have to make sure your ESD is running, for example:&lt;br /&gt;
&lt;br /&gt;
    esd -d plug:dmix&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If for some reasons this does not work, you could always try using &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, which means you would be running:&lt;br /&gt;
&lt;br /&gt;
    esddsp festival --server&lt;br /&gt;
&lt;br /&gt;
=== Using the &amp;lt;code&amp;gt;Audio_Command&amp;lt;/code&amp;gt; parameter ===&lt;br /&gt;
&lt;br /&gt;
You can configure festival to run another application for playing audio. In this case, we could use &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt; to help us. In your &amp;lt;code&amp;gt;~/.festivalrc&amp;lt;/code&amp;gt; put:&lt;br /&gt;
&lt;br /&gt;
    (Parameter.set 'Audio_Command &amp;quot;aplay -D plug:dmix -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set 'Audio_Method 'Audio_Command)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;$SR&amp;lt;/code&amp;gt; is the sampling rate, and &amp;lt;code&amp;gt;$FILE&amp;lt;/code&amp;gt; is the audio data file generated by festival for playback.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== TeamSpeak ==&lt;br /&gt;
&lt;br /&gt;
TeamSpeak works nicely with &amp;lt;code&amp;gt;aoss&amp;lt;/code&amp;gt;. It also works with &amp;lt;code&amp;gt;artsdsp&amp;lt;/code&amp;gt; (so you have to run artsd as well).&lt;br /&gt;
&lt;br /&gt;
It does not work with &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;esddsp&amp;lt;/code&amp;gt;, because &amp;lt;code&amp;gt;esd&amp;lt;/code&amp;gt; does not seem to handle recording properly.&lt;br /&gt;
&lt;br /&gt;
To run TeamSpeak, do:&lt;br /&gt;
&lt;br /&gt;
    aoss TeamSpeak&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
or, using artsd, do:&lt;br /&gt;
&lt;br /&gt;
    artsd -d -D plug:dmix&lt;br /&gt;
&lt;br /&gt;
where the &amp;lt;code&amp;gt;-d&amp;lt;/code&amp;gt; is to enable full-duplex operations.&lt;br /&gt;
&lt;br /&gt;
Then you run TeamSpeak:&lt;br /&gt;
&lt;br /&gt;
    artsdsp TeamSpeak&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
	<entry>
		<id>https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2344</id>
		<title>Linux software audio mixing with FlightGear</title>
		<link rel="alternate" type="text/html" href="https://wiki.flightgear.org/w/index.php?title=Linux_software_audio_mixing_with_FlightGear&amp;diff=2344"/>
		<updated>2006-06-16T13:55:38Z</updated>

		<summary type="html">&lt;p&gt;Pigeon: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= FlightGear + Festival + TeamSpeak with software audio mixing on Linux =&lt;br /&gt;
&lt;br /&gt;
This article describes, with a soundcard that does not do hardware mixing, how you can run FlightGear with Festival for text-to-speech and running TeamSpeak, (and possible any other applications that use audio) at the same time, with ALSA software mixing (the &amp;quot;dmix&amp;quot; plugin).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The concept ==&lt;br /&gt;
&lt;br /&gt;
It is simple. You want to get all the applications to use ALSA &amp;quot;dmix&amp;quot; plugin for PCM audio playback. According to ALSA, &amp;quot;dmix&amp;quot; plugin is enabled and used by default since ALSA 1.0.9rc2. Though it seems it does not work straight away for everyone.&lt;br /&gt;
&lt;br /&gt;
There are a lot of pages on the net with different customized ALSA configuration (e.g. &amp;lt;code&amp;gt;.asoundrc&amp;lt;/code&amp;gt;) to use &amp;quot;dmix&amp;quot; by default. This article's approach is NOT to use any global or per-user configuration file setup, but simply per-application setup.&lt;br /&gt;
&lt;br /&gt;
In general, for applications written with ALSA support, usually what you need is to get is to use the device &amp;quot;plug:dmix&amp;quot;. For example, with the ALSA command line player &amp;lt;code&amp;gt;aplay&amp;lt;/code&amp;gt;, you run:&lt;br /&gt;
&lt;br /&gt;
    aplay -D &amp;quot;plug:dmix&amp;quot; test.wav&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For applications which does not have ALSA support (i.e. using OSS), you have a few choices:&lt;br /&gt;
&lt;br /&gt;
; aoss : A wrapper script to run any application to use ALSA OSS.&lt;br /&gt;
; esd : A software audio mixing daemon, typically shipped with GNOME.&lt;br /&gt;
; artsd : Another software audio mixing daemon, typically shipped with KDE.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== FlightGear to use ALSA ==&lt;br /&gt;
&lt;br /&gt;
FlightGear uses OpenAL (via SimGear) for audio playback, and OpenAL has ALSA support.&lt;br /&gt;
&lt;br /&gt;
To get OpenAL to use a particular ALSA device, put these in your &amp;lt;code&amp;gt;~/.openalrc&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    (define devices '(alsa))&lt;br /&gt;
    (define alsa-out-device &amp;quot;plug:dmix&amp;quot;)&lt;/div&gt;</summary>
		<author><name>Pigeon</name></author>
	</entry>
</feed>