| … | |
… | |
| 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 | |
|
|
22 | <license/> |
| 13 | |
23 | |
| 14 | <abstract> |
24 | <abstract> |
| 15 | This guide will show you how to set up the Advanced Linux Sound Architecture (ALSA) on Gentoo Linux. |
25 | This guide will show you how to set up the Advanced Linux Sound Architecture (ALSA) on Gentoo Linux. |
| 16 | In addition to the Gentoo Linux Desktop Configuration Guide, this guide is supposed to give you more information on this subject. </abstract> |
26 | In addition to the Gentoo Linux Desktop Configuration Guide, this guide is supposed to give you more information on this subject. </abstract> |
| 17 | |
27 | |
| 18 | <version>1.2</version> |
28 | <version>1.2</version> |
| 19 | <date>09 February 2003</date> |
29 | <date>5 June 2003</date> |
| 20 | |
30 | |
| 21 | <chapter> |
31 | <chapter> |
| 22 | <title>Introduction</title> |
32 | <title>Introduction</title> |
| 23 | <section> |
33 | <section> |
| 24 | <title>What is ALSA?</title> |
34 | <title>What is ALSA?</title> |
| … | |
… | |
| 80 | <title>Installation</title> |
90 | <title>Installation</title> |
| 81 | <section> |
91 | <section> |
| 82 | <title>Kernel modules</title> |
92 | <title>Kernel modules</title> |
| 83 | <body> |
93 | <body> |
| 84 | <p> |
94 | <p> |
| 85 | Since we're still using 2.4.x kernel sources, we'll have to compile kernel modules and ALSA modules separately. |
95 | Since 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> |
96 | </p> |
| 87 | <p> |
97 | <p> |
| 88 | First we'll make sure that our kernel configuration is ready for use with ALSA. |
98 | First we'll make sure that our kernel configuration is ready for use with ALSA. |
| 89 | All you need in your kernel configuration is having Sound Card Support set to be built as a module (M). |
99 | All you need in your kernel configuration is having Sound Card Support set to be built as a module (M). |
| 90 | This will build <c>soundcore.o</c>. |
100 | This will build <c>soundcore.o</c>. |
| … | |
… | |
| 136 | <body> |
146 | <body> |
| 137 | |
147 | |
| 138 | <p> |
148 | <p> |
| 139 | Now it's time to install the ALSA drivers for your soundcard(s). If your soundcard is PCI, you can find out the name |
149 | Now it's time to install the ALSA drivers for your soundcard(s). If your soundcard is PCI, you can find out the name |
| 140 | and type of your soundcard by looking at the output of /proc/pci |
150 | and type of your soundcard by looking at the output of /proc/pci |
| 141 | <pre>#<c>grep audio /proc/pci</c></pre> |
151 | <pre># <c>grep audio /proc/pci</c></pre> |
| 142 | </p> |
152 | </p> |
| 143 | |
153 | |
| 144 | <p> |
154 | <p> |
| 145 | <warn> |
155 | <warn> |
| 146 | If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>. |
156 | If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>. |
| … | |
… | |
| 151 | <p> |
161 | <p> |
| 152 | We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers. |
162 | We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers. |
| 153 | </p> |
163 | </p> |
| 154 | <p> |
164 | <p> |
| 155 | However, to save some time, lookup the <e>Module Name</e> of your soundcard(s) on the |
165 | However, 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. |
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. |
| 157 | Mine is <c>EMU10K1</c>, since I have an SBlive! soundcard. |
167 | Mine is <c>snd-emu10k1</c>, since I have an SBlive! soundcard, with the <e>EMU10K1</e> chipset. |
| 158 | We'll set ALSA_CARDS environment to this value before emerging, so emerge will only compile the drivers we need. |
168 | We'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> |
169 | </p> |
| 160 | |
170 | |
| 161 | <p> |
171 | <p> |
| 162 | <pre> |
172 | <pre> |
| 163 | # <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> |
173 | # <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> |
| 164 | </pre> |
174 | </pre> |
| 165 | </p> |
175 | </p> |
| 166 | <p> |
176 | <p> |
|
|
177 | <note> |
|
|
178 | You 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>. |
|
|
179 | For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c> |
|
|
180 | </note> |
|
|
181 | |
| 167 | <note> |
182 | <note> |
| 168 | When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list |
183 | When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list |
| 169 | of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c> |
184 | of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c> |
| 170 | </note> |
185 | </note> |
| 171 | |
186 | |
| … | |
… | |
| 183 | <body> |
198 | <body> |
| 184 | <p> |
199 | <p> |
| 185 | Let's start configuring now to get ALSA working properly. |
200 | Let's start configuring now to get ALSA working properly. |
| 186 | We'll need to edit some files, to let our system know about the freshly installed ALSA modules. |
201 | We'll need to edit some files, to let our system know about the freshly installed ALSA modules. |
| 187 | </p> |
202 | </p> |
|
|
203 | |
|
|
204 | <p> |
|
|
205 | First, install <c>alsa-utils</c> on your system: |
| 188 | <p> |
206 | </p> |
|
|
207 | |
|
|
208 | <pre caption = "Emerging alsa-utils"> |
|
|
209 | # <i>emerge alsa-utils</i> |
|
|
210 | </pre> |
|
|
211 | |
|
|
212 | <p> |
| 189 | First file to edit is <path>/etc/modules.d/alsa</path>. |
213 | Hereafter, we need to edit <path>/etc/modules.d/alsa</path>. |
| 190 | </p> |
214 | </p> |
| 191 | <warn> |
215 | <warn> |
| 192 | There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>. |
216 | There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>. |
| 193 | </warn> |
217 | </warn> |
| 194 | <p> |
218 | <p> |
| 195 | Check the ALSA portion <e>at the bottom of the file</e>. |
219 | Check the ALSA portion <e>at the bottom of the file</e>. |
| 196 | By tweaking this line you can specify the max number of soundcards you have (generally, just one). |
220 | By tweaking this line you can specify the max number of soundcards you have (generally, just one). |
| 197 | </p> |
221 | </p> |
| 198 | <p> |
222 | <p> |
| 199 | <pre caption="At the top of /etc/modules.d/alsa"> |
223 | <pre caption="At the bottom of /etc/modules.d/alsa"> |
| 200 | # Alsa 0.9.X kernel modules' configuration file. |
224 | # Set this to the correct number of cards. |
| 201 | # $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.7 2003/02/09 23:27:14 zhen Exp $ |
|
|
| 202 | |
|
|
| 203 | # ALSA portion |
|
|
| 204 | alias char-major-116 snd |
|
|
| 205 | <c>options snd major=116 cards_limit=1</c> |
225 | <c>options snd cards_limit=1</c> |
| 206 | # OSS/Free portion |
|
|
| 207 | alias char-major-14 soundcore |
|
|
| 208 | |
|
|
| 209 | ## |
|
|
| 210 | ## IMPORTANT: |
|
|
| 211 | </pre> |
226 | </pre> |
| 212 | </p> |
227 | </p> |
| 213 | <p> |
228 | <p> |
| 214 | Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this: |
229 | Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this: |
| 215 | <pre caption="A bit lower in /etc/modules.d/alsa"> |
230 | <pre caption="In /etc/modules.d/alsa"> |
| 216 | ## and then run `update-modules' command. |
231 | ## and then run `update-modules' command. |
| 217 | ## Read alsa-driver's INSTALL file in /usr/share/doc for more info. |
232 | ## Read alsa-driver's INSTALL file in /usr/share/doc for more info. |
| 218 | ## |
233 | ## |
| 219 | ## ALSA portion |
234 | ## ALSA portion |
| 220 | <c>alias snd-card-0 snd-emu10k1</c> |
235 | <c>alias snd-card-0 snd-emu10k1</c> |
| … | |
… | |
| 234 | <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri> |
249 | <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri> |
| 235 | of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>. |
250 | of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>. |
| 236 | </note> |
251 | </note> |
| 237 | </p> |
252 | </p> |
| 238 | <p> |
253 | <p> |
| 239 | Last thing to do in this file, at the very bottom, check if these lines are there and uncommented: |
254 | Last thing to do in this file, almost at the end, check if these lines are there and uncommented: |
| 240 | <pre caption="at the very bottom of /etc/modules.d/alsa"> |
255 | <pre caption="Near the end of /etc/modules.d/alsa"> |
| 241 | alias /dev/mixer snd-mixer-oss |
256 | alias /dev/mixer snd-mixer-oss |
| 242 | alias /dev/dsp snd-pcm-oss |
257 | alias /dev/dsp snd-pcm-oss |
| 243 | alias /dev/midi snd-seq-oss |
258 | alias /dev/midi snd-seq-oss |
| 244 | </pre> |
259 | </pre> |
| 245 | </p> |
260 | </p> |
| … | |
… | |
| 253 | Running <c>update-modules</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path> |
268 | Running <c>update-modules</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path> |
| 254 | </note> |
269 | </note> |
| 255 | <p> |
270 | <p> |
| 256 | You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered. |
271 | You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered. |
| 257 | </p> |
272 | </p> |
| 258 | <pre> |
273 | <pre caption="/etc/devfsd.conf"> |
| 259 | # nano -w /etc/devfsd.conf |
|
|
| 260 | </pre> |
|
|
| 261 | <pre> |
|
|
| 262 | # ALSA/OSS stuff |
274 | # ALSA/OSS stuff |
| 263 | # Comment/change these if you want to change the permissions on |
275 | # Comment/change these if you want to change the permissions on |
| 264 | # the audio devices |
276 | # the audio devices |
| 265 | LOOKUP snd MODLOAD ACTION snd |
277 | LOOKUP snd MODLOAD ACTION snd |
| 266 | LOOKUP dsp MODLOAD |
278 | LOOKUP dsp MODLOAD |
| … | |
… | |
| 300 | <pre> |
312 | <pre> |
| 301 | # <c>/etc/init.d/alsasound start</c> |
313 | # <c>/etc/init.d/alsasound start</c> |
| 302 | </pre> |
314 | </pre> |
| 303 | <p> |
315 | <p> |
| 304 | ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>. |
316 | ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>. |
| 305 | However, sound won't work yet, because the channels are still muted. We need <c>alsa-utils</c> for this. |
317 | However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this. |
| 306 | </p> |
318 | </p> |
| 307 | <pre> |
319 | <pre caption = "Running amixer"> |
| 308 | # <c>emerge alsa-utils</c> |
|
|
| 309 | # <c>amixer</c> |
320 | # <i>amixer</i> |
| 310 | </pre> |
321 | </pre> |
| 311 | <p> |
322 | <p> |
| 312 | <warn> |
323 | <warn> |
| 313 | You 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 |
324 | You 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 |
| 314 | <c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again. |
325 | <c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again. |
| … | |
… | |
| 324 | </p> |
335 | </p> |
| 325 | <p> |
336 | <p> |
| 326 | <pre> |
337 | <pre> |
| 327 | # <c>amixer set Master 100 unmute</c> |
338 | # <c>amixer set Master 100 unmute</c> |
| 328 | # <c>amixer set PCM 100 unmute</c> |
339 | # <c>amixer set PCM 100 unmute</c> |
| 329 | # <c>aplay /usr/kde/3/share/sounds/pop.wav</c> <codenote>(pop.wav is part of KDE)</codenote> |
340 | # <c>aplay $KDEDIR/share/sounds/pop.wav</c> <codenote>(pop.wav is part of KDE)</codenote> |
| 330 | </pre> |
341 | </pre> |
| 331 | </p> |
342 | </p> |
| 332 | We check to see if sound is working by using the aplay (alsa play) command. If you hear a pop, then sound is indeed working. |
343 | We check to see if sound is working by using the aplay (alsa play) command. If you hear a pop, then sound is indeed working. |
| 333 | Then, adjust the volume settings to your liking; the ncurses-based <c>alsamixer</c> is a great way to get them "just so". |
344 | Then, adjust the volume settings to your liking; the ncurses-based <c>alsamixer</c> is a great way to get them "just so". |
| 334 | <p> |
345 | <p> |
| … | |
… | |
| 346 | <p>When you ever rebuild your kernel, or upgrade to another kernel, you'll have to rebuild the ALSA modules.</p> |
357 | <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 |
358 | <p>Although you might have installed <c>alsa-driver</c>, <c>alsa-libs</c> and <c>alsa-utils</c>, only the first will |
| 348 | have to be installed again, since it will put the alsa modules in |
359 | have to be installed again, since it will put the alsa modules in |
| 349 | <path>/lib/modules/*/kernel/sound/pci/</path>.</p> |
360 | <path>/lib/modules/*/kernel/sound/pci/</path>.</p> |
| 350 | <pre caption="needed after each kernel compile"> |
361 | <pre caption="needed after each kernel compile"> |
| 351 | emerge alsa-driver |
362 | # <c>emerge alsa-driver</c> |
| 352 | </pre> |
363 | </pre> |
| 353 | </body> |
364 | </body> |
| 354 | </section> |
365 | </section> |
| 355 | <section> |
366 | <section> |
| 356 | <title>/etc/modules.autoload</title> |
367 | <title>/etc/modules.autoload</title> |
| … | |
… | |
| 367 | <p> |
378 | <p> |
| 368 | You could check these for additional info: |
379 | You could check these for additional info: |
| 369 | </p> |
380 | </p> |
| 370 | <p> |
381 | <p> |
| 371 | <ul> |
382 | <ul> |
| 372 | <li><uri link="http://www.gentoo.org/doc/desktop.html">The Gentoo Linux Desktop Configuration Guide</uri></li> |
383 | <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> |
384 | <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> |
385 | <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> |
386 | <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> |
387 | <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> |
388 | <li><uri link="http://linux-sound.org/">Sound and MIDI Software For Linux</uri></li> |