/[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.16
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.2</version> 34<version>1.3.2</version>
19<date>09 February 2003</date> 35<date>September 25, 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>
80<title>Installation</title> 96<title>Installation</title>
81<section> 97<section>
82 <title>Kernel modules</title> 98 <title>Kernel modules</title>
83<body> 99<body>
84<p> 100<p>
85Since we're still using 2.4.x kernel sources, we'll have to compile kernel modules and ALSA modules separately. 101Since 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> 102</p>
87<p> 103<p>
88First 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.
89All 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).
90This will build <c>soundcore.o</c>. 106This will build <c>soundcore.o</c>.
97</p> 113</p>
98<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).
99If 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:
100</p> 116</p>
101<pre> 117<pre>
102# <c>cd /usr/src/linux</c> 118# <i>cd /usr/src/linux</i>
103# <c>cp .config ~/</c> 119# <i>cp .config ~/</i>
104# <c>make mrproper</c> 120# <i>make mrproper</i>
105# <c>cp ~/.config .</c> 121# <i>cp ~/.config .</i>
106# <c>make menuconfig</c> 122# <i>make menuconfig</i>
107</pre> 123</pre>
108<p> 124<p>
109Now 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.
110Exit and say Y to save your kernel configuration. 126Exit and say Y to save your kernel configuration.
111After that, build the modules: 127After that, build the modules:
112</p> 128</p>
113<pre> 129<pre>
114# <c>make dep clean</c> 130# <i>make dep clean</i>
115# <c>make modules modules_install</c> 131# <i>make modules modules_install</i>
116</pre> 132</pre>
117<p> 133<p>
118Before 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,
119even the ones from a previous ALSA installation. 135even the ones from a previous ALSA installation.
120</p> 136</p>
135 <title>ALSA modules</title> 151 <title>ALSA modules</title>
136<body> 152<body>
137 153
138<p> 154<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 155Now 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 156and type of your soundcard by looking at the output of /proc/pci.
141<pre>#<c>grep audio /proc/pci</c></pre> 157</p>
158<pre>
159# <i>grep audio /proc/pci</i>
142</p> 160</pre>
161
143 162
144<p> 163<p>
145<warn> 164<warn>
146If 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>.
147Check 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.
151<p> 170<p>
152We 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.
153</p> 172</p>
154<p> 173<p>
155However, 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
156<uri link="http://www.alsa-project.org/alsa-doc">ALSA Soundcard Matrix</uri> under the <e>Install</e> section. 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.
157Mine is <c>EMU10K1</c>, since I have an SBlive! soundcard. 176Mine 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. 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.
159</p>
160
161<p> 178</p>
179
162<pre> 180<pre>
163# <c>env ALSA_CARDS='emu10k1' emerge alsa-driver</c> 181# <i>env ALSA_CARDS='emu10k1' emerge alsa-driver</i>
164</pre>
165</p> 182</pre>
166<p> 183<note>
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>.
185For example, like this: <c>echo 'ALSA_CARDS="emu10k1"' >> /etc/make.conf</c>
186</note>
187
167<note> 188<note>
168When 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
169of 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>
170</note> 191</note>
171 192
172<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
173wrapper. </note> 194wrapper. </note>
174 195
175</p> 196<note>If you plan on recompiling your kernels numerous times, it might
197be adviseable to emerge <c>alsa-driver</c> with <c>--buildpkg</c>. This
198will create a binary package for it. Later, after recompiling your kernel,
199you can just do <c>emerge --usepkg alsa-driver</c> which will install the
200binary package instead of recompiling it completely.</note>
201
176<p> 202<p>
177After this, the ALSA modules should be installed on your system. 203After this, the ALSA modules should be installed on your system.
178</p> 204</p>
179</body> 205</body>
180</section> 206</section>
183<body> 209<body>
184<p> 210<p>
185Let's start configuring now to get ALSA working properly. 211Let'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. 212We'll need to edit some files, to let our system know about the freshly installed ALSA modules.
187</p> 213</p>
214
215<p>
216First, install <c>alsa-utils</c> on your system:
188<p> 217</p>
218
219<pre caption = "Emerging alsa-utils">
220# <i>emerge alsa-utils</i>
221</pre>
222
223<p>
189First file to edit is <path>/etc/modules.d/alsa</path>. 224Hereafter, we need to edit <path>/etc/modules.d/alsa</path>.
190</p> 225</p>
191<warn> 226<warn>
192There 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>.
193</warn> 228</warn>
194<p> 229<p>
195Check the ALSA portion <e>at the bottom of the file</e>. 230Check 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). 231By tweaking this line you can specify the max number of soundcards you have (generally, just one).
197</p> 232</p>
198<p>
199<pre caption="At the top of /etc/modules.d/alsa"> 233<pre caption="At the bottom of /etc/modules.d/alsa">
200# Alsa 0.9.X kernel modules' configuration file. 234<comment>Set this to the correct number of cards.</comment>
201# $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.7 2003/02/09 23:27:14 zhen Exp $ 235options 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> 236</pre>
213<p> 237<p>
214Now 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>
215<pre caption="A bit lower in /etc/modules.d/alsa"> 240<pre caption="In /etc/modules.d/alsa">
216## and then run `update-modules' command. 241## and then run `modules-update' command.
217## 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.
218## 243##
219## ALSA portion 244## ALSA portion
220<c>alias snd-card-0 snd-emu10k1</c> 245alias snd-card-0 snd-emu10k1
221<c>## If you have more than one, add: 246<comment>## If you have more than one, add:</comment>
222## alias snd-card-1 snd-intel8x0 247## alias snd-card-1 snd-intel8x0
223## alias snd-card-2 snd-ens1370</c> 248## alias snd-card-2 snd-ens1370
224## OSS/Free portion 249## OSS/Free portion
225## alias sound-slot-0 snd-card-0 250## alias sound-slot-0 snd-card-0
226## alias sound-slot-1 snd-card-1 251## alias sound-slot-1 snd-card-1
227## 252##
228</pre> 253</pre>
229</p>
230<p>
231<note> 254<note>
232If 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.
233I 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
234<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>
235of 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>.
236</note> 259</note>
237</p> 260<p>
238<p>
239Last thing to do in this file, at the very bottom, 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>
240<pre caption="at the very bottom of /etc/modules.d/alsa"> 263<pre caption="Near the end of /etc/modules.d/alsa">
241alias /dev/mixer snd-mixer-oss 264alias /dev/mixer snd-mixer-oss
242alias /dev/dsp snd-pcm-oss 265alias /dev/dsp snd-pcm-oss
243alias /dev/midi snd-seq-oss 266alias /dev/midi snd-seq-oss
244</pre> 267</pre>
245</p> 268<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>. 269Now 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> 270<pre>
271# <i>modules-update</i>
251</p> 272</pre>
273</p>
252<note> 274<note>
253Running <c>update-modules</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>
254</note> 276</note>
255<p> 277<p>
256You 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.
257</p> 279</p>
258<pre> 280<pre caption="/etc/devfsd.conf">
259# nano -w /etc/devfsd.conf
260</pre>
261<pre>
262# ALSA/OSS stuff 281# ALSA/OSS stuff
263# Comment/change these if you want to change the permissions on 282# Comment/change these if you want to change the permissions on
264# the audio devices 283# the audio devices
265LOOKUP snd MODLOAD ACTION snd 284LOOKUP snd MODLOAD ACTION snd
266LOOKUP dsp MODLOAD 285LOOKUP dsp MODLOAD
281 <title>Adding alsasound to a runlevel</title> 300 <title>Adding alsasound to a runlevel</title>
282<body> 301<body>
283<p> 302<p>
284First 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:
285<pre> 304<pre>
286# <c>rc-update add alsasound boot</c> 305# <i>rc-update add alsasound boot</i>
287</pre> 306</pre>
288</p> 307</p>
289<p> 308<p>
290<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>
291</p> 310</p>
296<body> 315<body>
297<p> 316<p>
298Since 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.
299</p> 318</p>
300<pre> 319<pre>
301# <c>/etc/init.d/alsasound start</c> 320# <i>/etc/init.d/alsasound start</i>
302</pre> 321</pre>
303<p> 322<p>
304ALSA 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>.
305However, sound won't work yet, because the channels are still muted. We need <c>alsa-utils</c> for this. 324However, sound won't work yet, because the channels are still muted. We need <c>amixer</c> for this.
306</p> 325</p>
307<pre> 326<pre caption = "Running amixer">
308# <c>emerge alsa-utils</c>
309# <c>amixer</c> 327# <i>amixer</i>
310</pre> 328</pre>
311<p> 329<p>
312<warn> 330<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 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
314<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.
315</warn> 333</warn>
316</p> 334</p>
317<pre caption="only if you get an error when running amixer"> 335<pre caption="only if you get an error when running amixer">
318# <c>insmod snd-mixer-oss</c> 336# <i>modprobe snd-mixer-oss</i>
319# <c>insmod snd-pcm-oss</c> 337# <i>modprobe snd-pcm-oss</i>
320# <c>amixer</c> 338# <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> 339</pre>
340<p>
341If you got this far, now unmute Master and PCM channels. Some hardware
342even requires you to unmute the center channel or even the surround
343channel.
344</p>
345<p>
346<pre caption = "Unmuting channels">
327# <c>amixer set Master 100 unmute</c> 347# <i>amixer set Master 100 unmute</i>
328# <c>amixer set PCM 100 unmute</c> 348# <i>amixer set PCM 100 unmute</i>
349<comment>Only if the above doesn't succeed on its own:</comment>
350# <i>amixer set Center 100 unmute</i>
351# <i>amixer set Surround 100 unmute</i>
352<comment>Test the sound:</comment>
329# <c>aplay /usr/kde/3/share/sounds/pop.wav</c> <codenote>(pop.wav is part of KDE)</codenote> 353# <i>aplay $KDEDIR/share/sounds/pop.wav</i> <codenote>(pop.wav is part of KDE)</codenote>
330</pre> 354</pre>
331</p> 355</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. 356We 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". 357Then, adjust the volume settings to your liking; the ncurses-based <c>alsamixer</c> is a great way to get them "just so".
334<p> 358<p>
346<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>
347<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
348have 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
349<path>/lib/modules/*/kernel/sound/pci/</path>.</p> 373<path>/lib/modules/*/kernel/sound/pci/</path>.</p>
350<pre caption="needed after each kernel compile"> 374<pre caption="needed after each kernel compile">
351emerge alsa-driver 375# <i>emerge alsa-driver</i>
352</pre> 376</pre>
353</body> 377</body>
354</section> 378</section>
355<section> 379<section>
356 <title>/etc/modules.autoload</title> 380 <title>/etc/modules.autoload</title>
367<p> 391<p>
368You could check these for additional info: 392You could check these for additional info:
369</p> 393</p>
370<p> 394<p>
371<ul> 395<ul>
372<li><uri link="http://www.gentoo.org/doc/desktop.html">The Gentoo Linux Desktop Configuration Guide</uri></li> 396<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> 397<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> 398<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> 399<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> 400<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> 401<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.16

  ViewVC Help
Powered by ViewVC 1.1.20