/[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.13 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.3</version> 34<version>1.3.3</version>
29<date>September 7, 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.
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<pre> 194<pre>
172# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 195# <i>env ALSA_CARDS='emu10k1' emerge alsa-driver</i>
173</pre> 196</pre>
174<note> 197<note>
175You 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>.
176For 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>
177</note> 200</note>
219</warn> 242</warn>
220<p> 243<p>
221Check the ALSA portion <e>at the bottom of the file</e>. 244Check the ALSA portion <e>at the bottom of the file</e>.
222By 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).
223</p> 246</p>
224<p>
225<pre caption="At the bottom of /etc/modules.d/alsa"> 247<pre caption="At the bottom of /etc/modules.d/alsa">
226# Set this to the correct number of cards. 248<comment>Set this to the correct number of cards.</comment>
227<c>options snd cards_limit=1</c> 249options snd cards_limit=1
228</pre>
229</p> 250</pre>
230<p> 251<p>
231Now 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>
232<pre caption="In /etc/modules.d/alsa"> 254<pre caption="In /etc/modules.d/alsa">
233## and then run `update-modules' command. 255## and then run `modules-update' command.
234## 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.
235## 257##
236## ALSA portion 258## ALSA portion
237<c>alias snd-card-0 snd-emu10k1</c> 259alias snd-card-0 snd-emu10k1
238<c>## If you have more than one, add: 260<comment>## If you have more than one, add:</comment>
239## alias snd-card-1 snd-intel8x0 261## alias snd-card-1 snd-intel8x0
240## alias snd-card-2 snd-ens1370</c> 262## alias snd-card-2 snd-ens1370
241## OSS/Free portion 263## OSS/Free portion
242## alias sound-slot-0 snd-card-0 264## alias sound-slot-0 snd-card-0
243## alias sound-slot-1 snd-card-1 265## alias sound-slot-1 snd-card-1
244## 266##
245</pre> 267</pre>
246</p>
247<p>
248<note> 268<note>
249If 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.
250I 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
251<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>
252of 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>.
253</note> 273</note>
254</p>
255<p> 274<p>
256Last 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>
257<pre caption="Near the end of /etc/modules.d/alsa"> 277<pre caption="Near the end of /etc/modules.d/alsa">
258alias /dev/mixer snd-mixer-oss 278alias /dev/mixer snd-mixer-oss
259alias /dev/dsp snd-pcm-oss 279alias /dev/dsp snd-pcm-oss
260alias /dev/midi snd-seq-oss 280alias /dev/midi snd-seq-oss
261</pre> 281</pre>
262</p> 282<p>
263<p>
264Now 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>.
265<pre>
266# <c>update-modules</c>
267</pre> 284<pre>
285# <i>modules-update</i>
268</p> 286</pre>
287</p>
269<note> 288<note>
270Running <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>
271</note> 290</note>
272<p> 291<p>
273You 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.
274</p> 293</p>
275<pre caption="/etc/devfsd.conf"> 294<pre caption="/etc/devfsd.conf">
295 <title>Adding alsasound to a runlevel</title> 314 <title>Adding alsasound to a runlevel</title>
296<body> 315<body>
297<p> 316<p>
298First 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:
299<pre> 318<pre>
300# <c>rc-update add alsasound boot</c> 319# <i>rc-update add alsasound boot</i>
301</pre> 320</pre>
302</p> 321</p>
303<p> 322<p>
304<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>
305</p> 324</p>
310<body> 329<body>
311<p> 330<p>
312Since 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.
313</p> 332</p>
314<pre> 333<pre>
315# <c>/etc/init.d/alsasound start</c> 334# <i>/etc/init.d/alsasound start</i>
316</pre> 335</pre>
317<p> 336<p>
318ALSA 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>.
319However, 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.
320</p> 339</p>
321<pre caption = "Running amixer"> 340<pre caption = "Running amixer">
322# <i>amixer</i> 341# <i>amixer</i>
323</pre> 342</pre>
324<p> 343<p>
325<warn> 344<warn>
326You 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
327<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.
328</warn> 347</warn>
329</p> 348</p>
330<pre caption="only if you get an error when running amixer"> 349<pre caption="only if you get an error when running amixer">
331# <c>insmod snd-mixer-oss</c> 350# <i>modprobe snd-mixer-oss</i>
332# <c>insmod snd-pcm-oss</c> 351# <i>modprobe snd-pcm-oss</i>
333# <c>amixer</c> 352# <i>amixer</i>
334</pre> 353</pre>
335<p> 354<p>
336If you got this far, now unmute Master and PCM channels. Some hardware 355If you got this far, now unmute Master and PCM channels. Some hardware
337even requires you to unmute the center channel or even the surround 356even requires you to unmute the center channel or even the surround
338channel. 357channel.
365<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>
366<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
367have 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
368<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 387<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
369<pre caption="needed after each kernel compile"> 388<pre caption="needed after each kernel compile">
370# <c>emerge alsa-driver</c> 389# <i>emerge alsa-driver</i>
371</pre> 390</pre>
372</body> 391</body>
373</section> 392</section>
374<section> 393<section>
375 <title>/etc/modules.autoload</title> 394 <title>/etc/modules.autoload</title>
378load the correct modules at startup.</p> 397load the correct modules at startup.</p>
379<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.
380Check 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>
381</body> 400</body>
382</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
383<section> 423<section>
384 <title>More links..</title> 424 <title>More links..</title>
385<body> 425<body>
386<p> 426<p>
387You could check these for additional info: 427You could check these for additional info:

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

  ViewVC Help
Powered by ViewVC 1.1.20