<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
        <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <meta content="HOWTO ALSA Complete (includes dmix),ALSA,HOWTO ALSA,Krec,Sound card,HOWTO ALSA Complete (includes dmix),High,Jbdubbs,Sametoms,Chuck theobald,Ep98">


                <title>HOWTO ALSA Complete (includes dmix) - Gentoo Linux Wiki</title>
                <style type="text/css">/**/</style>
                
                <!--[if lt IE 5.5000]><style type="text/css">@import "/skins/monobook/IE50Fixes.css";</style><![endif]-->
                <!--[if IE 5.5000]><style type="text/css">@import "/skins/monobook/IE55Fixes.css";</style><![endif]-->
                <!--[if IE 6]><style type="text/css">@import "/skins/monobook/IE60Fixes.css";</style><![endif]-->
                <!--[if IE 7]><style type="text/css">@import "/skins/monobook/IE70Fixes.css?1";</style><![endif]-->
                <!--[if lt IE 7]><script type="text/javascript" src="/skins/common/IEFixes.js"></script>
                <meta http-equiv="imagetoolbar" content="no" /><![endif]-->
                
                
                                
                
                
                <style type="text/css">/**/</style>
                <!-- Head Scripts -->
                

                
        </head>
<body>
        <div id="globalWrapper">
                <div id="column-content">

<div style="width:160px; margin-top: 35px; padding: 0px; float: right; right:0; positon:absolute; height: 1px;">


</div>

        <div id="content" style="margin-right: 163px;">
                <a name="top" id="top"></a>
                                <h1 class="firstHeading">HOWTO ALSA Complete (includes dmix)</h1>
                <div id="bodyContent">
                        <h3 id="siteSub">From Gentoo Linux Wiki</h3>
                        <div id="contentSub">(Redirected from <a href="/index.php?title=HOWTO_ALSA_sound_mixer_aka_dmix&amp;redirect=no" title="HOWTO ALSA sound mixer aka dmix">HOWTO ALSA sound mixer aka dmix</a>)</div>
                                                                        <div id="jump-to-nav">Jump to: <a href="#column-one">navigation</a>, <a href="#searchInput">search</a></div>                        <!-- start content -->
                        <table>
<tr>
<td align="left"><a href="/Image:Merge-arrows.gif" class="image" title="Merge-arrows.gif"><img src="/images/8/8b/Merge-arrows.gif" alt="Merge-arrows.gif" width="50" height="20"></a>
</td><td align="center">It has been suggested that this article be <b>Merged</b> into one article with <a href="/HOWTO_ALSA" title="HOWTO ALSA">HOWTO ALSA</a> &nbsp;&nbsp;&nbsp;(<a href="/Talk:HOWTO_ALSA_Complete_%28includes_dmix%29" title="Talk:HOWTO ALSA Complete (includes dmix)"><i>Discuss</i></a>)
</td></tr></table>
<table cellpadding="3" cellspacing="0" style="margin-top: 0px; margin-bottom: 1px; border:1px solid Grey; border-left:0; border-right:0; width: 100%;">
<tr>
<td style="border-bottom:1px solid Grey; background:#efefef;"><center><small>This article is part  of the <b><a href="/Index:HOWTO" title="Index:HOWTO">HOWTO</a></b> series.</small></center>
</td></tr>
<tr>
<td align="center"><a href="/Index:HOWTO#Installation_Methods" title="Index:HOWTO">Installation</a> <b>&#8226;</b> <a href="/Index:HOWTO#Kernel_.26_Hardware" title="Index:HOWTO">Kernel &amp; Hardware</a> <b>&#8226;</b> <a href="/Index:HOWTO#Networks_.26_Services" title="Index:HOWTO">Networks</a> <b>&#8226;</b> <a href="/Index:HOWTO#Portage" title="Index:HOWTO">Portage</a> <b>&#8226;</b> <a href="/Index:HOWTO#Software" title="Index:HOWTO">Software</a> <b>&#8226;</b> <a href="/Index:HOWTO#System_Related" title="Index:HOWTO">System</a> <b>&#8226;</b> <a href="/Index:HOWTO#X_Server" title="Index:HOWTO">X Server</a> <b>&#8226;</b> <a href="/Index:HOWTO#Gaming" title="Index:HOWTO">Gaming</a> <b>&#8226;</b> <a href="/Index:HOWTO#Specific_to_non-x86_architecture" title="Index:HOWTO">Non-x86</a> <b>&#8226;</b> <a href="/Index:HOWTO#Emulators" title="Index:HOWTO">Emulators</a> <b>&#8226;</b> <a href="/Index:HOWTO#Miscellaneous" title="Index:HOWTO">Misc</a>
</td></tr></table>
<table id="toc" class="toc"><tr><td><div id="toctitle"><h2>Contents</h2></div>
<ul>
<li class="toclevel-1"><a href="#Introduction"><span class="tocnumber">1</span> <span class="toctext">Introduction</span></a></li>
<li class="toclevel-1"><a href="#Setting_up_ALSA"><span class="tocnumber">2</span> <span class="toctext">Setting up ALSA</span></a>
<ul>
<li class="toclevel-2"><a href="#Identify_Your_Card"><span class="tocnumber">2.1</span> <span class="toctext">Identify Your Card</span></a></li>
<li class="toclevel-2"><a href="#Adjust_Your_USE_Flags"><span class="tocnumber">2.2</span> <span class="toctext">Adjust Your USE Flags</span></a></li>
<li class="toclevel-2"><a href="#Preparing_Kernel_2.4"><span class="tocnumber">2.3</span> <span class="toctext">Preparing Kernel 2.4</span></a></li>
<li class="toclevel-2"><a href="#Preparing_Kernel_2.6"><span class="tocnumber">2.4</span> <span class="toctext">Preparing Kernel 2.6</span></a>
<ul>
<li class="toclevel-3"><a href="#Building_Support_from_Kernel_Source"><span class="tocnumber">2.4.1</span> <span class="toctext">Building Support from Kernel Source</span></a></li>
<li class="toclevel-3"><a href="#Building_Support_from_alsa-driver_Package"><span class="tocnumber">2.4.2</span> <span class="toctext">Building Support from alsa-driver Package</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Installing_alsa-driver"><span class="tocnumber">2.5</span> <span class="toctext">Installing alsa-driver</span></a></li>
<li class="toclevel-2"><a href="#Post-Installation_Configuration"><span class="tocnumber">2.6</span> <span class="toctext">Post-Installation Configuration</span></a>
<ul>
<li class="toclevel-3"><a href="#Single_card_example"><span class="tocnumber">2.6.1</span> <span class="toctext">Single card example</span></a></li>
<li class="toclevel-3"><a href="#Multiple_cards"><span class="tocnumber">2.6.2</span> <span class="toctext">Multiple cards</span></a>
<ul>
<li class="toclevel-4"><a href="#Multiple_cards_with_the_same_module"><span class="tocnumber">2.6.2.1</span> <span class="toctext">Multiple cards with the same module</span></a></li>
</ul>
</li>
<li class="toclevel-3"><a href="#Start_alsa_automatically"><span class="tocnumber">2.6.3</span> <span class="toctext">Start alsa automatically</span></a></li>
<li class="toclevel-3"><a href="#User_Configuration"><span class="tocnumber">2.6.4</span> <span class="toctext">User Configuration</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Notes"><span class="tocnumber">2.7</span> <span class="toctext">Notes</span></a>
<ul>
<li class="toclevel-3"><a href="#Finding_your_ALSA_card_ID"><span class="tocnumber">2.7.1</span> <span class="toctext">Finding your ALSA card ID</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Known_Issues"><span class="tocnumber">2.8</span> <span class="toctext">Known Issues</span></a>
<ul>
<li class="toclevel-3"><a href="#Kernel_2.6.16"><span class="tocnumber">2.8.1</span> <span class="toctext">Kernel 2.6.16</span></a></li>
<li class="toclevel-3"><a href="#UDEV_089-r2"><span class="tocnumber">2.8.2</span> <span class="toctext">UDEV 089-r2</span></a></li>
<li class="toclevel-3"><a href="#No_Sound.2C_Mixers_Adjusted"><span class="tocnumber">2.8.3</span> <span class="toctext">No Sound, Mixers Adjusted</span></a></li>
<li class="toclevel-3"><a href="#No_Sound_or_very_silent_sound_with_noise"><span class="tocnumber">2.8.4</span> <span class="toctext">No Sound or very silent sound with noise</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#Credits"><span class="tocnumber">2.9</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Testing_Your_Installation"><span class="tocnumber">3</span> <span class="toctext">Testing Your Installation</span></a></li>
<li class="toclevel-1"><a href="#Intro_to_dmix"><span class="tocnumber">4</span> <span class="toctext">Intro to dmix</span></a>
<ul>
<li class="toclevel-2"><a href="#Test_dmix"><span class="tocnumber">4.1</span> <span class="toctext">Test dmix</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#dmix_Configuration_for_OSS_Emulation"><span class="tocnumber">5</span> <span class="toctext">dmix Configuration for OSS Emulation</span></a>
<ul>
<li class="toclevel-2"><a href="#Test_for_OSS_Emulation"><span class="tocnumber">5.1</span> <span class="toctext">Test for OSS Emulation</span></a></li>
<li class="toclevel-2"><a href="#Simple_Configuration"><span class="tocnumber">5.2</span> <span class="toctext">Simple Configuration</span></a></li>
<li class="toclevel-2"><a href="#Advanced_Configuration"><span class="tocnumber">5.3</span> <span class="toctext">Advanced Configuration</span></a></li>
<li class="toclevel-2"><a href="#Credits_2"><span class="tocnumber">5.4</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Software_Related_Configurations"><span class="tocnumber">6</span> <span class="toctext">Software Related Configurations</span></a>
<ul>
<li class="toclevel-2"><a href="#Configuring_aRts_and_KDE"><span class="tocnumber">6.1</span> <span class="toctext">Configuring aRts and KDE</span></a>
<ul>
<li class="toclevel-3"><a href="#aRts_Approach"><span class="tocnumber">6.1.1</span> <span class="toctext">aRts Approach</span></a></li>
<li class="toclevel-3"><a href="#ALSA_Approach"><span class="tocnumber">6.1.2</span> <span class="toctext">ALSA Approach</span></a></li>
<li class="toclevel-3"><a href="#ESD_.28esound.29_Approach"><span class="tocnumber">6.1.3</span> <span class="toctext">ESD (esound) Approach</span></a></li>
<li class="toclevel-3"><a href="#OSS_Emulation_Approach"><span class="tocnumber">6.1.4</span> <span class="toctext">OSS Emulation Approach</span></a>
<ul>
<li class="toclevel-4"><a href="#Credits_3"><span class="tocnumber">6.1.4.1</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-2"><a href="#Configuring_Gnome.2FeSound"><span class="tocnumber">6.2</span> <span class="toctext">Configuring Gnome/eSound</span></a></li>
<li class="toclevel-2"><a href="#pulseaudio"><span class="tocnumber">6.3</span> <span class="toctext">pulseaudio</span></a></li>
<li class="toclevel-2"><a href="#jack"><span class="tocnumber">6.4</span> <span class="toctext">jack</span></a>
<ul>
<li class="toclevel-3"><a href="#Alsa_and_jack"><span class="tocnumber">6.4.1</span> <span class="toctext">Alsa and jack</span></a></li>
<li class="toclevel-3"><a href="#oss_and_jack"><span class="tocnumber">6.4.2</span> <span class="toctext">oss and jack</span></a></li>
<li class="toclevel-3"><a href="#Note"><span class="tocnumber">6.4.3</span> <span class="toctext">Note</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#MPlayer"><span class="tocnumber">6.5</span> <span class="toctext">MPlayer</span></a>
<ul>
<li class="toclevel-3"><a href="#Credits_4"><span class="tocnumber">6.5.1</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#XMMS"><span class="tocnumber">6.6</span> <span class="toctext">XMMS</span></a></li>
<li class="toclevel-2"><a href="#GAIM"><span class="tocnumber">6.7</span> <span class="toctext">GAIM</span></a></li>
<li class="toclevel-2"><a href="#Firefox.2C_Mozilla.2C_RealPlayer.2C_Skype_.26_Co"><span class="tocnumber">6.8</span> <span class="toctext">Firefox, Mozilla, RealPlayer, Skype &amp; Co</span></a></li>
<li class="toclevel-2"><a href="#LICQ"><span class="tocnumber">6.9</span> <span class="toctext">LICQ</span></a></li>
<li class="toclevel-2"><a href="#SDL"><span class="tocnumber">6.10</span> <span class="toctext">SDL</span></a></li>
<li class="toclevel-2"><a href="#GStreamer"><span class="tocnumber">6.11</span> <span class="toctext">GStreamer</span></a></li>
<li class="toclevel-2"><a href="#MPD"><span class="tocnumber">6.12</span> <span class="toctext">MPD</span></a></li>
<li class="toclevel-2"><a href="#Xine_Engine"><span class="tocnumber">6.13</span> <span class="toctext">Xine Engine</span></a></li>
<li class="toclevel-2"><a href="#Amarok"><span class="tocnumber">6.14</span> <span class="toctext">Amarok</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Hardware_Configurations_-_.7E.2F.asoundrc_Files"><span class="tocnumber">7</span> <span class="toctext">Hardware Configurations - ~/.asoundrc Files</span></a>
<ul>
<li class="toclevel-2"><a href="#Simple_asoundrc_for_intel8x0"><span class="tocnumber">7.1</span> <span class="toctext">Simple asoundrc for intel8x0</span></a></li>
<li class="toclevel-2"><a href="#intel8x0_audio_card_integrated_on_nforce2_motherboards"><span class="tocnumber">7.2</span> <span class="toctext">intel8x0 audio card integrated on nforce2 motherboards</span></a>
<ul>
<li class="toclevel-3"><a href="#Credits_5"><span class="tocnumber">7.2.1</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#via82cxxx_onboard.2FICE1712_chip"><span class="tocnumber">7.3</span> <span class="toctext">via82cxxx onboard/ICE1712 chip</span></a>
<ul>
<li class="toclevel-3"><a href="#Credits_6"><span class="tocnumber">7.3.1</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#cmedia_8738_and_Analog_Devices_AD1980"><span class="tocnumber">7.4</span> <span class="toctext">cmedia 8738 and Analog Devices AD1980</span></a>
<ul>
<li class="toclevel-3"><a href="#Credits_7"><span class="tocnumber">7.4.1</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
<li class="toclevel-2"><a href="#VIA_Envy24HT_.28ice1724.29_chip"><span class="tocnumber">7.5</span> <span class="toctext">VIA Envy24HT (ice1724) chip</span></a>
<ul>
<li class="toclevel-3"><a href="#Credits_8"><span class="tocnumber">7.5.1</span> <span class="toctext">Credits</span></a></li>
</ul>
</li>
</ul>
</li>
<li class="toclevel-1"><a href="#Troubleshooting"><span class="tocnumber">8</span> <span class="toctext">Troubleshooting</span></a>
<ul>
<li class="toclevel-2"><a href="#Creative_X-Fi_soundcards"><span class="tocnumber">8.1</span> <span class="toctext">Creative X-Fi soundcards</span></a></li>
<li class="toclevel-2"><a href="#Alsa_record_sound"><span class="tocnumber">8.2</span> <span class="toctext">Alsa record sound</span></a></li>
<li class="toclevel-2"><a href="#Alsa_.2B_dmix_.2B_microphone"><span class="tocnumber">8.3</span> <span class="toctext">Alsa + dmix + microphone</span></a></li>
<li class="toclevel-2"><a href="#XMMS_in_KDE"><span class="tocnumber">8.4</span> <span class="toctext">XMMS in KDE</span></a></li>
<li class="toclevel-2"><a href="#Errors_inserting_modules"><span class="tocnumber">8.5</span> <span class="toctext">Errors inserting modules</span></a></li>
<li class="toclevel-2"><a href="#Another_Solution"><span class="tocnumber">8.6</span> <span class="toctext">Another Solution</span></a></li>
<li class="toclevel-2"><a href="#Problems_with_32-bit_dmix_on_AMD64"><span class="tocnumber">8.7</span> <span class="toctext">Problems with 32-bit dmix on AMD64</span></a></li>
</ul>
</li>
<li class="toclevel-1"><a href="#Feedback"><span class="tocnumber">9</span> <span class="toctext">Feedback</span></a></li>
</ul>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=1" title="Edit section: Introduction">edit</a>]</div><a name="Introduction"></a><h1>Introduction</h1>
<p>This guide will explain how to set up both <a href="/ALSA" title="ALSA">ALSA</a> and one of its plugins, "dmix". Dmix is only required if your <a href="/index.php?title=Sound_card&amp;action=edit" class="new" title="Sound card">sound card</a> seems unable to play more than one sound simultaneously, e.g. beeping to indicate a new email message whilst playing an mp3.
</p><p>Dmix performs the audio channel mixing in software, adding a drain on the main CPU. It is generally better for hardware (the sound card) to perform the mixing, if it is capable.
</p><p>Please note that as of <a href="http://gentoo-portage.com/Search?search=media-libs/alsa-lib" class="extiw" title="ebuild:media-libs/alsa-lib">alsa-lib-1.0.9</a> RC2, dmix should be automatically enabled for such cards that require it.  Only follow the directions below if you find that the default configuration is not sufficient.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=2" title="Edit section: Setting up ALSA">edit</a>]</div><a name="Setting_up_ALSA"></a><h1>Setting up ALSA</h1>
<p>The preparation differs depending on the kernel version.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=3" title="Edit section: Identify Your Card">edit</a>]</div><a name="Identify_Your_Card"></a><h2>Identify Your Card</h2>
<p>The following section is from the official Gentoo ALSA documentation:
</p><p>First find out what soundcard you have. An easy trick is to search for "audio" in the output of the lspci command. You can install it with <code>emerge pciutils</code>.
</p>
<pre>
  # lspci | grep -i audio
  Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 64).
</pre>
<p>Now go to the <a href="http://www.alsa-project.org/alsa-doc" title="http://www.alsa-project.org/alsa-doc">ALSA Soundcard Matrix</a> and search for your soundcard. In the above example you should go to the "VIA" manufacturer. You will receive a table with the known chipsets of that vendor. The chipset in the above example is "via82c686"; the "Details" link then informs me that the driver is called via82xx. This is all the information you need, so you can safely discard the rest of that document.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=4" title="Edit section: Adjust Your USE Flags">edit</a>]</div><a name="Adjust_Your_USE_Flags"></a><h2>Adjust Your USE Flags</h2>
<p>Your use flags need to reflect that you want ALSA as your primary sound server. We'll add two flags, so that both new and old programs can use sound support:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/make.conf</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
...
USE=&quot;alsa oss ...&quot;
...
</pre>
</div>
</td></tr></table>
<p>The ALSA flag will allow new applications to use the ALSA sound server directly.  OSS will build legacy support into new applications in case you need to use OSS emulation for some reason.  It will also build this support into programs for which there is no ALSA option.  Using the OSS flag is especially important for programs such as the Wine project, where ALSA drivers are not as mature.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=5" title="Edit section: Preparing Kernel 2.4">edit</a>]</div><a name="Preparing_Kernel_2.4"></a><h2>Preparing Kernel 2.4</h2>
<p>It's generally better to build ALSA with the kernel in 2.4 than to use the alsa-driver package.
</p>
<table width="75%" style="background-color: #faebd7; border: solid 4px #7070FF;">
<tr>
<td style="background-color: #7070FF; border: solid 1px #0000FF; color: #FFFFFF;"> <font size="-1">Linux Kernel Configuration: Kernel Configuration</font>
</td></tr>
<tr>
<td>
<pre>Loadable module support  ---&gt;
    [*] Enable loadable module support
</pre>
<pre>Device Drivers  ---&gt;
    Sound  ---&gt;
        &lt;M&gt; Sound card Support
            Advanced Linux Sound Architecture  ---&gt;
                &lt;M&gt; Advanced Linux Sound Architecture
            Open Sound System  ---&gt;
                &lt; &gt; Open Sound System (Deprecated)
</pre>
</td></tr></table>
<p>Be sure to include modules for OSS Emulation support as well as for each sound card in your system.
</p><p>When that is done, build the kernel and install.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=6" title="Edit section: Preparing Kernel 2.6">edit</a>]</div><a name="Preparing_Kernel_2.6"></a><h2>Preparing Kernel 2.6</h2>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=7" title="Edit section: Building Support from Kernel Source">edit</a>]</div><a name="Building_Support_from_Kernel_Source"></a><h3>Building Support from Kernel Source</h3>
<p>ALSA modules can be built from your kernel source.  Select the following options in your kernel configuration:
</p>
<table width="75%" style="background-color: #faebd7; border: solid 4px #7070FF;">
<tr>
<td style="background-color: #7070FF; border: solid 1px #0000FF; color: #FFFFFF;"> <font size="-1">Linux Kernel Configuration: Kernel Configuration (2.6.15 Example)</font>
</td></tr>
<tr>
<td>
<pre>Loadable module support  ---&gt;
    [*] Enable loadable module support
</pre>
<pre>Device Drivers  ---&gt;
    Character devices ---&gt;
        &lt;*&gt; Enhanced Real Time Clock Support
    Sound  ---&gt;
        &lt;M&gt; Sound card Support
            Advanced Linux Sound Architecture  ---&gt;
                &lt;M&gt; Advanced Linux Sound Architecture
                &lt;M&gt; Sequencer Support
                &lt;M&gt; OSS Mixer API
                &lt;M&gt; OSS PCM (digital audio) API
                &lt;M&gt; RTC Timer support
                [ ] Verbose printk
                [ ] Debug
                Generic Devices  ---&gt;
                PCI Devices  ---&gt;
                USB Devices  ---&gt;
            Open Sound System  ---&gt;
                &lt; &gt; Open Sound System (DEPRECATED)
</pre>
</td></tr></table>
<p>Remember to select your sound card drivers from the PCI or USB Devices sections.  Compile and install your kernel, then reboot to continue.
</p><p>You can now simply
</p>
<pre>
#emerge alsa-utils alsa-oss
</pre>
<p>and you're off to <a href="#Post-Installation_Configuration" title>post-installation configuration</a>, unless you need Jack or a rate sample converter (if so also emerge alsa-plugins). If you don't know what that it is, you probably won't need it (but remember jack and other plugins are in this separate package).
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=8" title="Edit section: Building Support from alsa-driver Package">edit</a>]</div><a name="Building_Support_from_alsa-driver_Package"></a><h3>Building Support from alsa-driver Package</h3>
<p>This option builds sound support into the kernel, but does not use a specific sound server.  We'll use the alsa-driver package from portage to complete the building of actual card drivers.  This allows better control of updating your ALSA and ALSA driver versions.
</p>
<table width="75%" style="background-color: #faebd7; border: solid 4px #7070FF;">
<tr>
<td style="background-color: #7070FF; border: solid 1px #0000FF; color: #FFFFFF;"> <font size="-1">Linux Kernel Configuration: Kernel Configuration</font>
</td></tr>
<tr>
<td>
<pre>Loadable module support  ---&gt;
    [*] Enable loadable module support
</pre>
<pre>Device Drivers  ---&gt;
    Character devices ---&gt;
        &lt;*&gt; Enhanced Real Time Clock Support
    Sound  ---&gt;
        &lt;M&gt; Sound card Support
            Advanced Linux Sound Architecture  ---&gt;
                &lt; &gt; Advanced Linux Sound Architecture
            Open Sound System  ---&gt;
                &lt; &gt; Open Sound System (DEPRECATED)
</pre>
</td></tr></table>
<p>Compile and install your kernel, then reboot to continue.
</p><p>We will then setup your system to use the alsa-driver package.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=9" title="Edit section: Installing alsa-driver">edit</a>]</div><a name="Installing_alsa-driver"></a><h2>Installing alsa-driver</h2>
<p><b>Skip this section if you compiled ALSA modules directly from your kernel.</b>
</p><p>First, we'll need to tell alsa-driver which modules to build for your type of card. Edit /etc/make.conf and add a new option called ALSA_CARDS to it. Inside this variable you declare the soundcard driver you want to use (which you should have from the Identify Your Card section).  These card driver names are NOT the same as the module names!  Use the module name minus the prepending "snd-":
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/make.conf</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
...
ALSA_CARDS=&quot;via82xx emu10k1&quot;
</pre>
</div>
</td></tr></table>
<p>Note that you can specify multiple cards on the ALSA_CARDS line separated by spaces. To get a list of other ALSA_CARDS see <a href="http://www.alsa-project.org/alsa-doc/index.php?vendor=All" title="http://www.alsa-project.org/alsa-doc/index.php?vendor=All">http://www.alsa-project.org/alsa-doc/index.php?vendor=All</a>
</p><p>Now we'll compile ALSA and the drivers you selected:
</p>
<pre>
#emerge alsa-lib alsa-driver alsa-oss alsa-utils
</pre>
<p>Now update your configuration files:
</p>
<pre>
#etc-update
</pre>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=10" title="Edit section: Post-Installation Configuration">edit</a>]</div><a name="Post-Installation_Configuration"></a><h2>Post-Installation Configuration</h2>
<p>First, you'll have to edit /etc/modules.d/alsa and configure it specifically for your sound cards and OSS emulation.
</p><p>Here is the gentoo default configuration file:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/modules.d/alsa</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# Alsa 0.9.X kernel modules' configuration file.
# $Header: /home/cvsroot/gentoo-x86/media-sound/alsa-utils/files/
# alsa-modules.conf-rc,v 1.1 2003/08/05 21:07:55 johnm Exp $


# ALSA portion
alias char-major-116 snd
# OSS/Free portion
alias char-major-14 soundcore

##
## IMPORTANT:
## You need to customise this section for your specific sound card(s)
## and then run `update-modules' command.
## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
##
##  ALSA portion
alias snd-card-0 snd-cmipci
## alias snd-card-1 snd-ens1371
##  OSS/Free portion
alias sound-slot-0 snd-card-0
## alias sound-slot-1 snd-card-1
##

# OSS/Free portion - card #1
alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss
##  OSS/Free portion - card #2
## alias sound-service-1-0 snd-mixer-oss
## alias sound-service-1-3 snd-pcm-oss
## alias sound-service-1-12 snd-pcm-oss

alias /dev/mixer snd-mixer-oss
alias /dev/dsp snd-pcm-oss
alias /dev/midi snd-seq-oss

# Set this to the correct number of cards.
options snd cards_limit=1
</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=11" title="Edit section: Single card example">edit</a>]</div><a name="Single_card_example"></a><h3> Single card example </h3>
<p>Here is an acceptable single card configuration complete with OSS emulation:
</p><p><br>
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/modules.d/alsa (single card)</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
alias char-major-116 snd
alias char-major-14 soundcore

alias snd-card-0 snd-emu10k1
alias sound-slot-0 snd-card-0

alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

alias /dev/dsp snd-pcm-oss

options snd cards_limit=1
</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=12" title="Edit section: Multiple cards">edit</a>]</div><a name="Multiple_cards"></a><h3> Multiple cards </h3>
<p>Here is an example of a two card configuration with OSS emulation for each (for cards that use different modules):
</p><p><br>
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/modules.d/alsa (multiple cards)</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
alias char-major-116 snd
alias char-major-14 soundcore

#Card 1
alias snd-card-0 snd-emu10k1
alias sound-slot-0 snd-card-0

alias sound-service-0-0 snd-mixer-oss
alias sound-service-0-1 snd-seq-oss
alias sound-service-0-3 snd-pcm-oss
alias sound-service-0-8 snd-seq-oss
alias sound-service-0-12 snd-pcm-oss

options snd-emu10k1 index=0

alias /dev/dsp snd-pcm-oss

#Card 2
alias snd-card-1 snd-intel8x0
alias sound-slot-1 snd-card-1

alias sound-service-1-0 snd-mixer-oss
alias sound-service-1-3 snd-pcm-oss
alias sound-service-1-12 snd-pcm-oss

options snd-intel8x0 index=1

alias /dev/dsp1 snd-pcm-oss

options snd cards_limit=2
</pre>
</div>
</td></tr></table>
<p>In the 2-card configuration above, the <code>index=0</code> or <code>index=1</code> decide the order in which the sound card modules are loaded and as such which card is the first sound card. You'd want to do that in order to have a specific sound card being default. Note that the module doesn't actually have to be loaded to 'reserve' the space. Therefore having <code>index=0</code> and <code>index=2</code> will leave space for a third soundcard in between should you choose to plug it in.
</p><p>Now if that doesn't work for some reason, read the <a href="http://alsa.opensrc.org/MultipleCards" title="http://alsa.opensrc.org/MultipleCards">ALSA wiki entry</a> for more info. But you can still tamper with the order of module loading. So now we'll tell the kernel which modules to load at boot. Replace the examples with your actual modules.  The name of your modules will be prepended by "snd-"
</p><p><br>
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/modules.autoload.d/kernel-2.6</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.
#
# Note that this file is for 2.6 kernels.
#
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line.  Comments begin with # and
# are ignored.  Read man modules.autoload for additional details.

# For example:
# 3c59x

snd-emu10k1
snd-intel8x0
</pre>
</div>
</td></tr></table>
<p>Note that the order with which you list your cards will be the order that ALSA uses to determine which card will be primary (default), and which will be secondary.
</p><p>Now run modules-update to commit the changes to both /etc/modules.d/alsa and the previous entry:
</p>
<pre>
#modules-update -f
</pre>
<p>The -f option forces changes to be committed.  Some versions of Gentoo will require the full --force or force (modules-update force) option to be used instead.  Adjust accordingly.
</p><p><br>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=13" title="Edit section: Multiple cards with the same module">edit</a>]</div><a name="Multiple_cards_with_the_same_module"></a><h4> Multiple cards with the same module </h4>
<p>(Please copy the example from the ALSA site)
</p><p>In this case, you can still choose their index individually. The <a href="http://alsa.opensrc.org/MultipleUSBAudioDevices" title="http://alsa.opensrc.org/MultipleUSBAudioDevices">ALSA documentation</a> has an excellent example on how to achieve that for the USB cards (check your card/module entry in ALSA to see if it has similar functions, if so it works just the same), but in the future udev should make it possible for all cards.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=14" title="Edit section: Start alsa automatically">edit</a>]</div><a name="Start_alsa_automatically"></a><h3> Start alsa automatically </h3>
<p>We'll now add ALSA to your default runtime so it will start at boot:
</p>
<pre>
#rc-update add alsasound boot
</pre>
<p>Now start ALSA manually:
</p>
<pre>
#/etc/init.d/alsasound start
</pre>
<p>And run alsamixer to unmute your channels and set acceptable volume levels.
You should run alsamixer with the -c flag to specify which card to adjust:
</p>
<pre>
#alsamixer -c 0

or 

#alsamixer -c 1
</pre>
<p>After unmuting your channels and setting inital volume levels you can save your settings with:
</p>
<pre>
#/etc/init.d/alsasound save

or

#alsactl store
</pre>
<p>This will save the settings to <i>/etc/asound.state</i>.  <i>/etc/init.d/alsasound</i> will use that file to restore volume levels at boot-time.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=15" title="Edit section: User Configuration">edit</a>]</div><a name="User_Configuration"></a><h3>User Configuration</h3>
<p>Each user to utilize the sound system will need to be added to the "audio" group:
</p>
<pre>
#gpasswd -a username audio
</pre>
<p>Replace "username" with the user you wish to grant access.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=16" title="Edit section: Notes">edit</a>]</div><a name="Notes"></a><h2>Notes</h2>
<p>Your default ALSA configuration without dmix is now complete.  Note that it is not at all necessary to continue with a dmix configuration unless you have a specific reason to do so, especially considering that both KDE and GNOME provide ways of doing software mixing.  For the basic user, your ALSA is now complete.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=17" title="Edit section: Finding your ALSA card ID">edit</a>]</div><a name="Finding_your_ALSA_card_ID"></a><h4>Finding your ALSA card ID</h4>
<p>If you have several soundcards, you may want to know the ID of your soundcards, so that you can easily switch between your soundcards when using, e.g., mplayer (see note on how to switch elsewhere in this HOWTO).
</p>
<pre>
#cat /proc/asound/cards
</pre>
<p>The card ID is the identifier on the far right in the first line of each card listed. These card IDs should match the subdirectories in '<b>/proc/asound'</b>, e.g., if you have a Sound Blaster Live! card, you should have a subdirectory named something like '<b>/proc/asound/Live'</b>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=18" title="Edit section: Known Issues">edit</a>]</div><a name="Known_Issues"></a><h2>Known Issues</h2>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=19" title="Edit section: Kernel 2.6.16">edit</a>]</div><a name="Kernel_2.6.16"></a><h3>Kernel 2.6.16</h3>
<p>There is currently a problem with the alsa-driver package and kernel 2.6.16, either vanilla, Gentoo, or -ck.  Please note that upgrading to ALSA 1.0.11_rc3 or newer should solve the problem for some.  Yet for others, this option might create modules that cannot load into your new kernel.  Be aware that as of right now, you should only run 2.6.16 with Alsa built into the kernel.  This issue is resolved in kernels 2.6.17 and above.
</p><p>If you choose to compile sound card support directly into the kernel and have alsa-sound on video capture cards there may be problems starting with 2.6.16. (It worked for me in 2.6.15.) My system detects the TV card before the sound card as an alsa device. This makes the TV card the default sound card which results in no sound and causes many alsa utilites to fail. Compiling as modules [as in the 2.6.15 example above] solved this problem for me.  This is also resolved in 2.6.17 and up.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=20" title="Edit section: UDEV 089-r2">edit</a>]</div><a name="UDEV_089-r2"></a><h3>UDEV 089-r2</h3>
<p>As of UDEV 089 (which needs baselayout 1.12.0-pre18-r1 or greater to work properly), modules in /etc/modules.autoload.d/kernel-2.6 will load in REVERSE order.  Adjust your settings for your primary sound card accordingly.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=21" title="Edit section: No Sound, Mixers Adjusted">edit</a>]</div><a name="No_Sound.2C_Mixers_Adjusted"></a><h3>No Sound, Mixers Adjusted</h3>
<p>When switching between built-in ALSA, kernel modules, and alsa-driver, you may need to delete /etc/asound.state in order to have your sound cards output sound.  First, stop /etc/init.d/alsasound, then delete the file.  When you next start the service, it will recreate and empty asound.state and you'll have to readjust your mixer settings as per these installation documents.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=22" title="Edit section: No Sound or very silent sound with noise">edit</a>]</div><a name="No_Sound_or_very_silent_sound_with_noise"></a><h3>No Sound or very silent sound with noise</h3>
<p>When you run "alsamixer" and see channels like "IEC958 Front", "IEC958 Rear" etc. instead of "Center" then  change all channels to above 50% and mute "IEC958" channel (press M on it).
</p><p>Some onboard sound cards have connectors to route sound to audio jacks on the front of the computer case rather than the back plugs. A bank of jumpers control where the sound is routed.  (For example the onboard Sound Blaster 24bit LS (ca0106).)  If these jumpers are set to route sound to the wrong jacks, there will be no errors but no sound either.
</p><p>Other possible issue is with some old types of sound cards (for example Aureal Vortex). Their problem can be solved by enabling/disabling (with "M" button) "External amplifier" option in alsamixer.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=23" title="Edit section: Credits">edit</a>]</div><a name="Credits"></a><h2>Credits</h2>
<p><a href="http://forums.gentoo.org/viewtopic.php?p=761115#761115" title="http://forums.gentoo.org/viewtopic.php?p=761115#761115">Redeeman</a><br>
<a href="http://forums.gentoo.org/viewtopic.php?p=759798#759798" title="http://forums.gentoo.org/viewtopic.php?p=759798#759798">Redeeman</a><br>
<a href="http://forums.gentoo.org/viewtopic.php?p=761115#761115" title="http://forums.gentoo.org/viewtopic.php?p=761115#761115">Redeeman</a><br>
<a href="/User:Sametoms" title="User:Sametoms">sametoms</a> - small adjustments<br>
<a href="/index.php?title=User:W0rm&amp;action=edit" class="new" title="User:W0rm">w0rm</a> - some corrections<br>
<a href="/index.php?title=User:Ep98&amp;action=edit" class="new" title="User:Ep98">ep98</a> - small adjustments<br>
<a href="/index.php?title=User:Chuck_theobald&amp;action=edit" class="new" title="User:Chuck theobald">chuck_theobald</a> - some additions<br>
<a href="/User:Jbdubbs" title="User:Jbdubbs">jbdubbs</a> - complete rewrite plus multiple cards support<br>
<a href="/User:High" title="User:High">high</a> - small correction<br>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=24" title="Edit section: Testing Your Installation">edit</a>]</div><a name="Testing_Your_Installation"></a><h1>Testing Your Installation</h1>
<ul><li> Install mpg321:
</li></ul>
<pre>$ emerge media-sound/mpg321
</pre>
<ul><li> Test basic dmix on alsa with:
</li></ul>
<pre>$ mpg321 somesong1.mp3 &amp;
$ mpg321 somesong2.mp3 &amp;
$ mpg321 somesong3.mp3 &amp;
</pre>
<p>With dmix enabled by default, this should work without flaw.  If the second or third audio stream stutters, you may have a problem with the buffer size or sampling rate, depending on your card and it's specific issues.  In this case, read on in order to customize your installation.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=25" title="Edit section: Intro to dmix">edit</a>]</div><a name="Intro_to_dmix"></a><h1>Intro to dmix</h1>
<p>The dmix virtual sound mixing device is a plugin to ALSA which takes multiple sound streams and mixes them into one virtual stream which a lower-end card can handle.  Any card which does not support multiple streams or hardware mixing of sounds must use this plugin to take full advantage of ALSA and its capabilities.  
</p><p>In most cases, dmix will be automatically configured for ALSA 1.0.9 RC2 and above.  There is no need to adjust the default configuration for the basic user and it should work transparently with your system.
</p>
<div style="padding: 1px 2px 1px 2px; background-color: #ffc1c1; border: solid 2px #ff7070; padding: 0px 4px; font-size: -1;"><b>Warning:</b> (I see this error all the time): it does not mean you can use multiple apps at the same time straight away! Even if some app uses ALSA, first you need to make sure it sends its sound to dmix and that does not happen by default. Instead your apps will gain exclusive access to the default card. To change that, we will need to create a .asoundrc in your home folder that will send all the sound to the mixer and then back to the card.</div>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=26" title="Edit section: Test dmix">edit</a>]</div><a name="Test_dmix"></a><h2> Test dmix </h2>
<pre> aplay -D plug:dmix some_sound.wav
</pre>
<p>If you hear something, your dmix is working (very likely in recent versions of ALSA). Try opening more shells and you will hear the sound of all at the same time. But, as explained above, you will need all apps to send sound to dmix like this one.
</p><p>In case a particular application does not use dmix by default, or your application requires OSS emulation, some tweaking may be necessary.  This HOWTO will cover most tweaks needed to get applications running properly with the plugin.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=27" title="Edit section: dmix Configuration for OSS Emulation">edit</a>]</div><a name="dmix_Configuration_for_OSS_Emulation"></a><h1>dmix Configuration for OSS Emulation</h1>
<p>Now we are ready to create ~/.asoundrc, to enable the dmix plugin for OSS applications, and wrap our dsp devices and default pcm interfaces.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=28" title="Edit section: Test for OSS Emulation">edit</a>]</div><a name="Test_for_OSS_Emulation"></a><h2>Test for OSS Emulation</h2>
<p>First, we'll check that your OSS configuration is working properly:
</p><p>Create ~/.asoundrc and enter this information:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# ~/.asoundrc:

pcm.dsp0 {
    type plug
    slave.pcm &quot;hw:0,0&quot;
}
# or:
#  pcm.dsp0 pcm.default
# if &quot;default&quot; hasn't been redefined

ctl.mixer0 {
    type hw
    card 0
}
</pre>
</div>
</td></tr></table>
<p>If you don't have it already:
</p>
<pre>
# emerge mpg321
</pre>
<p>Next, test aoss with mpg321 in OSS mode:
</p>
<pre>
# aoss mpg321 some.mp3
</pre>
<p>This should play the file, but not yet "dmix"ed.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=29" title="Edit section: Simple Configuration">edit</a>]</div><a name="Simple_Configuration"></a><h2>Simple Configuration</h2>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# ~/.asoundrc

pcm.dsp0 {
    type plug
    slave.pcm &quot;dmix&quot;   # &lt;-- this line has been altered!
}

# mixer0 can stay unchanged, because it isn't used anyway, I guess&nbsp;;)
ctl.mixer0 {
    type hw
    card 0
}

# I also had to add/alter the following, making ALSA use dmix by default
pcm.!default {
    type plug
    slave.pcm &quot;dmix&quot;
}

</pre>
</div>
</td></tr></table>
<p>Test this setup with mpg321 like example above. This should enable dmix'd
OSS playback, but it will not work on cards like the M-Audio
Audiophile or other Delta cards, that need a certain audio data format
for playback on hw:0 (which dmix uses by default). A fix is below.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=30" title="Edit section: Advanced Configuration">edit</a>]</div><a name="Advanced_Configuration"></a><h2>Advanced Configuration</h2>
<p>This involves defining dmix parameters.
If a card needs a certain format conversion we need to create a custom dmix device. Let's call it ossmix.
</p><p><br>
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
pcm.ossmix {
    type dmix
    ipc_key 1024          # must be unique!
    ipc_perm 0660         # sound for everybody (at least in your group)
    slave {
        pcm &quot;hw:0,0&quot;      # you cannot use a &quot;plug&quot; device here, darn.
        period_time 0
        period_size 1024  # must be power of 2
        buffer_size 8192  # dito. It
        #format &quot;S32_LE&quot;
        #periods 128      # dito.
        #rate 8000        # with rate 8000 you *will* hear,
                          # if ossmix is used&nbsp;:)
    }
}
# bindings are cool. This says, that only the first
# two channels are to be used by dmix, which is enough for
# (most) oss apps and also lets multichannel chios work
# much faster:

bindings {
        0 0   # from 0 =&gt; to 0
        1 1   # from 1 =&gt; to 1
}

pcm.dsp0 {
    type plug
    slave.pcm &quot;ossmix&quot;     # use our new PCM here
}
# mixer0 like above
ctl.mixer0 {
    type hw
    card 0
}
</pre>
</div>
</td></tr></table>
<p>It is important, that this "ossmix" PCM works with your card in ALSA
mode. That is, the following should produce sound:
</p>
<pre># alsaplayer -o alsa -d ossmix some.mp3
</pre>
<ul><li> Another complex example for nvidia nforce(2) boards (intel8x0) - while the above solution didn't work for me, the following does. (taken from <a href="http://forum.hardware.fr/hardwarefr/OSAlternatifs/-NVIDIA-Alsa-NForce2-et-aplay-et-dmix-aussi-et-pis-jack-aussi--sujet-29776-1.htm" title="http://forum.hardware.fr/hardwarefr/OSAlternatifs/-NVIDIA-Alsa-NForce2-et-aplay-et-dmix-aussi-et-pis-jack-aussi--sujet-29776-1.htm">forum.hardware.fr</a> (thread in french language).
</li></ul>
<p>This probably works better on the nVidia chips because the codecs don't properly support 44k1 output;  they work much more reliably at 48kHz.
</p><p><br>
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc (nvidia nforce setup)</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
pcm.nforce-hw {
        type hw
        card 0
}
pcm.!default {
        type plug
        slave.pcm &quot;nforce&quot;
}
pcm.nforce {
        type dmix
        ipc_key 1234
        ipc_perm 0660
        slave {
                pcm &quot;hw:0,0&quot;
                period_time 0
                period_size 1024
                buffer_size 4096
                #rate 44100
                rate 48000
        }
}
ctl.nforce-hw {
        type hw
        card 0
}
</pre>
</div>
</td></tr></table>
<p>Have a look at <a href="#Hardware_Related_Configs" title>Hardware Related Configs</a> below on this page for more configs. **
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=31" title="Edit section: Credits">edit</a>]</div><a name="Credits_2"></a><h2>Credits</h2>
<p><a href="http://alsa.opensrc.org/index.php?page=DmixPlugin" title="http://alsa.opensrc.org/index.php?page=DmixPlugin">Frank Barknecht</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=32" title="Edit section: Software Related Configurations">edit</a>]</div><a name="Software_Related_Configurations"></a><h1>Software Related Configurations</h1>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=33" title="Edit section: Configuring aRts and KDE">edit</a>]</div><a name="Configuring_aRts_and_KDE"></a><h2>Configuring aRts and KDE</h2>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=34" title="Edit section: aRts Approach">edit</a>]</div><a name="aRts_Approach"></a><h3>aRts Approach</h3>
<p>aRts is a framework for developing modular multimedia applications. The sound server, artsd, allows multiple applications to cooperatively process and output sound and music. aRts is designed to provide its filter and synthesis capabilities to other applications using the multimedia communication protocol (MCOP). aRts is also capable of modular realtime synthesis. It can create sounds &amp; music (realtime midi synthesis) using small modules like oscillators for creating waveforms, various filters, mixers, faders, etc.
</p><p>Redirect aRts to your dmix device for best performance. This can be done by overriding the device location to <i>plug:dmix</i>.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=35" title="Edit section: ALSA Approach">edit</a>]</div><a name="ALSA_Approach"></a><h3>ALSA Approach</h3>
<p>This is the preferred solution since there is no need for another layer below that.
</p><p>Can be used with KDE 3.2.2 and above by redirecting aRts to your ALSA (dmix) device.  Versions 3.2.1 and below require OSS emulation.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=36" title="Edit section: ESD (esound) Approach">edit</a>]</div><a name="ESD_.28esound.29_Approach"></a><h3>ESD (esound) Approach</h3>
<p><strike>The Enlightenment sound daemon, aka ESD, aka esound.
</p><p>If you don't have such option in your control center, you have to recompile it with proper ./configure options. And of course you should have esd installed in your system (very often package is called esound).
</p><p>Now sound in KDE is mixed with sound from alsa driven apps without need to use (almost always not working) artsdsp.</strike>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=37" title="Edit section: OSS Emulation Approach">edit</a>]</div><a name="OSS_Emulation_Approach"></a><h3>OSS Emulation Approach</h3>
<p>This is only necessary for KDE versions 3.2.1 and below since those do not yet recognize ALSA.  Using this in versions subsequent to that will cause degraded performance.
</p>
<ul><li> Setup OSS Emulation as directed earlier in this article.
</li><li> In KDE Control Center, chose Open Sound System as your default sound server.  If necessary, you can check Override Device Location and enter a /dev/dsp device corresponding to your configured sound card.
</li></ul>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=38" title="Edit section: Credits">edit</a>]</div><a name="Credits_3"></a><h4>Credits</h4>
<p><a href="http://forums.gentoo.org/viewtopic.php?p=812202#812202" title="http://forums.gentoo.org/viewtopic.php?p=812202#812202">Zoltan</a> (<b>Note:</b> Russian language post)<br>
<a href="http://opensrc.org/alsa/index.php?page=Dmix+Kde+-+arts%2C+ESD+and+SDL+quick+and+dirty+HOWTO" title="http://opensrc.org/alsa/index.php?page=Dmix+Kde+-+arts%2C+ESD+and+SDL+quick+and+dirty+HOWTO">maHo</a><br>
<a href="/User:Jbdubbs" title="User:Jbdubbs">jbdubbs</a> - Complete Rewrite
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=39" title="Edit section: Configuring Gnome/eSound">edit</a>]</div><a name="Configuring_Gnome.2FeSound"></a><h2>Configuring Gnome/eSound</h2>
<p>Recent releases of esound support alsa plug in hw devices, so if your gnome apps, or some binary apps, could easily work with esound, and you don't care about latency, esound can play out to dmix, which works nicely.
</p><p>Make sure that your esd uses alsa, and add -d default option to /etc/esd/esd.conf.
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/esd/esd.conf</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
[esd]
auto_spawn=1
spawn_options=-terminate -nobeeps -as 2 -d default
spawn_wait_ms=100
</pre>
</div>
</td></tr></table>
<p>If you notice that esd doesn't want to play through default device, or if you launch esd -d default, it segfaults, it means that you have esound&lt;=0.2.32, which use obsolete alsa API. If it's true, install more recent, or
compile latest esound with <a href="http://cvs.pld-linux.org/SOURCES/esound-alsa-pcm-newapi.patch" title="http://cvs.pld-linux.org/SOURCES/esound-alsa-pcm-newapi.patch">esound-alsa-pcm-newapi.patch</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=40" title="Edit section: pulseaudio">edit</a>]</div><a name="pulseaudio"></a><h2>pulseaudio</h2>
<p>Edit /etc/pulseaudio/defaults.pa, so that all lines containing module-alsa-sink also contain device=dmix (dmix, or whatever the mixing device in your .asoundrc is). Example config file:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/pulseaudio/defaults.pa</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
#!/usr/bin/pulseaudio -nF

#
# This file is part of pulseaudio.
#
# pulseaudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# pulseaudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with pulseaudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.


# Load audio drivers statically

#load-module module-alsa-sink sink device=dmix
#load-module module-alsa-source device=plughw:1,0
#load-module module-oss device=&quot;/dev/dsp&quot; sink_name=output source_name=input
#load-module module-oss-mmap device=&quot;/dev/dsp&quot; sink_name=output source_name=input
load-module module-null-sink
#load-module module-pipe-sink

# Load audio drivers automatically on access

# ALSA
add-autoload-sink output module-alsa-sink sink_name=output device=dmix
add-autoload-source input module-alsa-source source_name=input

# OSS
add-autoload-sink output module-oss device=&quot;/dev/dsp&quot; sink_name=output source_name=input
add-autoload-source input module-oss device=&quot;/dev/dsp&quot; source_name=input sink_name=output

#add-autoload-sink output module-oss-mmap device=&quot;/dev/dsp&quot; sink_name=output source_name=input
#add-autoload-source input module-oss-mmap device=&quot;/dev/dsp&quot; sink_name=output source_name=input

# Load several protocols
load-module module-esound-protocol-unix
#load-module module-esound-protocol-tcp
load-module module-native-protocol-unix
#load-module module-simple-protocol-tcp
#load-module module-cli-protocol-unix

# Load the CLI module
load-module module-cli

# Make some devices default
set-default-sink output
set-default-source input

.nofail

# Load something to the sample cache
load-sample x11-bell /usr/share/sounds/generic.wav
#load-sample-dir-lazy /usr/share/sounds/*.wav

# Load X11 bell module
load-module module-x11-bell sample=x11-bell sink=output

# Publish connection data in the X11 root window
load-module module-x11-publish

#load-module module-pipe-source
#load-module module-pipe-sink
</pre>
</div>
</td></tr></table>
<p><br>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=41" title="Edit section: jack">edit</a>]</div><a name="jack"></a><h2>jack</h2>
<p>Alsa and oss applications can work with jack.
The following will work with sound cards with hardware mixing capability (as exemple soundblaster live and audigy).
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=42" title="Edit section: Alsa and jack">edit</a>]</div><a name="Alsa_and_jack"></a><h3>Alsa and jack</h3>
<p>Edit ~/.asoundrc and add the following
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# convert alsa API over jack API
# use it with 
# % aplay foo.wav

# use this as default
pcm.!default {
    type plug
    slave { pcm &quot;jack&quot; }
}

# pcm type jack
pcm.jack {
    type jack
    playback_ports {
        0 alsa_pcm:playback_1
        1 alsa_pcm:playback_2
        }
    capture_ports {
        0 alsa_pcm:capture_1
        1 alsa_pcm:capture_2
        }
}
</pre>
</div>
</td></tr></table>
<p>This will work with most alsa applications. Some applications will not work, as exemple beast with the alsa plugin. When starting an alsa application as usual, if jackd is started, the application will use by default the jack plugin and appear in the connection panel of qjackctl. Otherwise, it will generate an error message and start using alsa.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=43" title="Edit section: oss and jack">edit</a>]</div><a name="oss_and_jack"></a><h3>oss and jack</h3>
<p>Edit ~/.asoundrc and add the text in the preceding text box (alsa and jack) as well as the following:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# oss will use the alsa to jack API by default
# test it with
# % aoss mpg123 some.mp3
pcm.dsp pcm.!default
</pre>
</div>
</td></tr></table>
<p>It will work the same as the alsa to jack converter. Some applications will not work, as exemple beast.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=44" title="Edit section: Note">edit</a>]</div><a name="Note"></a><h3>Note</h3>
<p>mplayer will crash with this setting when jackd is started. To avoid it, start mplayer with native jack driver:
</p>
<pre># mplayer -ao jack movie.avi
</pre>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=45" title="Edit section: MPlayer">edit</a>]</div><a name="MPlayer"></a><h2>MPlayer</h2>
<p>If you enable alsa at compile time(done via USE variables) you can edit /etc/mplayer.conf in the line where you see ao=oss to:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/mplayer.conf</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>ao=alsa:device=dmix
</pre>
</div>
</td></tr></table>
<p>or simply start mplayer like this:
</p>
<pre># mplayer -ao alsa:device=dmix movie.avi
</pre>
<p>you should run this command first
</p>
<pre># mplayer -ao help
</pre>
<p>you will see all audio output parameter, this will more correct when you assign the -ao parameter.
</p>
<div style="padding: 1px 2px 1px 2px; background-color: #c1ffc1; border: solid 1px #a0ffa0; font-size: -1;"><b>Note:</b> The syntax for using alsa with mplayer has changed with newer versions of mplayer.  For the 1.0_pre4 series you will need to use <b>"alsa1x:default"</b> instead of <b>"alsa9:default"</b>.  Starting with 1.0_pre5 you need to simply use <b>"alsa:device=dmix"</b>. If you have several soundcards, you can also specify which one to use by specifying the card id: <b>"alsa:device=hw=[card id]"</b>. That way, you can choose which soundcard to use when you start mplayer on the command line by making two aliases like <b>"alias mplayersb='mplayer -ao alsa:device=hw=Live'"</b>. And you are starting mplayer from the command line, right?&nbsp;:)</div><br>
<div style="padding: 1px 2px 1px 2px; background-color: #c1ffc1; border: solid 1px #a0ffa0; font-size: -1;"><b>Note:</b> In mplayer it is possible to convert audio sample rates using the -srate flag. Or you can edit your mplayer config file (/etc/mplayer.conf, or ~/.mplayer/config) and add the line srate=X (X being the rate defined in .asoundrc).</div>
<div style="padding: 1px 2px 1px 2px; background-color: #c1ffc1; border: solid 1px #a0ffa0; font-size: -1;"><b>Note:</b> The RealMedia codecs distributed for mplayer don't seem to like dmix.  Symptoms are stuttering/freezing video and sound.  The only cure I know of is to kill anything else touching the audio device.</div>
<p>The <b>period_size</b> and  <b>buffer_size</b> in ~/.asoundrc
should be set to
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<p>...
</p>
<pre>
pcm.dmixer  {
    type dmix
    ipc_key 1024
    slave {
        pcm &quot;hw:0,0&quot;
        period_time 0
        period_size 1024  &lt;===== here
        buffer_size 8192  &lt;===== and here
        periods 128
        rate 44100
    }
    bindings {
        0 0
        1 1
    }
}
</pre>
<p>...
</p>
</div>
</td></tr></table>
<p>it's kinda magic numbers to allow mplayer work properly
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=46" title="Edit section: Credits">edit</a>]</div><a name="Credits_4"></a><h3>Credits</h3>
<p><a href="http://forums.gentoo.org/viewtopic.php?p=759798#759798" title="http://forums.gentoo.org/viewtopic.php?p=759798#759798">Redeeman</a><br>
<a href="http://forums.gentoo.org/viewtopic.php?p=1059999#1059999" title="http://forums.gentoo.org/viewtopic.php?p=1059999#1059999">00420</a><br>
<a href="http://forums.gentoo.org/viewtopic.php?p=1098291#1098291" title="http://forums.gentoo.org/viewtopic.php?p=1098291#1098291">00420</a><br>
<a href="http://forums.gentoo.org/viewtopic.php?p=812202#812202" title="http://forums.gentoo.org/viewtopic.php?p=812202#812202">Zoltan</a> (<b>Note:</b> Russian language forum.)
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=47" title="Edit section: XMMS">edit</a>]</div><a name="XMMS"></a><h2>XMMS</h2>
<p><b>XMMS has been <a href="http://forums.gentoo.org/viewtopic-t-509819.html" title="http://forums.gentoo.org/viewtopic-t-509819.html">removed</a></b> from Portage because it is unmaintained <a href="http://www.xmms.org/" title="http://www.xmms.org/">upstream</a> - the closest replacement is probably <a href="http://gentoo-portage.com/Search?search=media-sound/audacious" class="extiw" title="ebuild:media-sound/audacious">audacious</a>.
</p><p>Options -&gt; Preferences -&gt; Audio
</p>
<ul><li> Select Alsa Plugin
</li><li> Output Plugins Preferences
<ol><li> Audio Device: "dmixer" (per example conf above) which is the same as "ossmix". If dmixer doesn't work with your version of the ALSA output plugin, try to specify plug:dmixer as the output device. If dmixer doesn't work, use dmix.
</li><li> Use software volume control
</li><li> Advanced Settings (these settings may be for a particular sound card)
<ul><li> buffer time: 750ms
</li><li> period time: 75ms
</li><li> <u>uncheck</u> mmap mode, if present
</li></ul>
</li></ol>
</li></ul>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=48" title="Edit section: GAIM">edit</a>]</div><a name="GAIM"></a><h2>GAIM</h2>
<p>From the GAIM FAQ:
</p>
<blockquote>If you choose "Automatic", you can create a file, either /etc/libao.conf or ~/.libao, and put <b>one</b> of the following lines in it:<pre>
 default_driver=alsa
 default_driver=oss
</pre>Other drivers, like alsa09, arts, esd, irix, macosx, nas, and sun might also be supported, depending on your platform and how libao was compiled. See also man 5 libao.conf.</blockquote>
<pre>Tools-&gt;Preferences-&gt;Sounds-&gt;Sound Command =
 aplay -D plug:dmix %s
</pre>
<p>If it doesn't work, try:
</p>
<pre>aplay %s
</pre>
<p>Alternatively, if you have `sox` installed, you may try
</p>
<pre>sox %s -t alsa -s default
</pre>
<p>as the "Sound Command".
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=49" title="Edit section: Firefox, Mozilla, RealPlayer, Skype &amp; Co">edit</a>]</div><a name="Firefox.2C_Mozilla.2C_RealPlayer.2C_Skype_.26_Co"></a><h2>Firefox, Mozilla, RealPlayer, Skype &amp; Co</h2>
<p>To make its plugins (especially <i>libflashplayer.so</i>) use <b>dmix</b> through <b>aoss</b>:
</p>
<ul><li> Move the original firefox symlink
</li></ul>
<pre># rm /usr/bin/firefox
# ln -s /usr/libexec/mozilla-launcher /usr/libexec/firefox
</pre>
<ul><li> Create a new executable script:
</li></ul>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /usr/bin/firefox</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
#!/bin/sh

# This line needs to be maintained or Thunderbird (and
# certain other apps) will not launch links when they
# are clicked on
export MOZILLA_LAUNCHER=firefox

# not correct:
#aoss /usr/libexec/firefox $*
#
# correct:
aoss /usr/libexec/firefox &quot;$@&quot;

</pre>
</div>
</td></tr></table>
<ul><li> From my experience with Firefox 1.5.x (source, not bin), you don't need to do that stuff above, just edit last line of /usr/bin/firefox - insert aoss after exec
</li></ul>
<pre># exec aoss /usr/libexec/mozilla-launcher "$@"
</pre>
<ul><li> Alternatively to all above, you can simply edit /usr/libexec/mozilla-launcher to care take of mozilla, firefox, and seamonkey all at once. Around line 400
</li></ul>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /usr/libexec/mozilla-launcher</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
  else
    #&quot;$mozbin&quot; &quot;$@&quot; &amp;           #old line
    aoss &quot;$mozbin&quot; &quot;$@&quot; &amp;       #new dmixed line
  fi
</pre>
</div>
</td></tr></table>
<p>In a similar fashion it is also possible to "dmix" other <b>oss</b> apps like:
</p>
<ul><li> <i>gflashplayer</i>
</li><li> <i>realplayer</i>
</li><li> <i>skype</i> (note: it doesn't fully work though. See <a href="http://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg15406.html" title="http://www.mail-archive.com/alsa-user@lists.sourceforge.net/msg15406.html">here</a>)
</li><li> <i>mozilla</i> (suite)
</li></ul>
<p>NOTE: Skype 1.3 uses ALSA natively, you don't need dmix anymore unless you have some very specific requirements. 
</p><p>This way one can have, say, several tabs with flash all sounding together and receive an incoming call or system sounds.
</p><p>For example:
</p>
<pre># rm /usr/bin/skype
# touch /usr/bin/skype
# chmod +x /usr/bin/skype
</pre>
<p>and its contents:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /usr/bin/skype </font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
#!/bin/sh
aoss /opt/skype/skype &quot;$@&quot;
</pre>
</div>
</td></tr></table>
<p>Even more - if You do this wisely, there is no need to edit any menus or preferences (like <i>"default browser"</i>).
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=50" title="Edit section: LICQ">edit</a>]</div><a name="LICQ"></a><h2>LICQ</h2>
<p>Set to use aplay in preferences.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=51" title="Edit section: SDL">edit</a>]</div><a name="SDL"></a><h2>SDL</h2>
<p>Set environment with:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/env.d/99sdl</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
SDL_AUDIODRIVER=alsa
AUDIODEV=default
</pre>
</div>
</td></tr></table>
<p>ATTENTION: setting AUDIODEV can cause a non working Mozilla!&nbsp;:-/
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=52" title="Edit section: GStreamer">edit</a>]</div><a name="GStreamer"></a><h2>GStreamer</h2>
<p>Emerge <span style="background-color:#f2f2f2; color:#000000;"><tt>gnome-media</tt></span>, then run <span style="background-color:#f2f2f2; color:#000000;"><tt>gstreamer-properties</tt></span> and set your Audio-Sink. Output is Custom. Pipeline is <b>alsasink -device=dmix</b> (or device=ossmixer, if that's what you used in your asoundrc, or simply -device=dmix if you didn't edit it)
</p><p>(Hint: <a href="http://gentoo-portage.com/Search?search=media-sound/rhythmbox" class="extiw" title="ebuild:media-sound/rhythmbox">rhythmbox</a> uses gstreamer)
</p><p>GStreamer in many ways handles ALSA badly. For example, with a dmix channel configured to output 48khz, GStreamer will natively play audio through this device at 48khz, but using (commonly) 44.1khz data. Without resampling, the audio will sound highly distorted.
</p><p>The solution is to create a custom output pipeline incorporating explicit resampling to the desired format in gstreamer-properties:
</p><p>audioconvert&nbsp;! audioresample&nbsp;! audio/x-raw-int, channels=2,depth=16,rate=48000&nbsp;! alsasink -device=channel0
</p><p>Note that this solution is quite CPU intensive compared to functionaly similar software, such as the crossfade plugin.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=53" title="Edit section: MPD">edit</a>]</div><a name="MPD"></a><h2>MPD</h2>
<p>Change <span style="background-color:#f2f2f2; color:#000000;"><tt>mixer_device</tt></span> from default to dmix in <span style="background-color:#f2f2f2; color:#000000;"><tt>/etc/mpd.conf</tt></span>.
</p>
<pre>
mixer_type              &quot;alsa&quot;
mixer_device            &quot;dmix&quot;
mixer_control           &quot;PCM&quot;
</pre>
<p>Then change <span style="background-color:#f2f2f2; color:#000000;"><tt>ao_driver_options</tt></span> from dev=hw:0,0 to dev=dmixer in <span style="background-color:#f2f2f2; color:#000000;"><tt>/etc/mpd.conf</tt></span>.
</p>
<pre>
ao_driver_options       &quot;dev=dmixer&quot;
#or
ao_driver_options       &quot;dev=plug:dmix&quot;
</pre>
<p>Note: I had to use
</p>
<pre>
ao_driver_options       &quot;dev=pcm.ossmix&quot;
</pre>
<p>This is because I am using the "<a href="#The_other_approach" title>alternate method</a>" (placed in <span style="background-color:#f2f2f2; color:#000000;"><tt>/etc/asound.conf</tt></span> though).
</p><p>If you still have problems getting it to work properly, try setting mpd to run under your user account by changing <span style="background-color:#f2f2f2; color:#000000;"><tt>user</tt></span> in <span style="background-color:#f2f2f2; color:#000000;"><tt>/etc/mpd.conf</tt></span>.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=54" title="Edit section: Xine Engine">edit</a>]</div><a name="Xine_Engine"></a><h2>Xine Engine</h2>
<p>Add this line to your xine config file:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.xine/config</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<p>audio.driver:alsa
</p>
</div>
</td></tr></table>
<p>Be sure to remove or comment out all other "audio.driver:" lines in the file.
Alternatively if you have xine-ui, run xine, right click the main windows and select Settings-&gt;Setup-&gt;audio
</p><p>Set "audio driver to use" to alsa.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=55" title="Edit section: Amarok">edit</a>]</div><a name="Amarok"></a><h2>Amarok</h2>
<p>aRts engine is deprecated and removed from newer versions of Amarok, as is GStreamer. Xine is the default output engine now.
</p><p>Only necessary If arts is not working well with dmix. There are two possible solutions.
Both require to change the engine used in amarok.
</p><p>Settings-&gt;Configure amaroK...-&gt;Engine
</p><p>1. solution: <b>xine engine:</b><br>
Set "Sound System" to "Xine Engine".<br>
Configure xine to use alsa as shown above.<br>
</p><p>2. solution: <b>gstreamer engine:</b><br>
Set "Sound System" to "GStreamer Engine"<br>
Set "Output Plugin" to "alsasink"<br>
tick device and type in "dmix" if you have defined dmix before in your .asoundrc
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=56" title="Edit section: Hardware Configurations - ~/.asoundrc Files">edit</a>]</div><a name="Hardware_Configurations_-_.7E.2F.asoundrc_Files"></a><h1>Hardware Configurations - ~/.asoundrc Files</h1>
<p>First look at <a href="http://www.alsa-project.org/alsa-doc" title="http://www.alsa-project.org/alsa-doc">http://www.alsa-project.org/alsa-doc</a> and choose your sound card
Card Specific Scripts can be found at <a href="http://www.alsa-project.org/alsa-doc/" title="http://www.alsa-project.org/alsa-doc/">The Alsa Project</a>.
</p><p>For local settings edit ~/.asoundrc, for global settings go to /etc/asound.conf
</p><p><br>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=57" title="Edit section: Simple asoundrc for intel8x0">edit</a>]</div><a name="Simple_asoundrc_for_intel8x0"></a><h2> Simple asoundrc for intel8x0 </h2>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
pcm.intel8x0 {
        type hw
    card 0
}

ctl.intel8x0 {
        type hw
        card 0
}
</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=58" title="Edit section: intel8x0 audio card integrated on nforce2 motherboards">edit</a>]</div><a name="intel8x0_audio_card_integrated_on_nforce2_motherboards"></a><h2> intel8x0 audio card integrated on nforce2 motherboards</h2>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# Set default sound card
# Useful so that all settings can be changed to a different card here.
pcm.snd_card {
     type hw
     card 0
     device 0
}

# Allow mixing of multiple output streams to this device
pcm.output {
     type dmix
     ipc_key 1024
     ipc_perm 0660 # Sound for everybody in your group!
     slave.pcm &quot;snd_card&quot;

     slave {
          # This stuff provides some fixes for latency issues.
          # buffer_size should be set for your audio chipset.
          period_time 0
          period_size 1024
          buffer_size 8192
     }

     bindings {
          0 0
          1 1
     }
}

# Allow reading from the default device.
# Also known as record or capture.
pcm.input {
     type dsnoop
     ipc_key 2048
     slave.pcm &quot;snd_card&quot;

## Possible artsd full duplex fix:
#     slave {
#          period_time 0
#          period_size 1024
#          buffer_size 8192
#     }

     bindings {
          0 0
          1 1
     }
}

# This is what we want as our default device
# a fully duplex (read/write) audio device.
pcm.duplex {
     type asym
     playback.pcm &quot;output&quot;
     capture.pcm &quot;input&quot;
}

###################
# CONVERSION PLUG #
###################
# Setting the default pcm device allows the conversion
# rate to be selected on the fly.
# duplex mode allows any alsa enabled app to read/write
# to the dmix plug (Fixes a problem with wine).
pcm.!default {
     type plug
     slave.pcm &quot;duplex&quot;
}

# Apparently this is wrong (breaks mplayer for me opening the device)
#ctl.!default {
#     type plug
#     slave.pcm &quot;snd_card&quot;
#}

########
# AOSS #
########
# OSS dsp0 device (OSS needs only output support, duplex will break some stuff)
pcm.dsp0 {
     type plug
     slave.pcm &quot;output&quot;
}

# OSS control for dsp0 (needed?...this might not be useful)
ctl.dsp0 {
     type plug
     slave.pcm &quot;snd_card&quot;
}

####
#### As of November 2005 with the following packages:
#### &gt;=mozilla-firefox-1.0.7-r2, netscape-flash-7.0.25,
#### alsa-oss-1.0.8-r1 and alsa-oss-1.0.10_rc3
####
#### I have been experiencing crashes related to firefox when rendering flash.
#### I used &quot;aoss firefox&quot; to start the browser.
#### Commenting out the below ctl.mixer0 and using the above ctl.dsp0 allows
#### firefox to render flash without crashing (and yes the aoss mixing works)
#### However aoss Skype does not work properly without mixer0 under some configurations.
####
# OSS control for dsp0 (default old OSS is mixer0)
#ctl.mixer0 {
#     type plug
#     slave.pcm &quot;snd_card&quot;
#}
</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=59" title="Edit section: Credits">edit</a>]</div><a name="Credits_5"></a><h3>Credits</h3>
<p><a href="http://forums.gentoo.org/viewtopic.php?p=1098453#1098453" title="http://forums.gentoo.org/viewtopic.php?p=1098453#1098453">allex87</a><br>
<a href="http://www.alsa-project.org/alsa-doc/doc-php/template.php?module=intel8x0" title="http://www.alsa-project.org/alsa-doc/doc-php/template.php?module=intel8x0">intel8x0</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=60" title="Edit section: via82cxxx onboard/ICE1712 chip">edit</a>]</div><a name="via82cxxx_onboard.2FICE1712_chip"></a><h2> via82cxxx onboard/ICE1712 chip</h2>
<p>If config does not work (well) with an Audiophile card (ICE1712 chip) or a VIA VT82xx (snd-via82xx). The error is:
</p>
<pre>
$ alsaplayer -d ossmix
error on set_format SND_PCM_FORMAT_S16_LE
Unavailable hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S32_LE
SUBFORMAT:  ALL
SAMPLE_BITS: ALL
FRAME_BITS: ALL
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (21333 21334)
PERIOD_SIZE: 1024
PERIOD_BYTES: ALL
PERIODS: (6 7)
BUFFER_TIME: (136520 136521)
BUFFER_SIZE: 6553        &lt;&lt;&lt;&lt;====take a look here!!
BUFFER_BYTES: ALL
TICK_TIME: ALL
</pre>
<p>Jaroslav Kysela did know the reason: The max buffer size of the Delta card is "6553" as marked above. So we need to specify a buffer size in our dmix definition that is: a) a power of two and b) less than 6553. Here's the fixed OSS-dmix .asoundrc for a ICE1712 and VT82xx card:
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
# ~/.asoundrc

# our ICE1712 dmix:
pcm.ossmix {
    type dmix
    ipc_key 1024
    slave {
        pcm &quot;hw:0,0&quot;
        period_time 0
        period_size 1024
        buffer_size 4096        # buffer size &lt; 6653, but pow(x, 2)
        rate 44100              # we want to play CDs only
    }

    bindings {
        0 0
                1 1
        }
}

# Everything shall be dmixed, so redefine &quot;default&quot;:
pcm.!default {
    type plug
    slave.pcm &quot;ossmix&quot;
}

# OSS via aoss should d(mix)stroyed:
pcm.dsp0 {
    type plug
    slave.pcm &quot;ossmix&quot;
}

ctl.mixer0 {
    type hw
    card 0
}
</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=61" title="Edit section: Credits">edit</a>]</div><a name="Credits_6"></a><h3>Credits</h3>
<p><a href="http://alsa.opensrc.org/index.php?page=DmixPlugin" title="http://alsa.opensrc.org/index.php?page=DmixPlugin">http://alsa.opensrc.org/index.php?page=DmixPlugin</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=62" title="Edit section: cmedia 8738 and Analog Devices AD1980">edit</a>]</div><a name="cmedia_8738_and_Analog_Devices_AD1980"></a><h2>cmedia 8738 and Analog Devices AD1980</h2>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> /etc/modules.d/alsa</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<p>...<br>
alias snd-card-0 snd-cmipci<br>
...
</p>
</div>
</td></tr></table>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
pcm.dmixer {
    type dmix
    ipc_key 1024
    ipc_key_add_uid false
    ipc_perm 0666                # mixing for all users
                                 # for users only in your group use 0660

    slave {
        pcm &quot;hw:0,0&quot;
        period_time 0
        period_size 1024
        buffer_size 8192
   rate 44100
    }
    bindings {
        0 0
        1 1
    }
}

pcm.dsp0 {
    type plug
    slave.pcm &quot;dmixer&quot;
}

pcm.!default {
        type plug
        slave.pcm &quot;dmixer&quot;
}

pcm.default {
   type plug
   slave.pcm &quot;dmixer&quot;
}

ctl.mixer0 {
    type hw
    card 0
}
</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=63" title="Edit section: Credits">edit</a>]</div><a name="Credits_7"></a><h3>Credits</h3>
<p><a href="http://forums.gentoo.org/viewtopic.php?p=759798#759798" title="http://forums.gentoo.org/viewtopic.php?p=759798#759798">Redeeman</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=64" title="Edit section: VIA Envy24HT (ice1724) chip">edit</a>]</div><a name="VIA_Envy24HT_.28ice1724.29_chip"></a><h2> VIA Envy24HT (ice1724) chip </h2>
<p><b>Note:</b> If you wish to use the S/PDIF output, change the hardware line to 0,1 (pcm "hw:0,1") and device to 1 (device 1). If you do not, you will be using the analog outputs.
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
pcm.!default {
   type plug
   slave.pcm &quot;dmixer&quot;
}

pcm.dmixer  {
   type dmix
   ipc_key 1024
   slave {
      pcm &quot;hw:0,0&quot;
      format S32_LE
      period_time 0
      period_size 1024

# increased buffer_size because in my system 1024 cause bad
# audio performance (for totem media player and mplayer)
      buffer_size 8192

      rate 44100
   }
   bindings {
      0 0
      1 1
   }
}

ctl.dmixer {
   type hw
   card 0
   device 0

</pre>
</div>
</td></tr></table>
<p><b>Another Configuration.</b>
</p><p>This configuration has the following options:
</p>
<ul><li>1- upmixed stereo to 5.1 sound (stereo copy).
</li><li>2- Optical output (Toslink).
</li><li>3- normal analog speaker setup (fx used when multichannel sounds are played on analog outputs, you dont want the upmix to be used then&nbsp;;) ) -note only analog multichannel!.
</li></ul>
<p>The difference in this one (look down) from the one above, in the way that you enable them, is that here, it is done by typing in manually the "profile name" in you audio/movie player (profiles; "default","spdif" &amp; "analog").
</p><p><br>
</p>
<table width="75%" cellpadding="0" cellspacing="0" style="background-color: #fff2f2; border: solid 1px #ffbfbf;">
<tr>
<td style="background-color: #ffafaf; border-bottom: 1px solid #888;"> <font size="-1"><b>File:</b> ~/.asoundrc</font>
</td></tr>
<tr>
<td>
<div class="scroll">
<pre>
#########################################################
#This is the standard setting (see: &quot;!default&quot;)
#This profile, the default loaded, upmixes stereo sound to 5.1.

pcm.!default {
        type plug
        slave.pcm &quot;surround51&quot;
        slave.channels 6
        route_policy duplicate
}
########################################################
#This is the normal spdif output profile (optical, toslink).

pcm.!spdif {
    type plug
    slave.pcm &quot;hw:0,1&quot;
}

#######################################################
#This is what one could call the &quot;factory default setting&quot;, in other words, it only plays the actual channels. so if you fx want to watch a 5.1 movie, on the analog output, this is the option you want. 


pcm.analog {
    type plug
    slave analog_slave;
}

pcm_slave.analog_slave {
        pcm surround51;
        format S32_LE;
}

</pre>
</div>
</td></tr></table>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=65" title="Edit section: Credits">edit</a>]</div><a name="Credits_8"></a><h3>Credits</h3>
<p><a href="http://forums.gentoo.org/viewtopic-t-413598-highlight-dmix+ice1724.html" title="http://forums.gentoo.org/viewtopic-t-413598-highlight-dmix+ice1724.html">01mf02, Alrua, and ALSA-project.org Guide</a>
</p><p><a href="http://alsa.opensrc.org/ice1724" title="http://alsa.opensrc.org/ice1724">individual customizations of ".asoundrc"</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=66" title="Edit section: Troubleshooting">edit</a>]</div><a name="Troubleshooting"></a><h1>Troubleshooting</h1>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=67" title="Edit section: Creative X-Fi soundcards">edit</a>]</div><a name="Creative_X-Fi_soundcards"></a><h2> Creative X-Fi soundcards </h2>
<p>These cards are <a href="http://opensource.creative.com/" title="http://opensource.creative.com/">supposed</a> to have a closed driver made by Creative released by the second quarter of 2007.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=68" title="Edit section: Alsa record sound">edit</a>]</div><a name="Alsa_record_sound"></a><h2>Alsa record sound</h2>
<p>Sorry if this is incomplete. I tried many many many ways of recording sound and using the microphone (I want to use skype!). After trying all possible configurations of my sound card, a night without sleep, I finally made it after reading the <a href="/Krec" title="Krec">krec</a> manual. They give the clue: start the sound system in <b>full duplex</b> mode. Hope it helps somebody.
</p><p>Recording from the microphone: in alsamixer, you need to press F4 for the Capture view, then raise the microphone level appropriately. The default view in alsamixer does not show the microphone capture control.
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=69" title="Edit section: Alsa + dmix + microphone">edit</a>]</div><a name="Alsa_.2B_dmix_.2B_microphone"></a><h2>Alsa + dmix + microphone</h2>
<ul><li> Q: I can play a couple sounds at the same time but I can't record any sounds using arecord:
</li></ul>
<pre>$ arecord -f cd -d 3 -t wav -N test.wav
ALSA lib pcm_dmix.c:759:(snd_pcm_dmix_open) The dmix plugin supports only playback stream
arecord: main:502: audio open error: Invalid argument
</pre>
<p>But when I remove my ~/.asoundrc I can record.<br>
How can I fix this&nbsp;?
</p>
<ul><li> A: Use dsnoop, scan the page for a <a href="#intel8x0_audio_card_integrated_on_nforce2_motherboards" title>~/.asoundrc</a> with it
</li></ul>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=70" title="Edit section: XMMS in KDE">edit</a>]</div><a name="XMMS_in_KDE"></a><h2>XMMS in KDE</h2>
<ul><li> Q. KDE sounds and media players work, but XMMS says device is busy.
</li><li> A. This means that arts output isn't redirected to dmix, look at the arts section.
</li></ul>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=71" title="Edit section: Errors inserting modules">edit</a>]</div><a name="Errors_inserting_modules"></a><h2>Errors inserting modules</h2>
<p>If you have used alsa-driver in the past, switch to in-kernel drivers and get the following errors whilst running the alsasound initscript:
</p>
<pre>*   Loading: snd-pcm-oss ...
 WARNING: Error inserting snd_mixer_oss (/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown symbol in module, or unknown parameter (see dmesg)
 FATAL: Error inserting snd_pcm_oss (/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-pcm-oss.ko): Unknown symbol in module, or unknown parameter (see dmesg)                                                                       [&nbsp;!! ]
*   Loading: snd-mixer-oss ...
 FATAL: Error inserting snd_mixer_oss (/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown symbol in module, or unknown parameter (see dmesg)
</pre>
<p>Then you may well still have modules from alsa-driver left over. When you unmerge alsa-driver, the modules don't get deleted. When you then switch to in-kernel drivers (as modules), running "modprobe" will give you a hybrid of alsa-driver and in-kernel modules, which just doesn't work.
</p><p>The solution is rm -rf /lib/modules/KERNELVER/alsa-driver after you unmerge alsa-driver. After that run <b>depmod -a</b> to generate new kernel module dependencies files.
</p><p>Another good idea is to check if you remembered to install the new kernel, if so, is grub/lilo loading it? did you remember to mount /boot when installing the kernel?
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=72" title="Edit section: Another Solution">edit</a>]</div><a name="Another_Solution"></a><h2>Another Solution</h2>
<p>You could also try muting the channels <i>"Headphone Jack Sense"</i> and <i>"Line Jack Sense"</i> as per <a href="http://forums.gentoo.org/viewtopic-t-382087-highlight-.html" title="http://forums.gentoo.org/viewtopic-t-382087-highlight-.html">this post</a>
</p>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=73" title="Edit section: Problems with 32-bit dmix on AMD64">edit</a>]</div><a name="Problems_with_32-bit_dmix_on_AMD64"></a><h2>Problems with 32-bit dmix on AMD64</h2>
<p>If you are trying to use dmix on an AMD64, ensure that 32 bits ALSA libs are new enough. It seems that there were changes to dmix in recent ALSA versions, which makes it impossible for 32-bit and 64-bit applications to play sounds together,  if older 32-bit ALSA libraries are used.
</p><p>Currently, the emul-linux-x86-soundlibs-2.5, which contains ALSA libs version 1.0.14_rc1, is masked, so you should unmask it in /etc/portage/package.keywords.
</p>
<pre>~app-emulation/emul-linux-x86-soundlibs-2.5 ~amd64 
~app-emulation/emul-linux-x86-baselibs-2.5.5 ~amd64
</pre>
<div class="editsection" style="float:right;margin-left:5px;">[<a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit&amp;section=74" title="Edit section: Feedback">edit</a>]</div><a name="Feedback"></a><h1>Feedback</h1>
<p>Concerns or Compliments? please use our <a href="/Talk:HOWTO_ALSA_Complete_%28includes_dmix%29" title="Talk:HOWTO ALSA Complete (includes dmix)">Discussion</a> section.
</p><!-- 
Pre-expand include size: 15850 bytes
Post-expand include size: 15356 bytes
Template argument size: 5078 bytes
Maximum: 2097152 bytes
-->

<!-- Saved in parser cache with key wiki:pcache:idhash:1035-0!1!0!!en!2 and timestamp 20070310032629 -->
<div class="printfooter">
Retrieved from "<a href="http://gentoo-wiki.com/HOWTO_ALSA_Complete_%28includes_dmix%29">http://gentoo-wiki.com/HOWTO_ALSA_Complete_%28includes_dmix%29</a>"</div>
                        <div id="catlinks"><p class='catlinks'><a href="/index.php?title=Special:Categories&amp;article=HOWTO_ALSA_Complete_%28includes_dmix%29" title="Special:Categories">Categories</a>: <span><a href="/Category:Articles_to_be_merged" title="Category:Articles to be merged">Articles to be merged</a></span> | <span><a href="/Category:Audio" title="Category:Audio">Audio</a></span><br><hr><a href="/Category:Browse_categories" title="Category:Browse categories">Browse categories</a> &gt; <a href="/Category:Browse_categories" title="Category:Browse categories">Browse categories</a> &gt; <a href="/Category:Applications" title="Category:Applications">Applications</a> &gt; <a href="/Category:Multimedia" title="Category:Multimedia">Multimedia</a> &gt; <a href="/Category:Audio" title="Category:Audio">Audio</a><br>
<a href="/Category:Browse_categories" title="Category:Browse categories">Browse categories</a> &gt; <a href="/Category:Browse_categories" title="Category:Browse categories">Browse categories</a> &gt; <a href="/Category:Gentoo_Linux_Wiki" title="Category:Gentoo Linux Wiki">Gentoo Linux Wiki</a> &gt; <a href="/Category:Wiki_maintenance" title="Category:Wiki maintenance">Wiki maintenance</a> &gt; <a href="/Category:Articles_to_be_merged" title="Category:Articles to be merged">Articles to be merged</a></p></div>                        <!-- end content -->
                        <div class="visualClear"></div>
                </div>
        </div>
                </div>
                <div id="column-one">
        <div id="p-cactions" class="portlet">
                <h5>Views</h5>
                <ul>
                                 <li id="ca-nstab-main" class="selected"><a href="/HOWTO_ALSA_Complete_%28includes_dmix%29">Article</a></li>
                                 <li id="ca-talk"><a href="/Talk:HOWTO_ALSA_Complete_%28includes_dmix%29">Discussion and Bugs</a></li>
                                 <li id="ca-edit"><a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=edit">Edit This Page</a></li>
                                 <li id="ca-history"><a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;action=history">History</a></li>
                </ul>
        </div>
        <div class="portlet" id="p-personal">
                <h5>Personal tools</h5>
                <div class="pBody">
                        <ul>
                                <li id="pt-login"><a href="/index.php?title=Special:Userlogin&amp;returnto=HOWTO_ALSA_Complete_(includes_dmix)">Log in / create account</a></li>
                        </ul>
                </div>
        </div>
        <div class="portlet" id="p-logo">
                <a style="background-image: url-filtered(/images/wiki.png);" href="/Main_Page" title="Main Page"></a>
        </div>
        
                <div class='portlet' id='p-navigation'>
                <h5>Navigation</h5>
                <div class='pBody'>
                        <ul>
                                <li id="n-mainpage"><a href="/Main_Page">Main Page</a></li>
                                <li id="n-currentevents"><a href="/News">Wiki News</a></li>
                                <li id="n-recentchanges"><a href="/Special:Recentchanges">Recent changes</a></li>
                                <li id="n-randompage"><a href="/Special:Random">Random page</a></li>
                                <li id="n-help"><a href="/Help:Contents">Help</a></li>
                        </ul>
                </div>
        </div>
                <div id="p-search" class="portlet">
                <h5>Search</h5>
                <div id="searchBody" class="pBody">
                        <form action="/Special:Search" id="searchform"><div>
                                <input id="searchInput" name="search" type="text" value>
                                <input type='submit' name="go" class="searchButton" id="searchGoButton" value="Go">&nbsp;
                                <input type='submit' name="fulltext" class="searchButton" value="Search">
                        </div></form>
                </div>
        </div>
<div class="portlet" id="p-ib">
          <h5>Indexes</h5>
<div class="pBody">
 <ul><li><a href="/Index:HOWTO" title="Index:HOWTO">HOWTO Index</a>
</li><li><a href="/Index:TIP" title="Index:TIP">Tips &amp; Tricks</a>
</li><li><a href="/Index:MAN" title="Index:MAN">MAN Pages</a>
</li><li><a href="/Index:Hardware" title="Index:Hardware">Hardware</a>
</li><li><a href="/Index:Security" title="Index:Security">Security</a>
</li><li><a href="/Index:FAQ" title="Index:FAQ">FAQ</a>
</li><li><a href="/Index:Screenshots" title="Index:Screenshots">Screenshots</a>
</li><li><a href="/Index:Misc" title="Index:Misc">Misc</a>
</li><li><a href="/Index:Index" title="Index:Index">Other Indexes</a>
</li></ul>
<hr>
<ul><li><a href="/Help:Contents" title="Help:Contents">Wiki Pages</a>
</li><li><a href="/Wanted" title="Wanted">Wanted Articles</a>
</li><li><a href="/Special:Categories" title="Special:Categories">Categories</a>
</li></ul>
</div>
</div>
        <div class="portlet" id="p-tb">
                <h5>Toolbox</h5>
                <div class="pBody">
                        <ul>
                                <li id="t-whatlinkshere"><a href="/index.php?title=Special:Whatlinkshere&amp;target=HOWTO_ALSA_Complete_%28includes_dmix%29">What links here</a></li>
                                <li id="t-recentchangeslinked"><a href="/index.php?title=Special:Recentchangeslinked&amp;target=HOWTO_ALSA_Complete_%28includes_dmix%29">Related changes</a></li>
<li id="t-upload"><a href="/Special:Upload">Upload file</a></li>
<li id="t-specialpages"><a href="/Special:Specialpages">Special pages</a></li>
                                <li id="t-print"><a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;printable=yes">Printable version</a></li>                                <li id="t-permalink"><a href="/index.php?title=HOWTO_ALSA_Complete_%28includes_dmix%29&amp;oldid=101322">Permanent link</a></li>                        </ul>
                </div>
        </div>
        <div id="p-lang" class="portlet">
                <h5>In other languages</h5>
                <div class="pBody">
                        <ul>
                                <li class="interwiki-fr"><a href="http://fr.gentoo-wiki.com/HOWTO_ALSA_sound_mixer_aka_dmix_fr">Français</a></li>
                                <li class="interwiki-de"><a href="http://de.gentoo-wiki.com/Dmix">Deutsch</a></li>
                        </ul>
                </div>
        </div>
                </div><!-- end of the left (by default at least) column -->
                        <div class="visualClear"></div>
                        <div id="footer">
                                <div id="f-poweredbyico"><a href="http://www.mediawiki.org/"><img src="/skins/common/images/poweredby_mediawiki_88x31.png" alt="MediaWiki"></a></div>
                        <ul id="f-list">
                                <li id="lastmod"> This page was last modified 08:47, 3 March 2007.</li>
                                <li id="viewcount">This page has been accessed 260,270 times.</li>
                                <li id="privacy"><a href="/Gentoo_Linux_Wiki:Privacy_policy" title="Gentoo Linux Wiki:Privacy policy">Privacy policy</a></li>
                                <li id="about"><a href="/Gentoo_Linux_Wiki:About" title="Gentoo Linux Wiki:About">About Gentoo Linux Wiki</a></li>
                                <li id="disclaimer"><a href="/Gentoo_Linux_Wiki:General_disclaimer" title="Gentoo Linux Wiki:General disclaimer">Disclaimers</a></li>
                        </ul>
                </div>
                
        
                
</div>
<!-- Served by gentoo-wiki.com in 0.355 secs. --></body></html>