/[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.7 Revision 1.14
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
25<license/>
13 26
14<abstract> 27<abstract>
15This guide will show you how to set up the Advanced Linux Sound Architecture (ALSA) on Gentoo Linux. 28This 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> 29In addition to the Gentoo Linux Desktop Configuration Guide, this guide is supposed to give you more information on this subject. </abstract>
17 30
18<version>1.2</version> 31<version>1.3.1</version>
19<date>09 February 2003</date> 32<date>September 12, 2003</date>
20 33
21<chapter> 34<chapter>
22<title>Introduction</title> 35<title>Introduction</title>
23<section> 36<section>
24 <title>What is ALSA?</title> 37 <title>What is ALSA?</title>
80<title>Installation</title> 93<title>Installation</title>
81<section> 94<section>
82 <title>Kernel modules</title> 95 <title>Kernel modules</title>
83<body> 96<body>
84<p> 97<p>
85Since we're still using 2.4.x kernel sources, we'll have to compile kernel modules and ALSA modules separately. 98Since 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> 99</p>
87<p> 100<p>
88First we'll make sure that our kernel configuration is ready for use with ALSA. 101First 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). 102All 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>. 103This will build <c>soundcore.o</c>.
136<body> 149<body>
137 150
138<p> 151<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 152Now 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 153and type of your soundcard by looking at the output of /proc/pci
141<pre>#<c>grep audio /proc/pci</c></pre> 154<pre># <c>grep audio /proc/pci</c></pre>
142</p> 155</p>
143 156
144<p> 157<p>
145<warn> 158<warn>
146If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>. 159If you had a previous sound setup and there are still non-ALSA sound modules loaded, unload them <e>now</e>.
151<p> 164<p>
152We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers. 165We could simply do an <c>emerge alsa-driver</c> now, this would compile and install <e>all</e> ALSA sound drivers.
153</p> 166</p>
154<p> 167<p>
155However, to save some time, lookup the <e>Module Name</e> of your soundcard(s) on the 168However, 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. 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.
157Mine is <c>EMU10K1</c>, since I have an SBlive! soundcard. 170Mine 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. 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.
159</p>
160
161<p> 172</p>
173
162<pre> 174<pre>
163# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 175# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c>
164</pre> 176</pre>
165</p> 177<note>
166<p> 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>.
179For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c>
180</note>
181
167<note> 182<note>
168When you want to install ALSA drivers for more than one soundcard, you could set ALSA_CARDS to a space-separated list 183When 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> 184of drivers; like this: <c>env ALSA_CARDS='emu10k1 intel8x0 ens1370' emerge alsa-driver</c>
170</note> 185</note>
171 186
172<note>If you want to have OSS compatibility, make sure to emerge <i>alsa-oss</i>, it is the ALSA/OSS compatibility 187<note>If you want to have OSS compatibility, make sure to emerge <i>alsa-oss</i>, it is the ALSA/OSS compatibility
173wrapper. </note> 188wrapper. </note>
174 189
175</p> 190<note>If you plan on recompiling your kernels numerous times, it might
191be adviseable to emerge <c>alsa-driver</c> with <c>--buildpkg</c>. This
192will create a binary package for it. Later, after recompiling your kernel,
193you can just do <c>emerge --usepkg alsa-driver</c> which will install the
194binary package instead of recompiling it completely.</note>
195
176<p> 196<p>
177After this, the ALSA modules should be installed on your system. 197After this, the ALSA modules should be installed on your system.
178</p> 198</p>
179</body> 199</body>
180</section> 200</section>
183<body> 203<body>
184<p> 204<p>
185Let's start configuring now to get ALSA working properly. 205Let'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. 206We'll need to edit some files, to let our system know about the freshly installed ALSA modules.
187</p> 207</p>
208
209<p>
210First, install <c>alsa-utils</c> on your system:
188<p> 211</p>
212
213<pre caption = "Emerging alsa-utils">
214# <i>emerge alsa-utils</i>
215</pre>
216
217<p>
189First file to edit is <path>/etc/modules.d/alsa</path>. 218Hereafter, we need to edit <path>/etc/modules.d/alsa</path>.
190</p> 219</p>
191<warn> 220<warn>
192There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>. 221There is no need to edit <path>/etc/modules.conf</path>. Instead, always edit files in <path>/etc/modules.d</path>.
193</warn> 222</warn>
194<p> 223<p>
195Check the ALSA portion <e>at the bottom of the file</e>. 224Check the ALSA portion <e>at the bottom of the file</e>.
196By tweaking this line you can specify the max number of soundcards you have (generally, just one). 225By tweaking this line you can specify the max number of soundcards you have (generally, just one).
197</p> 226</p>
198<p> 227<p>
199<pre caption="At the top of /etc/modules.d/alsa"> 228<pre caption="At the bottom of /etc/modules.d/alsa">
200# Alsa 0.9.X kernel modules' configuration file. 229# 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
204alias char-major-116 snd
205<c>options snd major=116 cards_limit=1</c> 230<c>options snd cards_limit=1</c>
206# OSS/Free portion
207alias char-major-14 soundcore
208
209##
210## IMPORTANT:
211</pre> 231</pre>
212</p> 232</p>
213<p> 233<p>
214Now we'll specify the sounddriver(s) ALSA should use. In the same file, edit like this: 234Now 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"> 235<pre caption="In /etc/modules.d/alsa">
216## and then run `update-modules' command. 236## and then run `modules-update' command.
217## Read alsa-driver's INSTALL file in /usr/share/doc for more info. 237## Read alsa-driver's INSTALL file in /usr/share/doc for more info.
218## 238##
219## ALSA portion 239## ALSA portion
220<c>alias snd-card-0 snd-emu10k1</c> 240<c>alias snd-card-0 snd-emu10k1</c>
221<c>## If you have more than one, add: 241<c>## If you have more than one, add:
234<uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/c1660.htm">Chapter 6</uri> 254<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>. 255of the <uri link="http://www.alsa-project.org/alsa-doc/alsa-howto/alsa-howto.html">ALSA Howto</uri>.
236</note> 256</note>
237</p> 257</p>
238<p> 258<p>
239Last thing to do in this file, at the very bottom, check if these lines are there and uncommented: 259Last 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"> 260<pre caption="Near the end of /etc/modules.d/alsa">
241alias /dev/mixer snd-mixer-oss 261alias /dev/mixer snd-mixer-oss
242alias /dev/dsp snd-pcm-oss 262alias /dev/dsp snd-pcm-oss
243alias /dev/midi snd-seq-oss 263alias /dev/midi snd-seq-oss
244</pre> 264</pre>
245</p> 265</p>
246<p> 266<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>. 267Now 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> 268<pre>
269# <i>modules-update</i>
251</p> 270</pre>
271</p>
252<note> 272<note>
253Running <c>update-modules</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path> 273Running <c>modules-update</c> here will insert the data from <path>/etc/modules.d/alsa</path> into <path>/etc/modules.conf</path>
254</note> 274</note>
255<p> 275<p>
256You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered. 276You should also verify that /etc/devfsd.conf has the alsa devices and permissions correctly registered.
257</p> 277</p>
258<pre> 278<pre caption="/etc/devfsd.conf">
259# nano -w /etc/devfsd.conf
260</pre>
261<pre>
262# ALSA/OSS stuff 279# ALSA/OSS stuff
263# Comment/change these if you want to change the permissions on 280# Comment/change these if you want to change the permissions on
264# the audio devices 281# the audio devices
265LOOKUP snd MODLOAD ACTION snd 282LOOKUP snd MODLOAD ACTION snd
266LOOKUP dsp MODLOAD 283LOOKUP dsp MODLOAD
300<pre> 317<pre>
301# <c>/etc/init.d/alsasound start</c> 318# <c>/etc/init.d/alsasound start</c>
302</pre> 319</pre>
303<p> 320<p>
304ALSA is running now. If everything is ok, you should be able to see the ALSA modules loaded when running <c>lsmod</c>. 321ALSA 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. 322However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this.
306</p> 323</p>
307<pre> 324<pre caption = "Running amixer">
308# <c>emerge alsa-utils</c>
309# <c>amixer</c> 325# <i>amixer</i>
310</pre> 326</pre>
311<p> 327<p>
312<warn> 328<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 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 insmod
314<c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again. 330<c>snd-mixer-oss</c> and <c>snd-pcm-oss</c> once. After that run amixer again.
318# <c>insmod snd-mixer-oss</c> 334# <c>insmod snd-mixer-oss</c>
319# <c>insmod snd-pcm-oss</c> 335# <c>insmod snd-pcm-oss</c>
320# <c>amixer</c> 336# <c>amixer</c>
321</pre> 337</pre>
322<p> 338<p>
323If you got this far, now unmute both Master and PCM channels. 339If you got this far, now unmute Master and PCM channels. Some hardware
324</p> 340even requires you to unmute the center channel or even the surround
341channel.
325<p> 342</p>
326<pre> 343<p>
344<pre caption = "Unmuting channels">
327# <c>amixer set Master 100 unmute</c> 345# <i>amixer set Master 100 unmute</i>
328# <c>amixer set PCM 100 unmute</c> 346# <i>amixer set PCM 100 unmute</i>
347<comment>Only if the above doesn't succeed on its own:</comment>
348# <i>amixer set Center 100 unmute</i>
349# <i>amixer set Surround 100 unmute</i>
350<comment>Test the sound:</comment>
329# <c>aplay /usr/kde/3/share/sounds/pop.wav</c> <codenote>(pop.wav is part of KDE)</codenote> 351# <i>aplay $KDEDIR/share/sounds/pop.wav</i> <codenote>(pop.wav is part of KDE)</codenote>
330</pre> 352</pre>
331</p> 353</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. 354We 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". 355Then, adjust the volume settings to your liking; the ncurses-based <c>alsamixer</c> is a great way to get them "just so".
334<p> 356<p>
346<p>When you ever rebuild your kernel, or upgrade to another kernel, you'll have to rebuild the ALSA modules.</p> 368<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 369<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 370have to be installed again, since it will put the alsa modules in
349<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 371<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
350<pre caption="needed after each kernel compile"> 372<pre caption="needed after each kernel compile">
351emerge alsa-driver 373# <c>emerge alsa-driver</c>
352</pre> 374</pre>
353</body> 375</body>
354</section> 376</section>
355<section> 377<section>
356 <title>/etc/modules.autoload</title> 378 <title>/etc/modules.autoload</title>
367<p> 389<p>
368You could check these for additional info: 390You could check these for additional info:
369</p> 391</p>
370<p> 392<p>
371<ul> 393<ul>
372<li><uri link="http://www.gentoo.org/doc/desktop.html">The Gentoo Linux Desktop Configuration Guide</uri></li> 394<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> 395<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> 396<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> 397<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> 398<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> 399<li><uri link="http://linux-sound.org/">Sound and MIDI Software For Linux</uri></li>

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.14

  ViewVC Help
Powered by ViewVC 1.1.20