/[gentoo]/xml/htdocs/doc/en/alsa-guide.xml
Gentoo

Diff of /xml/htdocs/doc/en/alsa-guide.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.12 Revision 1.17
16 John P. Davis</mail> 16 John P. Davis</mail>
17</author> 17</author>
18<author title="Editor"><mail link="swift@gentoo.org"> 18<author title="Editor"><mail link="swift@gentoo.org">
19 Sven Vermeulen</mail> 19 Sven Vermeulen</mail>
20</author> 20</author>
21<author title="Editor"><mail link="bennyc@gentoo.org">
22 Benny Chuang</mail>
23</author>
24<author title="Editor"><mail link="blubber@gentoo.org">
25 Tiemo Kieft</mail>
26</author>
21 27
22<license/> 28<license/>
23 29
24<abstract> 30<abstract>
25This guide will show you how to set up the Advanced Linux Sound Architecture (ALSA) on Gentoo Linux. 31This guide will show you how to set up the Advanced Linux Sound Architecture (ALSA) on Gentoo Linux.
26In addition to the Gentoo Linux Desktop Configuration Guide, this guide is supposed to give you more information on this subject. </abstract> 32In addition to the Gentoo Linux Desktop Configuration Guide, this guide is supposed to give you more information on this subject. </abstract>
27 33
28<version>1.2</version> 34<version>1.3.3</version>
29<date>5 June 2003</date> 35<date>October 9, 2003</date>
30 36
31<chapter> 37<chapter>
32<title>Introduction</title> 38<title>Introduction</title>
33<section> 39<section>
34 <title>What is ALSA?</title> 40 <title>What is ALSA?</title>
87</chapter> 93</chapter>
88 94
89<chapter> 95<chapter>
90<title>Installation</title> 96<title>Installation</title>
91<section> 97<section>
98<title>Gentoo USE flags</title>
99<body>
100
101<p>
102To compile programs with ALSA-support, be sure to add <e>alsa</e> to
103your USE-variable. However, several tools don't support alsa yet, and
104require OSS. ALSA provides OSS-emulation if you define <e>oss</e> in your
105USE-variable before you start.
106</p>
107
108</body>
109</section>
110
111<section>
92 <title>Kernel modules</title> 112 <title>Kernel modules</title>
93<body> 113<body>
94<p> 114<p>
95Since we're still using 2.4.x kernel sources, we'll have to compile kernel modules and ALSA modules separately. People who are using a 2.5.x kernel can do this from within their kernel configuration, since the ALSA modules are included in the kernel sources and should be built there. 115Since we're still using 2.4.x kernel sources, we'll have to compile kernel modules and ALSA modules separately. People who are using a 2.5.x kernel can do this from within their kernel configuration, since the ALSA modules are included in the kernel sources and should be built there.
96</p> 116</p>
107</p> 127</p>
108<p>If you already have a working kernel configuration, make sure you remove all sound drivers (except for Sound Card Support). 128<p>If you already have a working kernel configuration, make sure you remove all sound drivers (except for Sound Card Support).
109If you wish to do this without having to reboot, you could do like this: 129If you wish to do this without having to reboot, you could do like this:
110</p> 130</p>
111<pre> 131<pre>
112# <c>cd /usr/src/linux</c> 132# <i>cd /usr/src/linux</i>
113# <c>cp .config ~/</c> 133# <i>cp .config ~/</i>
114# <c>make mrproper</c> 134# <i>make mrproper</i>
115# <c>cp ~/.config .</c> 135# <i>cp ~/.config .</i>
116# <c>make menuconfig</c> 136# <i>make menuconfig</i>
117</pre> 137</pre>
118<p> 138<p>
119Now select <e>Sound Card Support</e> as Module (M) and deselect all other sound drivers. 139Now select <e>Sound Card Support</e> as Module (M) and deselect all other sound drivers.
120Exit and say Y to save your kernel configuration. 140Exit and say Y to save your kernel configuration.
121After that, build the modules: 141After that, build the modules:
122</p> 142</p>
123<pre> 143<pre>
124# <c>make dep clean</c> 144# <i>make dep clean</i>
125# <c>make modules modules_install</c> 145# <i>make modules modules_install</i>
126</pre> 146</pre>
127<p> 147<p>
128Before installing your new modules, this last line will delete all your previous modules, 148Before installing your new modules, this last line will delete all your previous modules,
129even the ones from a previous ALSA installation. 149even the ones from a previous ALSA installation.
130</p> 150</p>
145 <title>ALSA modules</title> 165 <title>ALSA modules</title>
146<body> 166<body>
147 167
148<p> 168<p>
149Now it's time to install the ALSA drivers for your soundcard(s). If your soundcard is PCI, you can find out the name 169Now it's time to install the ALSA drivers for your soundcard(s). If your soundcard is PCI, you can find out the name
150and type of your soundcard by looking at the output of /proc/pci 170and type of your soundcard by looking at the output of /proc/pci.
151<pre># <c>grep audio /proc/pci</c></pre> 171</p>
172<pre>
173# <i>grep audio /proc/pci</i>
152</p> 174</pre>
175
153 176
154<p> 177<p>
155<warn> 178<warn>
156If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>. 179If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>.
157Check with <c>lsmod</c> and use <c>rmmod</c> to unload all sound-related modules on your system. 180Check with <c>lsmod</c> and use <c>rmmod</c> to unload all sound-related modules on your system.
166<uri link="http://www.alsa-project.org/alsa-doc">ALSA Soundcard Matrix</uri> by following the <e>Details</e> link in the <e>Driver and Docs</e> column in the row of the chipset of your soundcard. 189<uri link="http://www.alsa-project.org/alsa-doc">ALSA Soundcard Matrix</uri> by following the <e>Details</e> link in the <e>Driver and Docs</e> column in the row of the chipset of your soundcard.
167Mine is <c>snd-emu10k1</c>, since I have an SBlive! soundcard, with the <e>EMU10K1</e> chipset. 190Mine is <c>snd-emu10k1</c>, since I have an SBlive! soundcard, with the <e>EMU10K1</e> chipset.
168We'll set ALSA_CARDS environment to the value of the module name before emerging (but without the snd prefix), so emerge will only compile the drivers we need. 191We'll set ALSA_CARDS environment to the value of the module name before emerging (but without the snd prefix), so emerge will only compile the drivers we need.
169</p> 192</p>
170 193
171<p> 194<pre>
172<pre>
173# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 195# <i>env ALSA_CARDS='emu10k1' emerge alsa-driver</i>
174</pre>
175</p> 196</pre>
176<p>
177<note> 197<note>
178You can also add this value in <path>/etc/make.conf</path>, so when you have to emerge the alsa-driver later on you can just run <c>emerge alsa-driver</c>. 198You can also add this value in <path>/etc/make.conf</path>, so when you have to emerge the alsa-driver later on you can just run <c>emerge alsa-driver</c>.
179For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c> 199For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c>
180</note> 200</note>
181 201
185</note> 205</note>
186 206
187<note>If you want to have OSS compatibility, make sure to emerge <i>alsa-oss</i>, it is the ALSA/OSS compatibility 207<note>If you want to have OSS compatibility, make sure to emerge <i>alsa-oss</i>, it is the ALSA/OSS compatibility
188wrapper. </note> 208wrapper. </note>
189 209
190</p> 210<note>If you plan on recompiling your kernels numerous times, it might
211be adviseable to emerge <c>alsa-driver</c> with <c>--buildpkg</c>. This
212will create a binary package for it. Later, after recompiling your kernel,
213you can just do <c>emerge --usepkg alsa-driver</c> which will install the
214binary package instead of recompiling it completely.</note>
215
191<p> 216<p>
192After this, the ALSA modules should be installed on your system. 217After this, the ALSA modules should be installed on your system.
193</p> 218</p>
194</body> 219</body>
195</section> 220</section>
217</warn> 242</warn>
218<p> 243<p>
219Check the ALSA portion <e>at the bottom of the file</e>. 244Check the ALSA portion <e>at the bottom of the file</e>.
220By tweaking this line you can specify the max number of soundcards you have (generally, just one). 245By tweaking this line you can specify the max number of soundcards you have (generally, just one).
221</p> 246</p>
222<p>
223<pre caption="At the bottom of /etc/modules.d/alsa"> 247<pre caption="At the bottom of /etc/modules.d/alsa">
224# Set this to the correct number of cards. 248<comment>Set this to the correct number of cards.</comment>
225<c>options snd cards_limit=1</c> 249options snd cards_limit=1
226</pre>
227</p> 250</pre>
228<p> 251<p>
229Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this: 252Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this:
253</p>
230<pre caption="In /etc/modules.d/alsa"> 254<pre caption="In /etc/modules.d/alsa">
231## and then run `update-modules' command. 255## and then run `modules-update' command.
232## Read alsa-driver's INSTALL file in /usr/share/doc for more info. 256## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
233## 257##
234## ALSA portion 258## ALSA portion
235<c>alias snd-card-0 snd-emu10k1</c> 259alias snd-card-0 snd-emu10k1
236<c>## If you have more than one, add: 260<comment>## If you have more than one, add:</comment>
237## alias snd-card-1 snd-intel8x0 261## alias snd-card-1 snd-intel8x0
238## alias snd-card-2 snd-ens1370</c> 262## alias snd-card-2 snd-ens1370
239## OSS/Free portion 263## OSS/Free portion
240## alias sound-slot-0 snd-card-0 264## alias sound-slot-0 snd-card-0
241## alias sound-slot-1 snd-card-1 265## alias sound-slot-1 snd-card-1
242## 266##
243</pre> 267</pre>
244</p>
245<p>
246<note> 268<note>
247If you have more than one soundcard, adjust the <c>cards_limit</c> value and add more snd-card aliases to the file. 269If you have more than one soundcard, adjust the <c>cards_limit</c> value and add more snd-card aliases to the file.
248I don't have experience with this, but you can find examples for configurations with two or more soundcards in 270I don't have experience with this, but you can find examples for configurations with two or more soundcards in
249<uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri> 271<uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri>
250of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>. 272of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>.
251</note> 273</note>
252</p>
253<p> 274<p>
254Last thing to do in this file, almost at the end, check if these lines are there and uncommented: 275Last thing to do in this file, almost at the end, check if these lines are there and uncommented:
276</p>
255<pre caption="Near the end of /etc/modules.d/alsa"> 277<pre caption="Near the end of /etc/modules.d/alsa">
256alias /dev/mixer snd-mixer-oss 278alias /dev/mixer snd-mixer-oss
257alias /dev/dsp snd-pcm-oss 279alias /dev/dsp snd-pcm-oss
258alias /dev/midi snd-seq-oss 280alias /dev/midi snd-seq-oss
259</pre> 281</pre>
260</p> 282<p>
261<p>
262Now double-check the file <path>/etc/modules.d/alsa</path> and when you're sure everyting is ok, run <c>update-modules</c>. 283Now double-check the file <path>/etc/modules.d/alsa</path> and when you're sure everyting is ok, run <c>modules-update</c>.
263<pre>
264# <c>update-modules</c>
265</pre> 284<pre>
285# <i>modules-update</i>
266</p> 286</pre>
287</p>
267<note> 288<note>
268Running <c>update-modules</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path> 289Running <c>modules-update</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path>
269</note> 290</note>
270<p> 291<p>
271You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered. 292You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered.
272</p> 293</p>
273<pre caption="/etc/devfsd.conf"> 294<pre caption="/etc/devfsd.conf">
293 <title>Adding alsasound to a runlevel</title> 314 <title>Adding alsasound to a runlevel</title>
294<body> 315<body>
295<p> 316<p>
296First thing to do now, is to make ALSA startup at boottime. Like this: 317First thing to do now, is to make ALSA startup at boottime. Like this:
297<pre> 318<pre>
298# <c>rc-update add alsasound boot</c> 319# <i>rc-update add alsasound boot</i>
299</pre> 320</pre>
300</p> 321</p>
301<p> 322<p>
302<warn>Note that the alsasound script should be added to the "boot" runlevel, not the "default" runlevel.</warn> 323<warn>Note that the alsasound script should be added to the "boot" runlevel, not the "default" runlevel.</warn>
303</p> 324</p>
308<body> 329<body>
309<p> 330<p>
310Since we're Linux users, we don't want to reboot. So we'll start the alsasound script manually. 331Since we're Linux users, we don't want to reboot. So we'll start the alsasound script manually.
311</p> 332</p>
312<pre> 333<pre>
313# <c>/etc/init.d/alsasound start</c> 334# <i>/etc/init.d/alsasound start</i>
314</pre> 335</pre>
315<p> 336<p>
316ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>. 337ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>.
317However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this. 338However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this.
318</p> 339</p>
319<pre caption = "Running amixer"> 340<pre caption = "Running amixer">
320# <i>amixer</i> 341# <i>amixer</i>
321</pre> 342</pre>
322<p> 343<p>
323<warn> 344<warn>
324You shouldn't get this, but <e>if</e> you get an error about "amixer: Mixer attach default error: No such file or directory", you should manually insmod 345You shouldn't get this, but <e>if</e> you get an error about "amixer: Mixer attach default error: No such file or directory", you should manually modprobe
325<c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again. 346<c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again.
326</warn> 347</warn>
327</p> 348</p>
328<pre caption="only if you get an error when running amixer"> 349<pre caption="only if you get an error when running amixer">
329# <c>insmod snd-mixer-oss</c> 350# <i>modprobe snd-mixer-oss</i>
330# <c>insmod snd-pcm-oss</c> 351# <i>modprobe snd-pcm-oss</i>
331# <c>amixer</c> 352# <i>amixer</i>
332</pre>
333<p>
334If you got this far, now unmute both Master and PCM channels.
335</p>
336<p>
337<pre> 353</pre>
354<p>
355If you got this far, now unmute Master and PCM channels. Some hardware
356even requires you to unmute the center channel or even the surround
357channel.
358</p>
359<p>
360<pre caption = "Unmuting channels">
338# <c>amixer set Master 100 unmute</c> 361# <i>amixer set Master 100 unmute</i>
339# <c>amixer set PCM 100 unmute</c> 362# <i>amixer set PCM 100 unmute</i>
363<comment>Only if the above doesn't succeed on its own:</comment>
364# <i>amixer set Center 100 unmute</i>
365# <i>amixer set Surround 100 unmute</i>
366<comment>Test the sound:</comment>
340# <c>aplay $KDEDIR/share/sounds/pop.wav</c> <codenote>(pop.wav is part of KDE)</codenote> 367# <i>aplay $KDEDIR/share/sounds/pop.wav</i> <codenote>(pop.wav is part of KDE)</codenote>
341</pre> 368</pre>
342</p> 369</p>
343We check to see if sound is working by using the aplay (alsa play) command. If you hear a pop, then sound is indeed working. 370We check to see if sound is working by using the aplay (alsa play) command. If you hear a pop, then sound is indeed working.
344Then, adjust the volume settings to your liking; the ncurses-based <c>alsamixer</c> is a great way to get them "just so". 371Then, adjust the volume settings to your liking; the ncurses-based <c>alsamixer</c> is a great way to get them "just so".
345<p> 372<p>
357<p>When you ever rebuild your kernel, or upgrade to another kernel, you'll have to rebuild the ALSA modules.</p> 384<p>When you ever rebuild your kernel, or upgrade to another kernel, you'll have to rebuild the ALSA modules.</p>
358<p>Although you might have installed <c>alsa-driver</c>, <c>alsa-libs</c> and <c>alsa-utils</c>, only the first will 385<p>Although you might have installed <c>alsa-driver</c>, <c>alsa-libs</c> and <c>alsa-utils</c>, only the first will
359have to be installed again, since it will put the alsa modules in 386have to be installed again, since it will put the alsa modules in
360<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 387<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
361<pre caption="needed after each kernel compile"> 388<pre caption="needed after each kernel compile">
362# <c>emerge alsa-driver</c> 389# <i>emerge alsa-driver</i>
363</pre> 390</pre>
364</body> 391</body>
365</section> 392</section>
366<section> 393<section>
367 <title>/etc/modules.autoload</title> 394 <title>/etc/modules.autoload</title>
370load the correct modules at startup.</p> 397load the correct modules at startup.</p>
371<p>It's not necessary to add <c>snd-pcm-oss</c> or <c>snd-mixer-oss</c> in this file. 398<p>It's not necessary to add <c>snd-pcm-oss</c> or <c>snd-mixer-oss</c> in this file.
372Check the <uri link="http://www.djcj.org/LAU/guide/alsbook/faq1.html">this FAQ</uri> for more info.</p> 399Check the <uri link="http://www.djcj.org/LAU/guide/alsbook/faq1.html">this FAQ</uri> for more info.</p>
373</body> 400</body>
374</section> 401</section>
402
403<section>
404<title>Known bugs</title>
405<body>
406
407<note>
408This guide lags behind on the alsa-development. Chances are these bugs
409are already fixed when you read this.
410</note>
411
412<ul>
413<li>
414If you have <b>lots of noise</b> when using <b>oss</b> emulation, add
415<e>options snd-pcm-oss dsp_map=1</e> to
416<path>/etc/modules.d/alsa</path>.
417</li>
418</ul>
419
420</body>
421</section>
422
375<section> 423<section>
376 <title>More links..</title> 424 <title>More links..</title>
377<body> 425<body>
378<p> 426<p>
379You could check these for additional info: 427You could check these for additional info:

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20