/[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.15 Revision 1.16
9<author title="Author"><mail link="g2boojum@gentoo.org"> 9<author title="Author"><mail link="g2boojum@gentoo.org">
10 Grant Goodyear</mail> 10 Grant Goodyear</mail>
11</author> 11</author>
12<author title="Author"><mail link="agenkin@gentoo.org"> 12<author title="Author"><mail link="agenkin@gentoo.org">
13 Arcady Genkin</mail> 13 Arcady Genkin</mail>
14</author> 14</author>
15<author title="Editor"><mail link="zhen@gentoo.org"> 15<author title="Editor"><mail link="zhen@gentoo.org">
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"> 21<author title="Editor"><mail link="bennyc@gentoo.org">
22 Benny Chuang</mail> 22 Benny Chuang</mail>
23</author> 23</author>
24<author title="Editor"><mail link="blubber@gentoo.org">
25 Tiemo Kieft</mail>
26</author>
24 27
25<license/> 28<license/>
26 29
27<abstract> 30<abstract>
28This 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.
29In 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>
30 33
31<version>1.3.1</version> 34<version>1.3.2</version>
32<date>September 12, 2003</date> 35<date>September 25, 2003</date>
33 36
34<chapter> 37<chapter>
35<title>Introduction</title> 38<title>Introduction</title>
36<section> 39<section>
37 <title>What is ALSA?</title> 40 <title>What is ALSA?</title>
38<body> 41<body>
39<p> 42<p>
40The Advanced Linux Sound Architecture (ALSA) is a project to improve the Linux sound subsystem by rewriting 43The Advanced Linux Sound Architecture (ALSA) is a project to improve the Linux sound subsystem by rewriting
41large chunks of it. 44large chunks of it.
42It is anticipated that ALSA will make it into Linux kernel 2.6.x (or 3.x.x -- whichever comes first) as it becomes ready. 45It is anticipated that ALSA will make it into Linux kernel 2.6.x (or 3.x.x -- whichever comes first) as it becomes ready.
43</p> 46</p>
44 47
45<p> 48<p>
46ALSA provides audio and MIDI functionality for Linux. 49ALSA provides audio and MIDI functionality for Linux.
47</p> 50</p>
100<p> 103<p>
101First we'll make sure that our kernel configuration is ready for use with ALSA. 104First we'll make sure that our kernel configuration is ready for use with ALSA.
102All you need in your kernel configuration is having Sound Card Support set to be built as a module (M). 105All you need in your kernel configuration is having Sound Card Support set to be built as a module (M).
103This will build <c>soundcore.o</c>. 106This will build <c>soundcore.o</c>.
104</p> 107</p>
105<p> 108<p>
106<note> 109<note>
107Possibly, this will also work when you built Sound Card Support in the kernel (Y) instead of building it as a module (M). 110Possibly, this will also work when you built Sound Card Support in the kernel (Y) instead of building it as a module (M).
108However, the official ALSA documentation suggests building it as a module, since ALSA will try loading it. 111However, the official ALSA documentation suggests building it as a module, since ALSA will try loading it.
109</note> 112</note>
110</p> 113</p>
111<p>If you already have a working kernel configuration, make sure you remove all sound drivers (except for Sound Card Support). 114<p>If you already have a working kernel configuration, make sure you remove all sound drivers (except for Sound Card Support).
112If you wish to do this without having to reboot, you could do like this: 115If you wish to do this without having to reboot, you could do like this:
113</p> 116</p>
114<pre> 117<pre>
115# <c>cd /usr/src/linux</c> 118# <i>cd /usr/src/linux</i>
116# <c>cp .config ~/</c> 119# <i>cp .config ~/</i>
117# <c>make mrproper</c> 120# <i>make mrproper</i>
118# <c>cp ~/.config .</c> 121# <i>cp ~/.config .</i>
119# <c>make menuconfig</c> 122# <i>make menuconfig</i>
120</pre> 123</pre>
121<p> 124<p>
122Now select <e>Sound Card Support</e> as Module (M) and deselect all other sound drivers. 125Now select <e>Sound Card Support</e> as Module (M) and deselect all other sound drivers.
123Exit and say Y to save your kernel configuration. 126Exit and say Y to save your kernel configuration.
124After that, build the modules: 127After that, build the modules:
125</p> 128</p>
126<pre> 129<pre>
127# <c>make dep clean</c> 130# <i>make dep clean</i>
128# <c>make modules modules_install</c> 131# <i>make modules modules_install</i>
129</pre> 132</pre>
130<p> 133<p>
131Before installing your new modules, this last line will delete all your previous modules, 134Before installing your new modules, this last line will delete all your previous modules,
132even the ones from a previous ALSA installation. 135even the ones from a previous ALSA installation.
133</p> 136</p>
134<p> 137<p>
135<impo> 138<impo>
136This means, whenever you recompile your kernel later on, you MUST recompile <c>alsa-driver</c>. 139This means, whenever you recompile your kernel later on, you MUST recompile <c>alsa-driver</c>.
137</impo> 140</impo>
138</p> 141</p>
139<p> 142<p>
140<note>However, there's no need to reinstall <c>nvidia-kernel</c>, the Nvidia drivers are in a separate directory 143<note>However, there's no need to reinstall <c>nvidia-kernel</c>, the Nvidia drivers are in a separate directory
141in <path>/lib/modules/*/video</path> and won't get deleted by a <c>make modules modules_install</c> 144in <path>/lib/modules/*/video</path> and won't get deleted by a <c>make modules modules_install</c>
142</note> 145</note>
143</p> 146</p>
144</body> 147</body>
145</section> 148</section>
146 149
147<section> 150<section>
148 <title>ALSA modules</title> 151 <title>ALSA modules</title>
149<body> 152<body>
150 153
151<p> 154<p>
152Now it's time to install the ALSA drivers for your soundcard(s). If your soundcard is PCI, you can find out the name 155Now it's time to install the ALSA drivers for your soundcard(s). If your soundcard is PCI, you can find out the name
153and type of your soundcard by looking at the output of /proc/pci 156and type of your soundcard by looking at the output of /proc/pci.
154<pre># <c>grep audio /proc/pci</c></pre> 157</p>
158<pre>
159# <i>grep audio /proc/pci</i>
155</p> 160</pre>
161
156 162
157<p> 163<p>
158<warn> 164<warn>
159If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>. 165If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>.
160Check with <c>lsmod</c> and use <c>rmmod</c> to unload all sound-related modules on your system. 166Check with <c>lsmod</c> and use <c>rmmod</c> to unload all sound-related modules on your system.
161</warn> 167</warn>
162</p> 168</p>
163 169
164<p> 170<p>
165We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers. 171We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers.
166</p> 172</p>
167<p> 173<p>
168However, to save some time, lookup the <e>Module Name</e> of your soundcard(s) on the 174However, to save some time, lookup the <e>Module Name</e> of your soundcard(s) on the
169<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. 175<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.
170Mine is <c>snd-emu10k1</c>, since I have an SBlive! soundcard, with the <e>EMU10K1</e> chipset. 176Mine is <c>snd-emu10k1</c>, since I have an SBlive! soundcard, with the <e>EMU10K1</e> chipset.
171We'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. 177We'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.
172</p> 178</p>
173 179
174<pre> 180<pre>
175# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 181# <i>env ALSA_CARDS='emu10k1' emerge alsa-driver</i>
176</pre> 182</pre>
177<note> 183<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>. 184You 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> 185For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c>
180</note> 186</note>
181 187
182<note> 188<note>
183When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list 189When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list
184of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c> 190of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c>
185</note> 191</note>
186 192
187<note>If you want to have OSS compatibility, make sure to emerge <i>alsa-oss</i>, it is the ALSA/OSS compatibility 193<note>If you want to have OSS compatibility, make sure to emerge <i>alsa-oss</i>, it is the ALSA/OSS compatibility
188wrapper. </note> 194wrapper. </note>
189 195
190<note>If you plan on recompiling your kernels numerous times, it might 196<note>If you plan on recompiling your kernels numerous times, it might
212 218
213<pre caption = "Emerging alsa-utils"> 219<pre caption = "Emerging alsa-utils">
214# <i>emerge alsa-utils</i> 220# <i>emerge alsa-utils</i>
215</pre> 221</pre>
216 222
217<p> 223<p>
218Hereafter, we need to edit <path>/etc/modules.d/alsa</path>. 224Hereafter, we need to edit <path>/etc/modules.d/alsa</path>.
219</p> 225</p>
220<warn> 226<warn>
221There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>. 227There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>.
222</warn> 228</warn>
223<p> 229<p>
224Check the ALSA portion <e>at the bottom of the file</e>. 230Check the ALSA portion <e>at the bottom of the file</e>.
225By tweaking this line you can specify the max number of soundcards you have (generally, just one). 231By tweaking this line you can specify the max number of soundcards you have (generally, just one).
226</p> 232</p>
227<p>
228<pre caption="At the bottom of /etc/modules.d/alsa"> 233<pre caption="At the bottom of /etc/modules.d/alsa">
229# Set this to the correct number of cards. 234<comment>Set this to the correct number of cards.</comment>
230<c>options snd cards_limit=1</c> 235options snd cards_limit=1
231</pre>
232</p> 236</pre>
233<p> 237<p>
234Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this: 238Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this:
239</p>
235<pre caption="In /etc/modules.d/alsa"> 240<pre caption="In /etc/modules.d/alsa">
236## and then run `modules-update' command. 241## and then run `modules-update' command.
237## Read alsa-driver's INSTALL file in /usr/share/doc for more info. 242## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
238## 243##
239## ALSA portion 244## ALSA portion
240<c>alias snd-card-0 snd-emu10k1</c> 245alias snd-card-0 snd-emu10k1
241<c>## If you have more than one, add: 246<comment>## If you have more than one, add:</comment>
242## alias snd-card-1 snd-intel8x0 247## alias snd-card-1 snd-intel8x0
243## alias snd-card-2 snd-ens1370</c> 248## alias snd-card-2 snd-ens1370
244## OSS/Free portion 249## OSS/Free portion
245## alias sound-slot-0 snd-card-0 250## alias sound-slot-0 snd-card-0
246## alias sound-slot-1 snd-card-1 251## alias sound-slot-1 snd-card-1
247## 252##
248</pre> 253</pre>
249</p>
250<p>
251<note> 254<note>
252If you have more than one soundcard, adjust the <c>cards_limit</c> value and add more snd-card aliases to the file. 255If you have more than one soundcard, adjust the <c>cards_limit</c> value and add more snd-card aliases to the file.
253I don't have experience with this, but you can find examples for configurations with two or more soundcards in 256I don't have experience with this, but you can find examples for configurations with two or more soundcards in
254<uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri> 257<uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri>
255of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>. 258of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>.
256</note> 259</note>
257</p>
258<p> 260<p>
259Last thing to do in this file, almost at the end, check if these lines are there and uncommented: 261Last thing to do in this file, almost at the end, check if these lines are there and uncommented:
262</p>
260<pre caption="Near the end of /etc/modules.d/alsa"> 263<pre caption="Near the end of /etc/modules.d/alsa">
261alias /dev/mixer snd-mixer-oss 264alias /dev/mixer snd-mixer-oss
262alias /dev/dsp snd-pcm-oss 265alias /dev/dsp snd-pcm-oss
263alias /dev/midi snd-seq-oss 266alias /dev/midi snd-seq-oss
264</pre> 267</pre>
265</p>
266<p> 268<p>
267Now double-check the file <path>/etc/modules.d/alsa</path> and when you're sure everyting is ok, run <c>modules-update</c>. 269Now double-check the file <path>/etc/modules.d/alsa</path> and when you're sure everyting is ok, run <c>modules-update</c>.
268<pre> 270<pre>
269# <i>modules-update</i> 271# <i>modules-update</i>
270</pre> 272</pre>
271</p> 273</p>
272<note> 274<note>
273Running <c>modules-update</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path> 275Running <c>modules-update</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path>
274</note> 276</note>
275<p> 277<p>
276You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered. 278You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered.
277</p> 279</p>
278<pre caption="/etc/devfsd.conf"> 280<pre caption="/etc/devfsd.conf">
279# ALSA/OSS stuff 281# ALSA/OSS stuff
280# Comment/change these if you want to change the permissions on 282# Comment/change these if you want to change the permissions on
288</pre> 290</pre>
289<note> 291<note>
290Notice that devfsd.conf sets /dev/sound permissions to be root.audio. Thus, for non-root users to use audio they will have to be part of the audio group. 292Notice that devfsd.conf sets /dev/sound permissions to be root.audio. Thus, for non-root users to use audio they will have to be part of the audio group.
291</note> 293</note>
292</body> 294</body>
293</section> 295</section>
294</chapter> 296</chapter>
295<chapter> 297<chapter>
296<title>Starting ALSA</title> 298<title>Starting ALSA</title>
297<section> 299<section>
298 <title>Adding alsasound to a runlevel</title> 300 <title>Adding alsasound to a runlevel</title>
299<body> 301<body>
300<p> 302<p>
301First thing to do now, is to make ALSA startup at boottime. Like this: 303First thing to do now, is to make ALSA startup at boottime. Like this:
302<pre> 304<pre>
303# <c>rc-update add alsasound boot</c> 305# <i>rc-update add alsasound boot</i>
304</pre> 306</pre>
305</p> 307</p>
306<p> 308<p>
307<warn>Note that the alsasound script should be added to the "boot" runlevel, not the "default" runlevel.</warn> 309<warn>Note that the alsasound script should be added to the "boot" runlevel, not the "default" runlevel.</warn>
308</p> 310</p>
309</body> 311</body>
310</section> 312</section>
311<section> 313<section>
312 <title>Running and unmuting</title> 314 <title>Running and unmuting</title>
313<body> 315<body>
314<p> 316<p>
315Since we're Linux users, we don't want to reboot. So we'll start the alsasound script manually. 317Since we're Linux users, we don't want to reboot. So we'll start the alsasound script manually.
316</p> 318</p>
317<pre> 319<pre>
318# <c>/etc/init.d/alsasound start</c> 320# <i>/etc/init.d/alsasound start</i>
319</pre> 321</pre>
320<p> 322<p>
321ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>. 323ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>.
322However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this. 324However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this.
323</p> 325</p>
324<pre caption = "Running amixer"> 326<pre caption = "Running amixer">
325# <i>amixer</i> 327# <i>amixer</i>
326</pre> 328</pre>
327<p> 329<p>
328<warn> 330<warn>
329You 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 331You 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
330<c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again. 332<c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again.
331</warn> 333</warn>
332</p> 334</p>
333<pre caption="only if you get an error when running amixer"> 335<pre caption="only if you get an error when running amixer">
358</p> 360</p>
359When you reboot your system, the <e>alsasound</e> init script will properly save and restore your volume settings. 361When you reboot your system, the <e>alsasound</e> init script will properly save and restore your volume settings.
360</body> 362</body>
361</section> 363</section>
362</chapter> 364</chapter>
363<chapter> 365<chapter>
364<title>Final Notes</title> 366<title>Final Notes</title>
365<section> 367<section>
366 <title>After kernel-upgrades..</title> 368 <title>After kernel-upgrades..</title>
367<body> 369<body>
368<p>When you ever rebuild your kernel, or upgrade to another kernel, you'll have to rebuild the ALSA modules.</p> 370<p>When you ever rebuild your kernel, or upgrade to another kernel, you'll have to rebuild the ALSA modules.</p>
369<p>Although you might have installed <c>alsa-driver</c>, <c>alsa-libs</c> and <c>alsa-utils</c>, only the first will 371<p>Although you might have installed <c>alsa-driver</c>, <c>alsa-libs</c> and <c>alsa-utils</c>, only the first will
370have to be installed again, since it will put the alsa modules in 372have to be installed again, since it will put the alsa modules in
371<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 373<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
372<pre caption="needed after each kernel compile"> 374<pre caption="needed after each kernel compile">
373# <c>emerge alsa-driver</c> 375# <i>emerge alsa-driver</i>
374</pre> 376</pre>
375</body> 377</body>
376</section> 378</section>
377<section> 379<section>
378 <title>/etc/modules.autoload</title> 380 <title>/etc/modules.autoload</title>
379<body> 381<body>
380<p>You won't have to edit this file for use with ALSA. After our <c>rc-update add alsasound boot</c>, our system will 382<p>You won't have to edit this file for use with ALSA. After our <c>rc-update add alsasound boot</c>, our system will
381load the correct modules at startup.</p> 383load the correct modules at startup.</p>
382<p>It's not necessary to add <c>snd-pcm-oss</c> or <c>snd-mixer-oss</c> in this file. 384<p>It's not necessary to add <c>snd-pcm-oss</c> or <c>snd-mixer-oss</c> in this file.
383Check the <uri link="http://www.djcj.org/LAU/guide/alsbook/faq1.html">this FAQ</uri> for more info.</p> 385Check the <uri link="http://www.djcj.org/LAU/guide/alsbook/faq1.html">this FAQ</uri> for more info.</p>
384</body> 386</body>
385</section> 387</section>
386<section> 388<section>
387 <title>More links..</title> 389 <title>More links..</title>
388<body> 390<body>

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.20