/[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.2 Revision 1.17
1<?xml version='1.0'?> 1<?xml version='1.0' encoding="UTF-8"?>
2<?xml-stylesheet href="/xsl/guide.xsl" type="text/xsl"?>
3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 2<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 3
6<guide link = "/doc/en/alsa-guide.xml"> 4<guide link = "/doc/en/alsa-guide.xml">
7<title>Gentoo Linux ALSA Guide</title> 5<title>Gentoo Linux ALSA Guide</title>
8<author title="Author"><mail link="zu@pandora.be"> 6<author title="Author"><mail link="zu@pandora.be">
9 Vincent Verleye</mail> 7 Vincent Verleye</mail>
10</author> 8</author>
11 9<author title="Author"><mail link="g2boojum@gentoo.org">
10 Grant Goodyear</mail>
11</author>
12<author title="Author"><mail link="agenkin@gentoo.org">
13 Arcady Genkin</mail>
14</author>
12<author title="Editor"><mail link="zhen@gentoo.org"> 15<author title="Editor"><mail link="zhen@gentoo.org">
13 John P. Davis</mail> 16 John P. Davis</mail>
14</author> 17</author>
18<author title="Editor"><mail link="swift@gentoo.org">
19 Sven Vermeulen</mail>
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>
27
28<license/>
15 29
16<abstract> 30<abstract>
17This 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.
18In 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>
19 33
20<version>1.0</version> 34<version>1.3.3</version>
21<date>30 Oct 2002</date> 35<date>October 9, 2003</date>
22 36
23<chapter> 37<chapter>
24<title>Introduction</title> 38<title>Introduction</title>
25<section> 39<section>
26 <title>What is ALSA?</title> 40 <title>What is ALSA?</title>
79</chapter> 93</chapter>
80 94
81<chapter> 95<chapter>
82<title>Installation</title> 96<title>Installation</title>
83<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>
84 <title>Kernel modules</title> 112 <title>Kernel modules</title>
85<body> 113<body>
86<p> 114<p>
87Since we're still using 2.4.x kernel sources, we'll have to compile kernel modules and ALSA modules separately. 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.
88</p> 116</p>
89<p> 117<p>
90First we'll make sure that our kernel configuration is ready for use with ALSA. 118First we'll make sure that our kernel configuration is ready for use with ALSA.
91All you need in your kernel configuration is having Sound Card Support set to be built as a module (M). 119All you need in your kernel configuration is having Sound Card Support set to be built as a module (M).
92This will build <c>soundcore.o</c>. 120This will build <c>soundcore.o</c>.
99</p> 127</p>
100<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).
101If 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:
102</p> 130</p>
103<pre> 131<pre>
104# <c>cd /usr/src/linux</c> 132# <i>cd /usr/src/linux</i>
105# <c>cp .config ~</c> 133# <i>cp .config ~/</i>
106# <c>make mrproper</c> 134# <i>make mrproper</i>
107# <c>cp ~/.config .</c> 135# <i>cp ~/.config .</i>
108# <c>make menuconfig</c> 136# <i>make menuconfig</i>
109</pre> 137</pre>
110<p> 138<p>
111Now 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.
112Exit and say Y to save your kernel configuration. 140Exit and say Y to save your kernel configuration.
113After that, build the modules: 141After that, build the modules:
114</p> 142</p>
115<pre> 143<pre>
116# <c>make dep clean</c> 144# <i>make dep clean</i>
117# <c>make modules modules_install</c> 145# <i>make modules modules_install</i>
118</pre> 146</pre>
119<p> 147<p>
120Before 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,
121even the ones from a previous ALSA installation. 149even the ones from a previous ALSA installation.
122</p> 150</p>
137 <title>ALSA modules</title> 165 <title>ALSA modules</title>
138<body> 166<body>
139 167
140<p> 168<p>
141Now 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
142and 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.
143<pre>#<c>cat /proc/pci | grep audio</c></pre> 171</p>
172<pre>
173# <i>grep audio /proc/pci</i>
144</p> 174</pre>
175
145 176
146<p> 177<p>
147<warn> 178<warn>
148If 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>.
149Check 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.
153<p> 184<p>
154We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers. 185We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers.
155</p> 186</p>
156<p> 187<p>
157However, to save some time, lookup the <e>Module Name</e> of your soundcard(s) on the 188However, to save some time, lookup the <e>Module Name</e> of your soundcard(s) on the
158<uri link="http://www.alsa-project.org/alsa-doc">ALSA Soundcard Matrix</uri> under the <e>Install</e> section. 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.
159Mine is <c>EMU10K1</c>, since I have an SBlive! soundcard. 190Mine is <c>snd-emu10k1</c>, since I have an SBlive! soundcard, with the <e>EMU10K1</e> chipset.
160We'll set ALSA_CARDS environment to this value before emerging, 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.
161</p>
162
163<p> 192</p>
193
164<pre> 194<pre>
165# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 195# <i>env ALSA_CARDS='emu10k1' emerge alsa-driver</i>
166</pre>
167</p> 196</pre>
168<p> 197<note>
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>.
199For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c>
200</note>
201
169<note> 202<note>
170When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list 203When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list
171of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c> 204of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c>
172</note> 205</note>
173 206
174<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
175wrapper. </note> 208wrapper. </note>
176 209
177</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
178<p> 216<p>
179After this, the ALSA modules should be installed on your system. 217After this, the ALSA modules should be installed on your system.
180</p> 218</p>
181</body> 219</body>
182</section> 220</section>
185<body> 223<body>
186<p> 224<p>
187Let's start configuring now to get ALSA working properly. 225Let's start configuring now to get ALSA working properly.
188We'll need to edit some files, to let our system know about the freshly installed ALSA modules. 226We'll need to edit some files, to let our system know about the freshly installed ALSA modules.
189</p> 227</p>
228
229<p>
230First, install <c>alsa-utils</c> on your system:
190<p> 231</p>
232
233<pre caption = "Emerging alsa-utils">
234# <i>emerge alsa-utils</i>
235</pre>
236
237<p>
191First file to edit is <path>/etc/modules.d/alsa</path>. 238Hereafter, we need to edit <path>/etc/modules.d/alsa</path>.
192</p> 239</p>
193<warn> 240<warn>
194There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>. 241There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>.
195</warn> 242</warn>
196<p> 243<p>
197Check the ALSA portion <e>at the top of the file</e>. 244Check the ALSA portion <e>at the bottom of the file</e>.
198By adding 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).
199</p>
200<p> 246</p>
201<pre caption="At the top of /etc/modules.d/alsa"> 247<pre caption="At the bottom of /etc/modules.d/alsa">
202# Alsa 0.9.X kernel modules' configuration file. 248<comment>Set this to the correct number of cards.</comment>
203# $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.2 2002/11/15 18:39:34 zhen Exp $ 249options snd cards_limit=1
204
205# ALSA portion
206alias char-major-116 snd
207<c>options snd snd_major=116 snd_cards_limit=1</c>
208# OSS/Free portion
209alias char-major-14 soundcore
210
211##
212## IMPORTANT:
213</pre>
214</p> 250</pre>
215<p> 251<p>
216Now 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>
217<pre caption="A bit lower in /etc/modules.d/alsa"> 254<pre caption="In /etc/modules.d/alsa">
218## and then run `update-modules' command. 255## and then run `modules-update' command.
219## 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.
220## 257##
221## ALSA portion 258## ALSA portion
222<c>alias snd-card-0 snd-emu10k1</c> 259alias snd-card-0 snd-emu10k1
223<c>## If you have more than one, add: 260<comment>## If you have more than one, add:</comment>
224## alias snd-card-1 snd-intel8x0 261## alias snd-card-1 snd-intel8x0
225## alias snd-card-2 snd-ens1370</c> 262## alias snd-card-2 snd-ens1370
226## OSS/Free portion 263## OSS/Free portion
227## alias sound-slot-0 snd-card-0 264## alias sound-slot-0 snd-card-0
228## alias sound-slot-1 snd-card-1 265## alias sound-slot-1 snd-card-1
229## 266##
230</pre> 267</pre>
231</p>
232<p>
233<note> 268<note>
234If you have more than one soundcard, adjust the <c>snd_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.
235I 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
236<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>
237of 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>.
238</note> 273</note>
239</p> 274<p>
240<p>
241Last thing to do in this file, at the very bottom, 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>
242<pre caption="at the very bottom of /etc/modules.d/alsa"> 277<pre caption="Near the end of /etc/modules.d/alsa">
243alias /dev/mixer snd-mixer-oss 278alias /dev/mixer snd-mixer-oss
244alias /dev/dsp snd-pcm-oss 279alias /dev/dsp snd-pcm-oss
245alias /dev/midi snd-seq-oss 280alias /dev/midi snd-seq-oss
246</pre> 281</pre>
247</p> 282<p>
248<p>
249Now 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>.
250<pre>
251# <c>update-modules</c>
252</pre> 284<pre>
285# <i>modules-update</i>
253</p> 286</pre>
287</p>
254<note> 288<note>
255Running <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>
256</note> 290</note>
257<p> 291<p>
258You 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.
259</p> 293</p>
260<pre> 294<pre caption="/etc/devfsd.conf">
261# nano -w /etc/devfsd.conf
262</pre>
263<pre>
264# ALSA/OSS stuff 295# ALSA/OSS stuff
265# Comment/change these if you want to change the permissions on 296# Comment/change these if you want to change the permissions on
266# the audio devices 297# the audio devices
267LOOKUP snd MODLOAD ACTION snd 298LOOKUP snd MODLOAD ACTION snd
268LOOKUP dsp MODLOAD 299LOOKUP dsp MODLOAD
283 <title>Adding alsasound to a runlevel</title> 314 <title>Adding alsasound to a runlevel</title>
284<body> 315<body>
285<p> 316<p>
286First 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:
287<pre> 318<pre>
288# <c>rc-update add alsasound boot</c> 319# <i>rc-update add alsasound boot</i>
289</pre> 320</pre>
290</p> 321</p>
291<p> 322<p>
292<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>
293</p> 324</p>
298<body> 329<body>
299<p> 330<p>
300Since 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.
301</p> 332</p>
302<pre> 333<pre>
303# <c>/etc/init.d/alsasound start</c> 334# <i>/etc/init.d/alsasound start</i>
304</pre> 335</pre>
305<p> 336<p>
306ALSA 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>.
307However, sound won't work yet, because the channels are still muted. We need <c>alsa-utils</c> for this. 338However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this.
308</p> 339</p>
309<pre> 340<pre caption = "Running amixer">
310# <c>emerge alsa-utils</c>
311# <c>amixer</c> 341# <i>amixer</i>
312</pre> 342</pre>
313<p> 343<p>
314<warn> 344<warn>
315You 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
316<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.
317</warn> 347</warn>
318</p> 348</p>
319<pre caption="only if you get an error when running amixer"> 349<pre caption="only if you get an error when running amixer">
320# <c>insmod snd-mixer-oss</c> 350# <i>modprobe snd-mixer-oss</i>
321# <c>insmod snd-pcm-oss</c> 351# <i>modprobe snd-pcm-oss</i>
322# <c>amixer</c> 352# <i>amixer</i>
323</pre>
324<p>
325If you got this far, now unmute both Master and PCM channels.
326</p>
327<p>
328<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">
329# <c>amixer set Master 100 unmute</c> 361# <i>amixer set Master 100 unmute</i>
330# <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>
331# <c>aplay /usr/kde/3/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>
332</pre> 368</pre>
333</p> 369</p>
334We 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.
335Then, 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".
336<p> 372<p>
348<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>
349<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
350have 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
351<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 387<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
352<pre caption="needed after each kernel compile"> 388<pre caption="needed after each kernel compile">
353emerge alsa-driver 389# <i>emerge alsa-driver</i>
354</pre> 390</pre>
355</body> 391</body>
356</section> 392</section>
357<section> 393<section>
358 <title>/etc/modules.autoload</title> 394 <title>/etc/modules.autoload</title>
361load the correct modules at startup.</p> 397load the correct modules at startup.</p>
362<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.
363Check 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>
364</body> 400</body>
365</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
366<section> 423<section>
367 <title>More links..</title> 424 <title>More links..</title>
368<body> 425<body>
369<p> 426<p>
370You could check these for additional info: 427You could check these for additional info:
371</p> 428</p>
372<p> 429<p>
373<ul> 430<ul>
374<li><uri link="http://www.gentoo.org/doc/desktop.html">The Gentoo Linux Desktop Configuration Guide</uri></li> 431<li><uri link="http://www.gentoo.org/doc/en/desktop.xml">The Gentoo Linux Desktop Configuration Guide</uri></li>
375<li><uri link="http://www.alsa-project.org">ALSA Project Homepage</uri></li> 432<li><uri link="http://www.alsa-project.org">ALSA Project Homepage</uri></li>
376<li><uri link="http://www.alsa-project.org/documentation.php3">ALSA Users Documentation</uri></li> 433<li><uri link="http://www.alsa-project.org/documentation.php3">ALSA Users Documentation</uri></li>
377<li><uri link="http://www.djcj.org">ALSA Howto's and FAQ's</uri></li> 434<li><uri link="http://www.djcj.org">ALSA Howto's and FAQ's</uri></li>
378<li><uri link="http://tldp.org/HOWTO/Sound-HOWTO/index.html">Linux Sound HOWTO</uri></li> 435<li><uri link="http://tldp.org/HOWTO/Sound-HOWTO/index.html">Linux Sound HOWTO</uri></li>
379<li><uri link="http://linux-sound.org/">Sound and MIDI Software For Linux</uri></li> 436<li><uri link="http://linux-sound.org/">Sound and MIDI Software For Linux</uri></li>

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

  ViewVC Help
Powered by ViewVC 1.1.20