/[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.6 Revision 1.17
4<guide link = "/doc/en/alsa-guide.xml"> 4<guide link = "/doc/en/alsa-guide.xml">
5<title>Gentoo Linux ALSA Guide</title> 5<title>Gentoo Linux ALSA Guide</title>
6<author title="Author"><mail link="zu@pandora.be"> 6<author title="Author"><mail link="zu@pandora.be">
7 Vincent Verleye</mail> 7 Vincent Verleye</mail>
8</author> 8</author>
9 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>
10<author title="Editor"><mail link="zhen@gentoo.org"> 15<author title="Editor"><mail link="zhen@gentoo.org">
11 John P. Davis</mail> 16 John P. Davis</mail>
12</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/>
13 29
14<abstract> 30<abstract>
15This 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.
16In 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>
17 33
18<version>1.1</version> 34<version>1.3.3</version>
19<date>12 January 2002</date> 35<date>October 9, 2003</date>
20 36
21<chapter> 37<chapter>
22<title>Introduction</title> 38<title>Introduction</title>
23<section> 39<section>
24 <title>What is ALSA?</title> 40 <title>What is ALSA?</title>
77</chapter> 93</chapter>
78 94
79<chapter> 95<chapter>
80<title>Installation</title> 96<title>Installation</title>
81<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>
82 <title>Kernel modules</title> 112 <title>Kernel modules</title>
83<body> 113<body>
84<p> 114<p>
85Since 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.
86</p> 116</p>
87<p> 117<p>
88First 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.
89All 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).
90This will build <c>soundcore.o</c>. 120This will build <c>soundcore.o</c>.
97</p> 127</p>
98<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).
99If 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:
100</p> 130</p>
101<pre> 131<pre>
102# <c>cd /usr/src/linux</c> 132# <i>cd /usr/src/linux</i>
103# <c>cp .config ~/</c> 133# <i>cp .config ~/</i>
104# <c>make mrproper</c> 134# <i>make mrproper</i>
105# <c>cp ~/.config .</c> 135# <i>cp ~/.config .</i>
106# <c>make menuconfig</c> 136# <i>make menuconfig</i>
107</pre> 137</pre>
108<p> 138<p>
109Now 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.
110Exit and say Y to save your kernel configuration. 140Exit and say Y to save your kernel configuration.
111After that, build the modules: 141After that, build the modules:
112</p> 142</p>
113<pre> 143<pre>
114# <c>make dep clean</c> 144# <i>make dep clean</i>
115# <c>make modules modules_install</c> 145# <i>make modules modules_install</i>
116</pre> 146</pre>
117<p> 147<p>
118Before 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,
119even the ones from a previous ALSA installation. 149even the ones from a previous ALSA installation.
120</p> 150</p>
135 <title>ALSA modules</title> 165 <title>ALSA modules</title>
136<body> 166<body>
137 167
138<p> 168<p>
139Now 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
140and 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.
141<pre>#<c>grep audio /proc/pci</c></pre> 171</p>
172<pre>
173# <i>grep audio /proc/pci</i>
142</p> 174</pre>
175
143 176
144<p> 177<p>
145<warn> 178<warn>
146If 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>.
147Check 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.
151<p> 184<p>
152We 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.
153</p> 186</p>
154<p> 187<p>
155However, 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
156<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.
157Mine 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.
158We'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.
159</p>
160
161<p> 192</p>
193
162<pre> 194<pre>
163# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 195# <i>env ALSA_CARDS='emu10k1' emerge alsa-driver</i>
164</pre>
165</p> 196</pre>
166<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
167<note> 202<note>
168When 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
169of 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>
170</note> 205</note>
171 206
172<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
173wrapper. </note> 208wrapper. </note>
174 209
175</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
176<p> 216<p>
177After this, the ALSA modules should be installed on your system. 217After this, the ALSA modules should be installed on your system.
178</p> 218</p>
179</body> 219</body>
180</section> 220</section>
183<body> 223<body>
184<p> 224<p>
185Let's start configuring now to get ALSA working properly. 225Let's start configuring now to get ALSA working properly.
186We'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.
187</p> 227</p>
228
229<p>
230First, install <c>alsa-utils</c> on your system:
188<p> 231</p>
232
233<pre caption = "Emerging alsa-utils">
234# <i>emerge alsa-utils</i>
235</pre>
236
237<p>
189First file to edit is <path>/etc/modules.d/alsa</path>. 238Hereafter, we need to edit <path>/etc/modules.d/alsa</path>.
190</p> 239</p>
191<warn> 240<warn>
192There 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>.
193</warn> 242</warn>
194<p> 243<p>
195Check the ALSA portion <e>at the top of the file</e>. 244Check the ALSA portion <e>at the bottom of the file</e>.
196By 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).
197</p>
198<p> 246</p>
199<pre caption="At the top of /etc/modules.d/alsa"> 247<pre caption="At the bottom of /etc/modules.d/alsa">
200# Alsa 0.9.X kernel modules' configuration file. 248<comment>Set this to the correct number of cards.</comment>
201# $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.6 2003/01/28 20:23:38 zhen Exp $ 249options snd cards_limit=1
202
203# ALSA portion
204alias char-major-116 snd
205<c>options snd major=116 cards_limit=1</c>
206# OSS/Free portion
207alias char-major-14 soundcore
208
209##
210## IMPORTANT:
211</pre>
212</p> 250</pre>
213<p> 251<p>
214Now 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>
215<pre caption="A bit lower in /etc/modules.d/alsa"> 254<pre caption="In /etc/modules.d/alsa">
216## and then run `update-modules' command. 255## and then run `modules-update' command.
217## 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.
218## 257##
219## ALSA portion 258## ALSA portion
220<c>alias snd-card-0 snd-emu10k1</c> 259alias snd-card-0 snd-emu10k1
221<c>## If you have more than one, add: 260<comment>## If you have more than one, add:</comment>
222## alias snd-card-1 snd-intel8x0 261## alias snd-card-1 snd-intel8x0
223## alias snd-card-2 snd-ens1370</c> 262## alias snd-card-2 snd-ens1370
224## OSS/Free portion 263## OSS/Free portion
225## alias sound-slot-0 snd-card-0 264## alias sound-slot-0 snd-card-0
226## alias sound-slot-1 snd-card-1 265## alias sound-slot-1 snd-card-1
227## 266##
228</pre> 267</pre>
229</p>
230<p>
231<note> 268<note>
232If 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.
233I 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
234<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>
235of 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>.
236</note> 273</note>
237</p> 274<p>
238<p>
239Last 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>
240<pre caption="at the very bottom of /etc/modules.d/alsa"> 277<pre caption="Near the end of /etc/modules.d/alsa">
241alias /dev/mixer snd-mixer-oss 278alias /dev/mixer snd-mixer-oss
242alias /dev/dsp snd-pcm-oss 279alias /dev/dsp snd-pcm-oss
243alias /dev/midi snd-seq-oss 280alias /dev/midi snd-seq-oss
244</pre> 281</pre>
245</p> 282<p>
246<p>
247Now 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>.
248<pre>
249# <c>update-modules</c>
250</pre> 284<pre>
285# <i>modules-update</i>
251</p> 286</pre>
287</p>
252<note> 288<note>
253Running <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>
254</note> 290</note>
255<p> 291<p>
256You 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.
257</p> 293</p>
258<pre> 294<pre caption="/etc/devfsd.conf">
259# nano -w /etc/devfsd.conf
260</pre>
261<pre>
262# ALSA/OSS stuff 295# ALSA/OSS stuff
263# Comment/change these if you want to change the permissions on 296# Comment/change these if you want to change the permissions on
264# the audio devices 297# the audio devices
265LOOKUP snd MODLOAD ACTION snd 298LOOKUP snd MODLOAD ACTION snd
266LOOKUP dsp MODLOAD 299LOOKUP dsp MODLOAD
281 <title>Adding alsasound to a runlevel</title> 314 <title>Adding alsasound to a runlevel</title>
282<body> 315<body>
283<p> 316<p>
284First 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:
285<pre> 318<pre>
286# <c>rc-update add alsasound boot</c> 319# <i>rc-update add alsasound boot</i>
287</pre> 320</pre>
288</p> 321</p>
289<p> 322<p>
290<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>
291</p> 324</p>
296<body> 329<body>
297<p> 330<p>
298Since 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.
299</p> 332</p>
300<pre> 333<pre>
301# <c>/etc/init.d/alsasound start</c> 334# <i>/etc/init.d/alsasound start</i>
302</pre> 335</pre>
303<p> 336<p>
304ALSA 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>.
305However, 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.
306</p> 339</p>
307<pre> 340<pre caption = "Running amixer">
308# <c>emerge alsa-utils</c>
309# <c>amixer</c> 341# <i>amixer</i>
310</pre> 342</pre>
311<p> 343<p>
312<warn> 344<warn>
313You 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
314<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.
315</warn> 347</warn>
316</p> 348</p>
317<pre caption="only if you get an error when running amixer"> 349<pre caption="only if you get an error when running amixer">
318# <c>insmod snd-mixer-oss</c> 350# <i>modprobe snd-mixer-oss</i>
319# <c>insmod snd-pcm-oss</c> 351# <i>modprobe snd-pcm-oss</i>
320# <c>amixer</c> 352# <i>amixer</i>
321</pre>
322<p>
323If you got this far, now unmute both Master and PCM channels.
324</p>
325<p>
326<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">
327# <c>amixer set Master 100 unmute</c> 361# <i>amixer set Master 100 unmute</i>
328# <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>
329# <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>
330</pre> 368</pre>
331</p> 369</p>
332We 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.
333Then, 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".
334<p> 372<p>
346<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>
347<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
348have 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
349<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 387<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
350<pre caption="needed after each kernel compile"> 388<pre caption="needed after each kernel compile">
351emerge alsa-driver 389# <i>emerge alsa-driver</i>
352</pre> 390</pre>
353</body> 391</body>
354</section> 392</section>
355<section> 393<section>
356 <title>/etc/modules.autoload</title> 394 <title>/etc/modules.autoload</title>
359load the correct modules at startup.</p> 397load the correct modules at startup.</p>
360<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.
361Check 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>
362</body> 400</body>
363</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
364<section> 423<section>
365 <title>More links..</title> 424 <title>More links..</title>
366<body> 425<body>
367<p> 426<p>
368You could check these for additional info: 427You could check these for additional info:
369</p> 428</p>
370<p> 429<p>
371<ul> 430<ul>
372<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>
373<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>
374<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>
375<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>
376<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>
377<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.6  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20