/[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.69 Revision 1.80
1<?xml version='1.0' encoding="UTF-8"?> 1<?xml version='1.0' encoding="UTF-8"?>
2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.69 2006/07/07 14:40:08 rane Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.80 2007/05/19 03:00:29 nightmorph Exp $ -->
3 3
4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd"> 4<!DOCTYPE guide SYSTEM "/dtd/guide.dtd">
5 5
6<guide link="/doc/en/alsa-guide.xml"> 6<guide link="/doc/en/alsa-guide.xml">
7<title>Gentoo Linux ALSA Guide</title> 7<title>Gentoo Linux ALSA Guide</title>
8 8
9<author title="Author"> 9<author title="Author">
10 <mail link="fox2mike@gentoo.org">Shyam Mani</mail> 10 <mail link="fox2mike@gentoo.org">Shyam Mani</mail>
11</author> 11</author>
12<author title="Author">
13 <mail link="nightmorph@gentoo.org">Joshua Saddler</mail>
14</author>
15<author title="Contributor">
16 <mail link="flameeyes@gentoo.org">Diego PettenĂ²</mail>
17</author>
12 18
13<abstract> 19<abstract>
14This document helps a user setup ALSA on Gentoo Linux. 20This document helps a user setup ALSA on Gentoo Linux.
15</abstract> 21</abstract>
16 22
17<!-- The content of this document is licensed under the CC-BY-SA license --> 23<!-- The content of this document is licensed under the CC-BY-SA license -->
18<!-- See http://creativecommons.org/licenses/by-sa/2.5 --> 24<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
19<license/> 25<license/>
20 26
21<version>2.14</version> 27<version>2.22</version>
22<date>2006-07-06</date> 28<date>2007-05-07</date>
23 29
24<chapter> 30<chapter>
25<title>Introduction</title> 31<title>Introduction</title>
26<section> 32<section>
27<title>What is ALSA?</title> 33<title>What is ALSA?</title>
28<body> 34<body>
29 35
30<p> 36<p>
31ALSA, which stands for <e>Advanced Linux Sound Architecture</e>, provides 37ALSA, which stands for <e>Advanced Linux Sound Architecture</e>, provides
32audio and MIDI (<e>Musical Instrument Digital Interface</e>) functionality to 38audio and MIDI (<e>Musical Instrument Digital Interface</e>) functionality to
33the Linux operating system. ALSA is the default sound subsystem in the 2.6 39the Linux operating system. ALSA is the default sound subsystem in the 2.6
34kernel thereby replacing OSS (<e>Open Sound System</e>), which was used in the 40kernel thereby replacing OSS (<e>Open Sound System</e>), which was used in the
352.4 kernels. 412.4 kernels.
36</p> 42</p>
37 43
38<p> 44<p>
39ALSA's main features include efficient support for all types of audio 45ALSA's main features include efficient support for all types of audio
40interfaces ranging from consumer sound cards to professional sound 46interfaces ranging from consumer sound cards to professional sound
41equipment, fully modularized drivers, SMP and thread safety, backward 47equipment, fully modularized drivers, SMP and thread safety, backward
42compatibility with OSS and a user-space library <c>alsa-lib</c> to make 48compatibility with OSS and a user-space library <c>alsa-lib</c> to make
43application development a breeze. 49application development a breeze.
44</p> 50</p>
45 51
46</body> 52</body>
47</section> 53</section>
48<section> 54<section>
49<title>ALSA on Gentoo</title> 55<title>ALSA on Gentoo</title>
50<body> 56<body>
51 57
52<p> 58<p>
53One of Gentoo's main strengths lies in giving the user maximum control over 59One of Gentoo's main strengths lies in giving the user maximum control over
54how a system is installed/configured. ALSA on Gentoo follows the same 60how a system is installed/configured. ALSA on Gentoo follows the same
55principle. There are two ways you can get ALSA support up and running on your 61principle. There are two ways you can get ALSA support up and running on your
56system. We shall look at them in detail in the next chapter. 62system. We shall look at them in detail in the next chapter.
57</p> 63</p>
58 64
59</body> 65</body>
60</section> 66</section>
65<section> 71<section>
66<title>Options</title> 72<title>Options</title>
67<body> 73<body>
68 74
69<warn> 75<warn>
70The methods shown below are mutually exclusive. You cannot have ALSA compiled 76The methods shown below are mutually exclusive. You cannot have ALSA compiled
71in your kernel and use <c>media-sound/alsa-driver</c>. It <e>will</e> fail. 77in your kernel and use <c>media-sound/alsa-driver</c>. It <e>will</e> fail.
72</warn> 78</warn>
73 79
74<p> 80<p>
75The two options are : 81The two options are:
76</p> 82</p>
77 83
78<ol> 84<ol>
79 <li> 85 <li>
80 Use ALSA provided by your kernel. This is the preferred/recommended 86 Use ALSA provided by your kernel. This is the preferred/recommended method.
81 method.
82 </li> 87 </li>
83 <li>
84 Use Gentoo's <c>media-sound/alsa-driver</c> package. 88 <li>Use Gentoo's <c>media-sound/alsa-driver</c> package.</li>
85 </li>
86</ol> 89</ol>
87 90
88<p> 91<p>
89We shall take a peek into both before finally deciding on one. 92The in-kernel drivers and the <c>alsa-driver</c> package can vary a little; it's
90</p> 93possible that features and fixes found in one might not yet be incorporated into
91 94the other. The upstream developers are aware of this, but the two drivers are
95effectively separate branches of the ALSA project; they are not entirely
96identical. You should be aware that they might function slightly differently, so
97if one doesn't work for you, try the other! We shall take a peek into both
98before finally deciding on one.
92<p> 99</p>
100
101<p>
93If you were to use ALSA provided by the kernel, the following are the pros and 102If you were to use ALSA provided by the kernel, the following are the pros and
94cons : 103cons:
95</p> 104</p>
96 105
97<table> 106<table>
98<tr> 107<tr>
99 <th>Kernel ALSA</th> 108 <th>Kernel ALSA</th>
100 <th>Pros and Cons</th> 109 <th>Pros and Cons</th>
101</tr> 110</tr>
102<tr> 111<tr>
103 <th>+</th> 112 <th>+</th>
104 <ti>Pretty stable as drivers are integrated into kernel.</ti> 113 <ti>
114 No need to emerge yet another package; drivers are integrated into kernel.
115 </ti>
105</tr> 116</tr>
106<tr> 117<tr>
107 <th>+</th> 118 <th>+</th>
108 <ti>One shot solution, no repeating emerges.</ti> 119 <ti>One shot solution, no repeating emerges.</ti>
109</tr> 120</tr>
110<tr> 121<tr>
111 <th>-</th> 122 <th>-</th>
112 <ti>Might be a slightly older version than <c>alsa-driver</c>.</ti> 123 <ti>Might be a slightly different version than <c>alsa-driver</c>.</ti>
113</tr> 124</tr>
114</table> 125</table>
115 126
116<p> 127<p>
117And, if you were to use alsa-driver, 128And, if you were to use <c>alsa-driver</c>,
118</p> 129</p>
119 130
120<table> 131<table>
121<tr> 132<tr>
122 <th>alsa-driver</th> 133 <th>alsa-driver</th>
123 <th>Pros and Cons</th> 134 <th>Pros and Cons</th>
124</tr> 135</tr>
125<tr> 136<tr>
126 <th>+</th> 137 <th>+</th>
127 <ti>Latest drivers from the ALSA Project.</ti> 138 <ti>Possibly the latest drivers from the ALSA Project.</ti>
139</tr>
140<tr>
141 <th>+</th>
142 <ti>Useful if you intend to develop audio drivers.</ti>
128</tr> 143</tr>
129<tr> 144<tr>
130 <th>-</th> 145 <th>-</th>
131 <ti>Every kernel recompile requires a re-emerge of <c>alsa-driver</c>.</ti> 146 <ti>Every kernel recompile requires a re-emerge of <c>alsa-driver</c>.</ti>
132</tr> 147</tr>
141<section> 156<section>
142<title>So...</title> 157<title>So...</title>
143<body> 158<body>
144 159
145<p> 160<p>
146The main difference between using <c>alsa-driver</c> and ALSA that comes with 161The differences between <c>alsa-driver</c> and the in-kernel ALSA drivers are
147the kernel is that <c>alsa-driver</c> is generally more up to date than the 162quite subtle, as mentioned earlier. Since there are not any huge differences,
148version in the kernel. Since this does not make any huge difference as 163you are encouraged to go through the process of using the ALSA provided by the
149such, you are encouraged to use the ALSA provided by the kernel for ease of use. 164kernel <e>first</e> for ease of use. Before reporting any sound related issues
150Before reporting any sound related issues to <uri
151link="https://bugs.gentoo.org">Gentoo Bugzilla</uri>, please try to reproduce 165to <uri link="https://bugs.gentoo.org">Gentoo Bugzilla</uri>, please try to
152them using <c>alsa-driver</c> and file the bug report no matter what the 166reproduce them using <c>alsa-driver</c> and file the bug report no matter what
153result. 167the result.
154</p> 168</p>
155 169
156</body> 170</body>
157</section> 171</section>
158<section id="lspci"> 172<section id="lspci">
159<title>Before you proceed</title> 173<title>Before you proceed</title>
160<body> 174<body>
161 175
162<p> 176<p>
163Whichever method of install you choose, you need to know what drivers your 177Whichever method of install you choose, you need to know what drivers your
164sound card uses. In most cases, sound cards (onboard and otherwise) are PCI 178sound card uses. In most cases, sound cards (onboard and otherwise) are PCI
165based and <c>lspci</c> will help you in digging out the required information. 179based and <c>lspci</c> will help you in digging out the required information.
166Please <c>emerge sys-apps/pciutils</c> to get <c>lspci</c>, if you don't have it 180Please <c>emerge sys-apps/pciutils</c> to get <c>lspci</c>, if you don't have it
167installed already. In case you have a USB sound card, <c>lsusb</c> from 181installed already. In case you have a USB sound card, <c>lsusb</c> from
168<c>sys-apps/usbutils</c> <e>might</e> be of help. For ISA cards, try using 182<c>sys-apps/usbutils</c> <e>might</e> be of help. For ISA cards, try using
169<c>sys-apps/isapnptools</c>. Also, the following pages <e>may</e> help users 183<c>sys-apps/isapnptools</c>. Also, the following pages <e>may</e> help users
170with ISA based sound cards. 184with ISA based sound cards:
171</p> 185</p>
172 186
173<ul> 187<ul>
174 <li> 188 <li>
175 <uri link="http://www.roestock.demon.co.uk/isapnptools/">The ISAPNPTOOLS 189 <uri link="http://www.roestock.demon.co.uk/isapnptools/">The ISAPNPTOOLS
198# <i>lspci -v | grep -i audio</i> 212# <i>lspci -v | grep -i audio</i>
1990000:00:0a.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 06) 2130000:00:0a.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 06)
200</pre> 214</pre>
201 215
202<p> 216<p>
203We now know that the sound card on the machine is a Sound Blaster Live! and 217We now know that the sound card on the machine is a Sound Blaster Live! and the
204the card manufacturer is Creative Labs. Head over to the 218card manufacturer is Creative Labs. Head over to the <uri
205<uri link="http://www.alsa-project.org/alsa-doc/"> ALSA Soundcard Matrix</uri> 219link="http://bugtrack.alsa-project.org/main/index.php/Matrix:Main">ALSA
206page and select Creative Labs from the drop down menu. You will be taken to 220Soundcard Matrix</uri> page and select Creative Labs from the list. You will
207the Creative Labs matrix page where you can see that the SB Live! uses the 221be taken to the Creative Labs matrix page where you can see that the SB Live!
208<c>emu10k1</c> module. That is the information we need for now. If you are 222uses the <c>emu10k1</c> module. That is the information we need for now. If
209interested in detailed information, you can click on the link next to the 223you are interested in detailed information, you can click on the link next to
210"Details" and that will take you to the <c>emu10k1</c> specific page. 224the "Details" and that will take you to the <c>emu10k1</c> specific page.
225</p>
226
227<p>
228If you intend to use MIDI, then you should add <c>midi</c> to your USE flags in
229<path>/etc/make.conf</path> before emerging any ALSA packages. Later in the
230guide, we will show you how to set up <uri link="#midi">MIDI support</uri>.
211</p> 231</p>
212 232
213</body> 233</body>
214</section> 234</section>
215<section id="kernel"> 235<section id="kernel">
216<title>Using ALSA provided by your Kernel</title> 236<title>Using ALSA provided by your Kernel</title>
217<body> 237<body>
218 238
219<p> 239<p>
220If you're a person who likes to keep things simple like I do, then this is 240If you're a person who likes to keep things simple, then this is the way to go.
221the way to go.
222</p> 241</p>
223 242
224<note> 243<note>
225Since the 2005.0 release, Gentoo Linux uses 2.6 as the default kernel. Unless 244Since the 2005.0 release, Gentoo Linux uses 2.6 as the default kernel. Please
226you are specifically using the 2.4 profile, <c>gentoo-sources</c> will be a 245check that your kernel is a 2.6 series kernel. This method will <e>not</e> work
2272.6 kernel on <e>most</e> architectures. Please check that your kernel is a 246on a 2.4 kernel.
2282.6 series kernel. This method will <e>not</e> work on a 2.4 kernel.
229</note> 247</note>
230 248
231<p> 249<p>
232Let us now configure the kernel to enable ALSA. 250Let us now configure the kernel to enable ALSA.
233</p> 251</p>
252Now we will look at some of the options we will have to enable in the 2.6 270Now we will look at some of the options we will have to enable in the 2.6
253kernel to ensure proper ALSA support for our sound card. 271kernel to ensure proper ALSA support for our sound card.
254</p> 272</p>
255 273
256<p> 274<p>
257Please note that for the sake of ease, all examples show ALSA built as modules. 275Please note that for ease of use, all examples show ALSA built as modules. It
258It is advisable to follow the same as it then allows the use of <c>alsaconf</c> 276is advisable to follow the same as it then allows the use of <c>alsaconf</c>
259which is a boon when you want to configure your card. Please do <e>not</e> skip 277which is a boon when you want to configure your card. Please do <e>not</e> skip
260the <uri link="#alsa-config">Configuration</uri> section of this document. If 278the <uri link="#alsa-config">Configuration</uri> section of this document. If
261you still like to have options built-in, ensure that you make changes to your 279you still like to have options built-in, ensure that you make changes to your
262config accordingly. 280config accordingly.
263</p> 281</p>
281 <comment>(Old style /dev/mixer* and /dev/dsp* support. Recommended.)</comment> 299 <comment>(Old style /dev/mixer* and /dev/dsp* support. Recommended.)</comment>
282 &lt;M&gt; OSS Mixer API 300 &lt;M&gt; OSS Mixer API
283 &lt;M&gt; OSS PCM (digital audio) API 301 &lt;M&gt; OSS PCM (digital audio) API
284 302
285<comment>(You now have a choice of devices to enable support for. Generally, 303<comment>(You now have a choice of devices to enable support for. Generally,
286you will have one type of device and not more. If you have more than one 304you will have one type of device and not more. If you have more than one
287sound card, please enable them all here.)</comment> 305sound card, please enable them all here.)</comment>
288 306
289<comment>(Mostly for testing and development purposes, not needed for normal 307<comment>(Mostly for testing and development purposes, not needed for normal
290users unless you know what you are doing.)</comment> 308users unless you know what you are doing.)</comment>
291Generic devices ---&gt; 309Generic devices ---&gt;
292 310
293<comment>(For ISA Sound cards)</comment> 311<comment>(For ISA Sound cards)</comment>
294ISA devices ---&gt; 312ISA devices ---&gt;
295<comment>(IF you had the Gravis, you would select this option)</comment> 313<comment>(IF you had the Gravis, you would select this option)</comment>
296 &lt;M&gt; Gravis UltraSound Extreme 314 &lt;M&gt; Gravis UltraSound Extreme
297 315
298<comment>(Move one level back and into PCI devices. Most sound cards today are 316<comment>(Move one level back and into PCI devices. Most sound cards today are
299PCI devices)</comment> 317PCI devices)</comment>
300PCI devices ---&gt; 318PCI devices ---&gt;
301 <comment>(We now select the emu10k1 driver for our card)</comment> 319 <comment>(We now select the emu10k1 driver for our card)</comment>
302 &lt;M&gt; Emu10k1 (SB Live!, Audigy, E-mu APS) 320 &lt;M&gt; Emu10k1 (SB Live!, Audigy, E-mu APS)
303 <comment>(Or an Intel card would be)</comment> 321 <comment>(Or an Intel card would be)</comment>
311 329
312<p> 330<p>
313Now that your options are set, you can (re)compile the kernel and ALSA support 331Now that your options are set, you can (re)compile the kernel and ALSA support
314for your card should be functional once you reboot into the new kernel. Don't 332for your card should be functional once you reboot into the new kernel. Don't
315forget to update your GRUB configuration to use the newly built kernel. 333forget to update your GRUB configuration to use the newly built kernel.
316You can now proceed to <uri link="#alsa-utilities">ALSA Utilities</uri> and 334You can now proceed to <uri link="#alsa-utilities">ALSA Utilities</uri> and
317see if everything is working as it should. 335see if everything is working as it should.
318</p> 336</p>
319 337
320</body> 338</body>
321</section> 339</section>
322<section id="alsa-driver"> 340<section id="alsa-driver">
323<title>Using the ALSA Driver package</title> 341<title>Using the ALSA Driver package</title>
324<body> 342<body>
325 343
326<p> 344<p>
327So you've decided to go the <c>alsa-driver</c> way. Let's get started then. 345So you've decided to go the <c>alsa-driver</c> way. Let's get started then.
328There are a few minor things to be done to ensure only the drivers for your 346There are a few minor things to be done to ensure only the drivers for your
329sound card are compiled. Although this is not really necessary, it cuts down 347sound card are compiled. Although this is not really necessary, it cuts down
330on the unnecessary drivers that will be compiled otherwise. 348on the unnecessary drivers that will be compiled otherwise.
331</p> 349</p>
332 350
333<p> 351<p>
334If you don't have an idea of what drivers your sound card might need, please 352If you don't have an idea of what drivers your sound card might need, please
335take a look at the <uri link="#lspci">lspci</uri> section of this guide. Once 353take a look at the <uri link="#lspci">lspci</uri> section of this guide. Once
336you have your driver name (<c>emu10k1</c> in our example), edit 354you have your driver name (<c>emu10k1</c> in our example), edit
337<path>/etc/make.conf</path> and add a variable, <c>ALSA_CARDS</c>. 355<path>/etc/make.conf</path> and add a variable, <c>ALSA_CARDS</c>.
338</p> 356</p>
339 357
340<pre caption="Adding ALSA_CARDS to make.conf"> 358<pre caption="Adding ALSA_CARDS to make.conf">
341<comment>(For one sound card)</comment> 359<comment>(For one sound card)</comment>
343<comment>(For more than one, separate names with spaces)</comment> 361<comment>(For more than one, separate names with spaces)</comment>
344ALSA_CARDS="emu10k1 via82xx" 362ALSA_CARDS="emu10k1 via82xx"
345</pre> 363</pre>
346 364
347<p> 365<p>
348If you have compiled your kernel and want to use <c>alsa-driver</c>, please 366If you have compiled your kernel and want to use <c>alsa-driver</c>, please
349ensure the following before proceeding, else <c>alsa-driver</c> is likely to 367ensure the following before proceeding, else <c>alsa-driver</c> is likely to
350fail. The next code listing gives you one way of performing the checks. 368fail. The next code listing gives you one way of performing the checks.
351</p> 369</p>
352 370
353<note> 371<note>
354<c>genkernel</c> users can proceed with <uri link="#doc_chap2_pre6">Installing 372<c>genkernel</c> users can proceed with <uri link="#doc_chap2_pre6">Installing
391<pre caption="Installing alsa-driver"> 409<pre caption="Installing alsa-driver">
392# <i>emerge alsa-driver</i> 410# <i>emerge alsa-driver</i>
393</pre> 411</pre>
394 412
395<impo> 413<impo>
396Please note that you will have to run <c>emerge alsa-driver</c> after every 414Please note that you will have to run <c>emerge alsa-driver</c> after every
397kernel (re)compile, as the earlier drivers are deleted. 415kernel (re)compile, as the earlier drivers are deleted. To make this task
416easier, you may want to emerge the <c>module-rebuild</c> package, which will
417keep track of module packages and rebuild them for you. First run
418<c>module-rebuild populate</c> to create the list, and then after every kernel
419(re)compile, you just run <c>module-rebuild rebuild</c>, and your external
420modules will be rebuilt.
398</impo> 421</impo>
399 422
400</body> 423</body>
401</section> 424</section>
402</chapter> 425</chapter>
406<section id="alsa-utilities"> 429<section id="alsa-utilities">
407<title>ALSA Utilities</title> 430<title>ALSA Utilities</title>
408<body> 431<body>
409 432
410<p> 433<p>
411<c>alsa-utils</c> forms an integral part of ALSA as it has a truckload of 434<c>alsa-utils</c> forms an integral part of ALSA as it has a truckload of
412programs that are highly useful, including the ALSA Initscripts. Hence we 435programs that are highly useful, including the ALSA Initscripts. Hence we
413strongly recommend that you install <c>alsa-utils</c> 436strongly recommend that you install <c>alsa-utils</c>
414</p> 437</p>
415 438
416<pre caption="Install alsa-utils"> 439<pre caption="Install alsa-utils">
417# <i>emerge alsa-utils</i> 440# <i>emerge alsa-utils</i>
418</pre> 441</pre>
419 442
420<note> 443<note>
421If you activated ALSA in your <uri link="#kernel">kernel</uri> <e>and</e> did 444If you activated ALSA in your <uri link="#kernel">kernel</uri> <e>and</e> did
422not compile ALSA as modules, please proceed to the 445not compile ALSA as modules, please proceed to the
423<uri link="#initscript">ALSA Initscript</uri> section. The rest of you need 446<uri link="#initscript">ALSA Initscript</uri> section. The rest of you need
424to configure ALSA. This is made very easy by the existence of the 447to configure ALSA. This is made very easy by the existence of the
425<c>alsaconf</c> tool provided by <c>alsa-utils</c>. 448<c>alsaconf</c> tool provided by <c>alsa-utils</c>.
426</note> 449</note>
427 450
428</body> 451</body>
429</section> 452</section>
430<section id="alsa-config"> 453<section id="alsa-config">
431<title>Configuration</title> 454<title>Configuration</title>
432<body> 455<body>
433 456
457<p>
458Recent versions of <c>udev</c> (<c>>=udev-103</c>) provide some degree of
459kernel-level autoconfiguration of your sound card. If possible, try to rely on
460just letting your kernel automatically setup your sound card for you. Otherwise,
461use <c>alsaconf</c> to configure your card, as shown below.
462</p>
463
434<note> 464<note>
435Please shut down any programs that <e>might</e> access the sound card while 465Please shut down any programs that <e>might</e> access the sound card while
436running <c>alsaconf</c>. 466running <c>alsaconf</c>.
437</note> 467</note>
438 468
439<p> 469<p>
440The easiest way to configure your sound card is to run <c>alsaconf</c>. Just 470To configure your sound card just type <c>alsaconf</c> in a shell as root.
441type <c>alsaconf</c> in a shell as root.
442</p> 471</p>
443 472
444<pre caption="Invoking alsaconf"> 473<pre caption="Invoking alsaconf">
445# <i>alsaconf</i> 474# <i>alsaconf</i>
446</pre> 475</pre>
447 476
448<p> 477<p>
449You will now see a neat menu guided interface that will automatically probe 478You will now see a neat menu guided interface that will automatically probe
450your devices and try to find out your sound card. You will be asked to pick 479your devices and try to find out your sound card. You will be asked to pick
451your sound card from a list. Once that's done, it will ask you permission to 480your sound card from a list. Once that's done, it will ask you permission to
452automatically make required changes to <path>/etc/modules.d/alsa</path>. 481automatically make required changes to <path>/etc/modules.d/alsa</path>.
453It will then adjust your volume settings to optimum levels, run 482It will then adjust your volume settings to optimum levels, run
454<c>modules-update</c> and start the <path>/etc/init.d/alsasound</path> service. 483<c>update-modules</c> and start the <path>/etc/init.d/alsasound</path> service.
455Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA 484Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA
456initscript. 485initscript.
457</p> 486</p>
458 487
459</body> 488</body>
461<section id="initscript"> 490<section id="initscript">
462<title>ALSA Initscript</title> 491<title>ALSA Initscript</title>
463<body> 492<body>
464 493
465<p> 494<p>
466We're now almost all setup. Whichever method you chose to install ALSA, you'll 495We're now almost all setup. Whichever method you chose to install ALSA, you'll
467need to have something load your modules or initialize ALSA and restore your 496need to have something load your modules or initialize ALSA and restore your
468volume settings when your system comes up. The ALSA Initscript handles all of 497volume settings when your system comes up. The ALSA Initscript handles all of
469this for you and is called <c>alsasound</c>. Add it to the boot runlevel. 498this for you and is called <c>alsasound</c>. Add it to the boot runlevel.
470</p> 499</p>
471 500
472<pre caption="Adding ALSA to the boot runlevel"> 501<pre caption="Adding ALSA to the boot runlevel">
473# <i>rc-update add alsasound boot</i> 502# <i>rc-update add alsasound boot</i>
474 * alsasound added to runlevel boot 503 * alsasound added to runlevel boot
475 * rc-update complete. 504 * rc-update complete.
476</pre> 505</pre>
477 506
478<p> 507<p>
479Next, just check the <path>/etc/conf.d/alsasound</path> file and ensure that 508Next, just check the <path>/etc/conf.d/alsasound</path> file and ensure that
480SAVE_ON_STOP variable is set to yes. This saves your sound settings when you 509SAVE_ON_STOP variable is set to yes. This saves your sound settings when you
481shutdown your system. 510shutdown your system.
482</p> 511</p>
483 512
484</body> 513</body>
485</section> 514</section>
487<title>Audio Group</title> 516<title>Audio Group</title>
488<body> 517<body>
489 518
490<p> 519<p>
491Before we move on to testing, there's one last <e>important</e> thing that needs 520Before we move on to testing, there's one last <e>important</e> thing that needs
492to be setup. Rule of thumb in a *nix OS : Do not run as root unless needed. 521to be setup. Rule of thumb in a *nix OS: Do not run as root unless needed.
493This applies here as well ;) How? Well, most of the times you should be logged 522This applies here as well ;) How? Well, most of the times you should be logged
494in as a user and would like to listen to music or access your soundcard. For 523in as a user and would like to listen to music or access your soundcard. For
495that to happen, you need to be in the "audio" group. At this point, we'll add 524that to happen, you need to be in the "audio" group. At this point, we'll add
496users to the audio group, so that they won't have any issues when they want to 525users to the audio group, so that they won't have any issues when they want to
497access sound devices. We'll use <c>gpasswd</c> here and you need to be logged in 526access sound devices. We'll use <c>gpasswd</c> here and you need to be logged in
509<section> 538<section>
510<title>Volume Check!</title> 539<title>Volume Check!</title>
511<body> 540<body>
512 541
513<p> 542<p>
514We've completed all the setups and pre-requisites, so let's fire up ALSA. If 543We've completed all the setups and prerequisites, so let's fire up ALSA. If
515you ran <c>alsaconf</c>, you can skip this step, since <c>alsaconf</c> already 544you ran <c>alsaconf</c>, you can skip this step, since <c>alsaconf</c> already
516does this for you. 545does this for you.
517</p> 546</p>
518 547
519<pre caption="Start the service"> 548<pre caption="Start the service">
520<comment>(ALSA as modules)</comment>
521# <i>/etc/init.d/alsasound start</i> 549# <i>/etc/init.d/alsasound start</i>
522 * Loading ALSA modules ...
523 * Loading: snd-card-0 ... [ ok ]
524 * Loading: snd-pcm-oss ... [ ok ]
525 * Loading: snd-seq ... [ ok ]
526 * Loading: snd-emu10k1-synth ... [ ok ]
527 * Loading: snd-seq-midi ... [ ok ]
528 * Restoring Mixer Levels ... [ ok ]
529<comment>(ALSA compiled in)</comment>
530# <i>/etc/init.d/alsasound start</i>
531 * Loading ALSA modules ...
532 * Restoring Mixer Levels ... [ ok ]
533</pre> 550</pre>
534 551
535<p> 552<p>
536Now that the required things have been taken care of, we need to check up on 553Now that the required things have been taken care of, we need to check up on
537the volume as in certain cases, it is muted. We use <c>alsamixer</c> for this 554the volume as in certain cases, it is muted. We use <c>alsamixer</c> for this
538purpose. 555purpose.
539</p> 556</p>
540 557
541<pre caption="Starting alsamixer"> 558<pre caption="Starting alsamixer">
550udevd; udevstart</c> to reload <path>/dev</path> entries and fire up 567udevd; udevstart</c> to reload <path>/dev</path> entries and fire up
551<c>alsamixer</c>. It should solve the issue. 568<c>alsamixer</c>. It should solve the issue.
552</impo> 569</impo>
553 570
554<p> 571<p>
555This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay 572This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay
556attention to the Master and PCM channels which both have an MM below them. 573attention to the Master and PCM channels which both have an MM below them.
557That means they are muted. If you try to play anything with <c>alsamixer</c> 574That means they are muted. If you try to play anything with <c>alsamixer</c>
558in this state, you will not hear anything on your speakers. 575in this state, you will not hear anything on your speakers.
559</p> 576</p>
560 577
561<figure link="/images/docs/alsa-mixermuted.png" short="AlsaMixer Muted" caption="The Alsa Mixer Main Window, Muted"/> 578<figure link="/images/docs/alsa-mixermuted.png" short="AlsaMixer Muted" caption="The Alsa Mixer Main Window, Muted"/>
562 579
569if you want to hear some output on your speakers. 586if you want to hear some output on your speakers.
570</warn> 587</warn>
571 588
572<ul> 589<ul>
573 <li> 590 <li>
574 To move between channels, use your left and right arrow keys. (&lt;- 591 To move between channels, use your left and right arrow keys. (&lt;-
575 &amp; -&gt;) 592 &amp; -&gt;)
576 </li> 593 </li>
577 <li> 594 <li>
578 To toggle mute, move to the specific channel, for example Master and press 595 To toggle mute, move to the specific channel, for example Master and press
579 the <e>m</e> key on the keyboard. 596 the <e>m</e> key on the keyboard.
580 </li> 597 </li>
581 <li> 598 <li>
582 To increase and decrease the volume levels, use the up and down arrow keys 599 To increase and decrease the volume levels, use the up and down arrow keys
583 respectively. 600 respectively.
584 </li> 601 </li>
585</ul> 602</ul>
586 603
587<note> 604<note>
588Be careful when setting your Bass and Treble values. 50 is usually a good 605Be careful when setting your Bass and Treble values. 50 is usually a good
589number for both. Extremely high values of Bass may cause <e>jarring</e> 606number for both. Extremely high values of Bass may cause <e>jarring</e>
590on speakers that are not designed to handle them. 607on speakers that are not designed to handle them.
591</note> 608</note>
592 609
593<p> 610<p>
594After you're all done, your ALSA Mixer should look similar to the one below. 611After you're all done, your ALSA Mixer should look similar to the one below.
595Note the 00 instead of the MM and also the volume levels for some optimum 612Note the 00 instead of the MM and also the volume levels for some optimum
596settings. 613settings.
597</p> 614</p>
598 615
599<figure link="/images/docs/alsa-mixerunmuted.png" short="AlsaMixer Unmuted" caption="Alsa Mixer ready to roll"/> 616<figure link="/images/docs/alsa-mixerunmuted.png" short="AlsaMixer Unmuted" caption="Alsa Mixer ready to roll"/>
600 617
606 623
607<p> 624<p>
608Finally. Some music. If everything above is perfect, you should now be able to 625Finally. Some music. If everything above is perfect, you should now be able to
609listen to some good music. A quick way to test is to use a command line tool 626listen to some good music. A quick way to test is to use a command line tool
610like <c>media-sound/madplay</c>. You could also use something more well known 627like <c>media-sound/madplay</c>. You could also use something more well known
611like <c>mpg123</c> or <c>xmms</c>. If you are an ogg fan, you could use 628like <c>mpg123</c>. If you are an ogg fan, you could use <c>ogg123</c> provided
612<c>ogg123</c> provided by <c>media-sound/vorbis-tools</c>. Use any player you 629by <c>media-sound/vorbis-tools</c>. Use any player you are comfortable with. As
613are comfortable with. As always, <c>emerge</c> what you need. 630always, <c>emerge</c> what you need.
614</p> 631</p>
615 632
616<pre caption="Getting the software"> 633<pre caption="Getting the software">
617<comment>(Install the applications you want)</comment> 634<comment>(Install the applications you want)</comment>
618# <i>emerge madplay mpg123 xmms</i> 635# <i>emerge madplay mpg123</i>
619<comment>(To play .ogg files)</comment> 636<comment>(To play .ogg files)</comment>
620# <i>emerge vorbis-tools</i> 637# <i>emerge vorbis-tools</i>
621</pre> 638</pre>
622 639
623<p> 640<p>
666<section> 683<section>
667<title>Issues?</title> 684<title>Issues?</title>
668<body> 685<body>
669 686
670<p> 687<p>
671If for some reason you're unable to hear sound, the first thing to do would 688If for some reason you're unable to hear sound, the first thing to do would
672be to check your <uri link="#doc_chap3_pre6">alsamixer</uri> settings. 80% of 689be to check your <uri link="#doc_chap3_pre6">alsamixer</uri> settings. 80% of
673the issues lie with muted channels or low volume. Also check your Window 690the issues lie with muted channels or low volume. Also check your Window
674Manager's sound applet and verify that volumes are set to audible levels. 691Manager's sound applet and verify that volumes are set to audible levels.
675</p> 692</p>
676 693
677<p> 694<p>
678<path>/proc</path> is your friend. And in this case, <path>/proc/asound</path> 695<path>/proc</path> is your friend. And in this case, <path>/proc/asound</path>
679is your best friend. We shall just take a short look at how much info is made 696is your best friend. We shall just take a short look at how much info is made
680available to us there. 697available to us there.
681</p> 698</p>
682 699
683<pre caption="Fun with /proc/asound"> 700<pre caption="Fun with /proc/asound">
684<comment>(First and foremost, if /proc/asound/cards shows your card, ALSA has 701<comment>(First and foremost, if /proc/asound/cards shows your card, ALSA has
685picked up your sound card fine.)</comment> 702picked up your sound card fine.)</comment>
686# <i>cat /proc/asound/cards</i> 703# <i>cat /proc/asound/cards</i>
6870 [Live ]: EMU10K1 - Sound Blaster Live! 7040 [Live ]: EMU10K1 - Sound Blaster Live!
688 Sound Blaster Live! (rev.6, serial:0x80271102) at 0xb800, irq 11 705 Sound Blaster Live! (rev.6, serial:0x80271102) at 0xb800, irq 11
689 706
690<comment>(If you run ALSA off the kernel like I do and wonder how far behind
691you are from alsa-driver, this displays current running ALSA version)</comment> 707<comment>(This displays the current running ALSA version)</comment>
692# <i>cat /proc/asound/version</i> 708# <i>cat /proc/asound/version</i>
693Advanced Linux Sound Architecture Driver Version 1.0.8 (Thu Jan 13 09:39:32 2005 UTC). 709Advanced Linux Sound Architecture Driver Version 1.0.8 (Thu Jan 13 09:39:32 2005 UTC).
694 710
695<comment>(ALSA OSS emulation details)</comment> 711<comment>(ALSA OSS emulation details)</comment>
696# <i>cat /proc/asound/oss/sndstat</i> 712# <i>cat /proc/asound/oss/sndstat</i>
813</section> 829</section>
814</chapter> 830</chapter>
815 831
816<chapter> 832<chapter>
817<title>Other things ALSA</title> 833<title>Other things ALSA</title>
818<section> 834<section id="midi">
819<title>Setting up MIDI support</title> 835<title>Setting up MIDI support</title>
820<body> 836<body>
821 837
822<p> 838<p>
839First, check to make sure that you enabled the <c>midi</c> USE flag in
840<path>/etc/make.conf</path>. If you didn't, go ahead and add it now. You will
841also need to re-emerge any ALSA packages that use the <c>midi</c> flag, such as
842<c>alsa-lib</c>, <c>alsa-utils</c>, and <c>alsa-driver</c>.
843</p>
844
845<p>
823If your sound card is one of those that come with on-board MIDI synthesizers 846If your sound card is one of those that come with on-board MIDI synthesizers
824and you would like to listen to some .mid files, you have to install 847and you would like to listen to some .mid files, you have to install
825<c>awesfx</c> which is basically a set of utilities for controlling the AWE32 848<c>awesfx</c> which is basically a set of utilities for controlling the AWE32
826driver. We need to install it first. If you don't have a hardware synthesizer, 849driver. We need to install it first. If you don't have a hardware synthesizer,
827you can use a virtual one. Please see the section on 850you can use a virtual one. Please see the section on
828<uri link="#vsynth">Virtual Synthesizers</uri> for more information. 851<uri link="#vsynth">Virtual Synthesizers</uri> for more information.
829</p> 852</p>
830 853
831<pre caption="Installing awesfx"> 854<pre caption="Installing awesfx">
832# <i>emerge awesfx</i> 855# <i>emerge awesfx</i>
833</pre> 856</pre>
834 857
835<note> 858<note>
836You will need to copy over SoundFont (SF2) files from your sound card's driver 859You will need to copy over SoundFont (SF2) files from your sound card's driver
837CD or a Windows installation into <path>/usr/share/sounds/sf2/</path>. For 860CD or a Windows installation into <path>/usr/share/sounds/sf2/</path>. For
838example a sound font file for the Creative SBLive! card would be 8MBGMSFX.SF2. 861example a sound font file for the Creative SBLive! card would be 8MBGMSFX.SF2.
839</note> 862</note>
840 863
841<p> 864<p>
842After copying over the Soundfont files, we can then play a midi file as shown. 865After copying over the Soundfont files, we can then play a midi file as shown.
843You can also add the <c>asfxload</c> command to 866You can also add the <c>asfxload</c> command to
844<path>/etc/conf.d/local.start</path>, so that the sound font is loaded 867<path>/etc/conf.d/local.start</path>, so that the sound font is loaded
845every time the system starts up. 868every time the system starts up.
846</p> 869</p>
847 870
848<note> 871<note>
849<path>/mnt</path> paths mentioned in the code listing(s) below will <e>not</e> 872<path>/mnt</path> paths mentioned in the code listing(s) below will <e>not</e>
850be the same in your machine. They are just an example. Please be careful to 873be the same in your machine. They are just an example. Please be careful to
851change the path to suit your machine. 874change the path to suit your machine.
852</note> 875</note>
853 876
854<pre caption="Loading Soundfonts"> 877<pre caption="Loading Soundfonts">
855<comment>(First, copy the Soundfont)</comment> 878<comment>(First, copy the Soundfont)</comment>
859<comment>(We load the specific Soundfont)</comment> 882<comment>(We load the specific Soundfont)</comment>
860# <i>asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2</i> 883# <i>asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2</i>
861</pre> 884</pre>
862 885
863<p> 886<p>
864You can now play midi files using a program like <c>aplaymidi</c>. Run 887You can now play midi files using a program like <c>aplaymidi</c>. Run
865<c>aplaymidi -l</c> to get a list of available ports and then pick one 888<c>aplaymidi -l</c> to get a list of available ports and then pick one
866to play the file on. 889to play the file on.
867</p> 890</p>
868 891
869<pre caption="Playing MIDI"> 892<pre caption="Playing MIDI">
870<comment>(Check open ports)</comment> 893<comment>(Check open ports)</comment>
893<pre caption="Installing timidity++"> 916<pre caption="Installing timidity++">
894# <i>emerge timidity++</i> 917# <i>emerge timidity++</i>
895</pre> 918</pre>
896 919
897<p> 920<p>
898For timidity to play sounds, it needs a sound font. If you do not have any, 921For timidity to play sounds, it needs a sound font. Fortunately, the ebuild will
899install <c>timidity-eawpatches</c> or <c>timidity-shompatches</c> which will 922install some sound font packages for you. There are a few other font packages
900give you some sound fonts. You can have multiple sound font configurations 923available in Portage, such as <c>timidity-freepats</c> and
924<c>timidity-eawpatches</c>. You can have multiple sound font configurations
901installed, and you can place your own in <path>/usr/share/timidity/</path>. 925installed, and you can place your own in <path>/usr/share/timidity/</path>. To
902To switch between different timidity configurations, you should use the 926switch between different timidity configurations, you should use
903<c>timidity-update</c> tool provided in the timidity++ package. 927<c>eselect</c>.
904</p> 928</p>
905 929
906<pre caption="Installing sound fonts"> 930<pre caption="Changing configurations">
931# <i>eselect timidity list</i>
907# <i>emerge timidity-eawpatches</i> 932# <i>eselect timidity set eawpatches</i>
908# <i>timidity-update -g -s eawpatches</i>
909
910<comment>(or)</comment>
911
912# <i>emerge timidity-shompatches</i>
913# <i>timidity-update -g -s shompatches</i>
914</pre> 933</pre>
915 934
916<p> 935<p>
917Don't forget to add <c>timidity</c> to the default runlevel. 936Don't forget to add <c>timidity</c> to the default runlevel.
918</p> 937</p>
932<title>Tools and Firmware</title> 951<title>Tools and Firmware</title>
933<body> 952<body>
934 953
935<p> 954<p>
936Some specific sound cards can benefit from certain tools provided by the 955Some specific sound cards can benefit from certain tools provided by the
937<c>alsa-tools</c> and <c>alsa-firmware</c> packages. If you need 956<c>alsa-tools</c> and <c>alsa-firmware</c> packages. You may install either with
938<c>alsa-tools</c>, be sure to define the ALSA_TOOLS variable in 957a simple <c>emerge</c>.
939<path>/etc/make.conf</path> with the tools you require. For instance:
940</p>
941
942<pre caption="Selecting ALSA Tools in /etc/make.conf">
943ALSA_TOOLS="as10k1 ac3dec"
944</pre>
945
946<p>
947If the ALSA_TOOLS variable is not set, all available tools will be built.
948Now, install the <c>alsa-tools</c> (and/or <c>alsa-firmware</c>) package(s):
949</p> 958</p>
950 959
951<pre caption="Installing ALSA Tools"> 960<pre caption="Installing ALSA Tools">
952# <i>emerge alsa-tools</i> 961# <i>emerge alsa-tools</i>
953</pre> 962</pre>
954 963
955</body> 964</body>
956</section> 965</section>
957<section> 966<section>
967<title>Multiple sound cards</title>
968<body>
969
970<p>
971You can have more than one sound card in your system simultaneously, provided
972that you have built ALSA as modules in your kernel (or have installed
973<c>alsa-driver</c> instead). You just need to specify which should be started
974first in <path>/etc/modules.d/alsa</path>. Your cards are identified by their
975driver names inside this file. 0 is the first card, 1 is the second, and so on.
976Here's an example for a system with two sound cards.
977</p>
978
979<pre caption="Two sound cards in /etc/modules.d/alsa">
980options snd-emu10k1 index=0
981options snd-via82xx index=1
982</pre>
983
984<p>
985Or, if you have two cards that use the same driver, you specify them on the same
986line, using comma-separated numbers. Here's an example for a system with three
987sound cards, two of which are the same Intel High Definition Audio card.
988</p>
989
990<pre caption="Multiple sound cards in /etc/modules.d/alsa">
991options snd-ymfpci index=0
992options snd-hda-intel index=1,2
993</pre>
994
995</body>
996</section>
997<section>
998<title>Plugins</title>
999<body>
1000
1001<p>
1002You may want to install some plugins for extra functionality.
1003<c>alsa-plugins</c> is a collection of useful plugins, which include: PulseAudio
1004output, a sample rate converter, jack (a low-latency audio server), and an
1005encoder that lets you output 6-channel audio through digital S/PDIF connections
1006(both optical and coaxial). You can choose which of its plugins you want
1007installed by adding their USE flags to <path>/etc/portage/package.use</path>.
1008</p>
1009
1010<pre caption="Installing alsa-plugins">
1011# <i>emerge -avt alsa-plugins</i>
1012</pre>
1013
1014</body>
1015</section>
1016<section>
958<title>A Big thank you to...</title> 1017<title>A big thank you to...</title>
959<body> 1018<body>
960 1019
961<p> 1020<p>
962Everyone who contributed to the earlier version of the Gentoo ALSA Guide: 1021Everyone who contributed to the earlier version of the Gentoo ALSA Guide:
963Vincent Verleye, Grant Goodyear, Arcady Genkin, Jeremy Huddleston, 1022Vincent Verleye, Grant Goodyear, Arcady Genkin, Jeremy Huddleston,
964John P. Davis, Sven Vermeulen, Benny Chuang, Tiemo Kieft and Erwin. 1023John P. Davis, Sven Vermeulen, Benny Chuang, Tiemo Kieft and Erwin.
965</p> 1024</p>
966 1025
967</body> 1026</body>
968</section> 1027</section>

Legend:
Removed from v.1.69  
changed lines
  Added in v.1.80

  ViewVC Help
Powered by ViewVC 1.1.20