/[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.77
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.77 2007/05/03 06:21:01 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.20</version>
22<date>2006-07-06</date> 28<date>2007-05-02</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>
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
93possible that features and fixes found in one might not yet be incorporated into
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.
90</p> 99</p>
91 100
92<p> 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 :
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">
208<c>emu10k1</c> module. That is the information we need for now. If you are 222<c>emu10k1</c> module. That is the information we need for now. If you are
209interested in detailed information, you can click on the link next to the 223interested in detailed information, you can click on the link next to the
210"Details" and that will take you to the <c>emu10k1</c> specific page. 224"Details" and that will take you to the <c>emu10k1</c> specific page.
211</p> 225</p>
212 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>.
231</p>
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>
252Now we will look at some of the options we will have to enable in the 2.6 272Now 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. 273kernel to ensure proper ALSA support for our sound card.
254</p> 274</p>
255 275
256<p> 276<p>
257Please note that for the sake of ease, all examples show ALSA built as modules. 277Please 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> 278is 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 279which 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 280the <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 281you still like to have options built-in, ensure that you make changes to your
262config accordingly. 282config accordingly.
263</p> 283</p>
391<pre caption="Installing alsa-driver"> 411<pre caption="Installing alsa-driver">
392# <i>emerge alsa-driver</i> 412# <i>emerge alsa-driver</i>
393</pre> 413</pre>
394 414
395<impo> 415<impo>
396Please note that you will have to run <c>emerge alsa-driver</c> after every 416Please note that you will have to run <c>emerge alsa-driver</c> after every
397kernel (re)compile, as the earlier drivers are deleted. 417kernel (re)compile, as the earlier drivers are deleted. To make this task
418easier, you may want to emerge the <c>module-rebuild</c> package, which will
419keep track of module packages and rebuild them for you. First run
420<c>module-rebuild populate</c> to create the list, and then after every kernel
421(re)compile, you just run <c>module-rebuild rebuild</c>, and your external
422modules will be rebuilt.
398</impo> 423</impo>
399 424
400</body> 425</body>
401</section> 426</section>
402</chapter> 427</chapter>
429</section> 454</section>
430<section id="alsa-config"> 455<section id="alsa-config">
431<title>Configuration</title> 456<title>Configuration</title>
432<body> 457<body>
433 458
459<p>
460Recent versions of <c>udev</c> (<c>>=udev-103</c>) provide some degree of
461kernel-level autoconfiguration of your sound card. If possible, try to rely on
462just letting your kernel automatically setup your sound card for you. Otherwise,
463use <c>alsaconf</c> to configure your card, as shown below.
464</p>
465
434<note> 466<note>
435Please shut down any programs that <e>might</e> access the sound card while 467Please shut down any programs that <e>might</e> access the sound card while
436running <c>alsaconf</c>. 468running <c>alsaconf</c>.
437</note> 469</note>
438 470
439<p> 471<p>
440The easiest way to configure your sound card is to run <c>alsaconf</c>. Just 472Another way to configure your sound card is to run <c>alsaconf</c>. Just type
441type <c>alsaconf</c> in a shell as root. 473<c>alsaconf</c> in a shell as root.
442</p> 474</p>
443 475
444<pre caption="Invoking alsaconf"> 476<pre caption="Invoking alsaconf">
445# <i>alsaconf</i> 477# <i>alsaconf</i>
446</pre> 478</pre>
449You will now see a neat menu guided interface that will automatically probe 481You 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 482your 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 483your 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>. 484automatically make required changes to <path>/etc/modules.d/alsa</path>.
453It will then adjust your volume settings to optimum levels, run 485It 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. 486<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 487Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA
456initscript. 488initscript.
457</p> 489</p>
458 490
459</body> 491</body>
509<section> 541<section>
510<title>Volume Check!</title> 542<title>Volume Check!</title>
511<body> 543<body>
512 544
513<p> 545<p>
514We've completed all the setups and pre-requisites, so let's fire up ALSA. If 546We'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 547you ran <c>alsaconf</c>, you can skip this step, since <c>alsaconf</c> already
516does this for you. 548does this for you.
517</p> 549</p>
518 550
519<pre caption="Start the service"> 551<pre caption="Start the service">
520<comment>(ALSA as modules)</comment>
521# <i>/etc/init.d/alsasound start</i> 552# <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> 553</pre>
534 554
535<p> 555<p>
536Now that the required things have been taken care of, we need to check up on 556Now 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 557the volume as in certain cases, it is muted. We use <c>alsamixer</c> for this
606 626
607<p> 627<p>
608Finally. Some music. If everything above is perfect, you should now be able to 628Finally. 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 629listen 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 630like <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 631like <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 632by <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. 633always, <c>emerge</c> what you need.
614</p> 634</p>
615 635
616<pre caption="Getting the software"> 636<pre caption="Getting the software">
617<comment>(Install the applications you want)</comment> 637<comment>(Install the applications you want)</comment>
618# <i>emerge madplay mpg123 xmms</i> 638# <i>emerge madplay mpg123</i>
619<comment>(To play .ogg files)</comment> 639<comment>(To play .ogg files)</comment>
620# <i>emerge vorbis-tools</i> 640# <i>emerge vorbis-tools</i>
621</pre> 641</pre>
622 642
623<p> 643<p>
813</section> 833</section>
814</chapter> 834</chapter>
815 835
816<chapter> 836<chapter>
817<title>Other things ALSA</title> 837<title>Other things ALSA</title>
818<section> 838<section id="midi">
819<title>Setting up MIDI support</title> 839<title>Setting up MIDI support</title>
820<body> 840<body>
841
842<p>
843First, check to make sure that you enabled the <c>midi</c> USE flag in
844<path>/etc/make.conf</path>. If you didn't, go ahead and add it now. You will
845also need to re-emerge any ALSA packages that use the <c>midi</c> flag, such as
846<c>alsa-lib</c>, <c>alsa-utils</c>, and <c>alsa-driver</c>.
847</p>
821 848
822<p> 849<p>
823If your sound card is one of those that come with on-board MIDI synthesizers 850If 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 851and 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 852<c>awesfx</c> which is basically a set of utilities for controlling the AWE32
893<pre caption="Installing timidity++"> 920<pre caption="Installing timidity++">
894# <i>emerge timidity++</i> 921# <i>emerge timidity++</i>
895</pre> 922</pre>
896 923
897<p> 924<p>
898For timidity to play sounds, it needs a sound font. If you do not have any, 925For 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 926install 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 927available in Portage, such as <c>timidity-freepats</c> and
928<c>timidity-eawpatches</c>. You can have multiple sound font configurations
901installed, and you can place your own in <path>/usr/share/timidity/</path>. 929installed, and you can place your own in <path>/usr/share/timidity/</path>. To
902To switch between different timidity configurations, you should use the 930switch between different timidity configurations, you should use
903<c>timidity-update</c> tool provided in the timidity++ package. 931<c>eselect</c>.
904</p> 932</p>
905 933
906<pre caption="Installing sound fonts"> 934<pre caption="Changing configurations">
935# <i>eselect timidity list</i>
907# <i>emerge timidity-eawpatches</i> 936# <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> 937</pre>
915 938
916<p> 939<p>
917Don't forget to add <c>timidity</c> to the default runlevel. 940Don't forget to add <c>timidity</c> to the default runlevel.
918</p> 941</p>
932<title>Tools and Firmware</title> 955<title>Tools and Firmware</title>
933<body> 956<body>
934 957
935<p> 958<p>
936Some specific sound cards can benefit from certain tools provided by the 959Some 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 960<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 961a 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> 962</p>
950 963
951<pre caption="Installing ALSA Tools"> 964<pre caption="Installing ALSA Tools">
952# <i>emerge alsa-tools</i> 965# <i>emerge alsa-tools</i>
953</pre> 966</pre>
954 967
955</body> 968</body>
956</section> 969</section>
957<section> 970<section>
971<title>Multiple sound cards</title>
972<body>
973
974<p>
975You can have more than one sound card in your system simultaneously, provided
976that you have built ALSA as modules in your kernel (or have installed
977<c>alsa-driver</c> instead). You just need to specify which should be started
978first in <path>/etc/modules.d/alsa</path>. Your cards are identified by their
979driver names inside this file. 0 is the first card, 1 is the second, and so on.
980Here's an example for a system with two sound cards.
981</p>
982
983<pre caption="Two sound cards in /etc/modules.d/alsa">
984options snd-emu10k1 index=0
985options snd-via82xx index=1
986</pre>
987
988<p>
989Or, if you have two cards that use the same driver, you specify them on the same
990line, using comma-separated numbers. Here's an example for a system with three
991sound cards, two of which are the same Intel High Definition Audio card.
992</p>
993
994<pre caption="Multiple sound cards in /etc/modules.d/alsa">
995options snd-ymfpci index=0
996options snd-hda-intel index=1,2
997</pre>
998
999</body>
1000</section>
1001<section>
1002<title>Plugins</title>
1003<body>
1004
1005<p>
1006You may want to install some plugins for extra functionality.
1007<c>alsa-plugins</c> is a collection of useful plugins, which include: PulseAudio
1008output, a sample rate converter, jack (a low-latency audio server), and an
1009encoder that lets you output 6-channel audio through digital S/PDIF connections
1010(both optical and coaxial). You can choose which of its plugins you want
1011installed by adding their USE flags to <path>/etc/portage/package.use</path>.
1012</p>
1013
1014<pre caption="Installing alsa-plugins">
1015# <i>emerge -avt alsa-plugins</i>
1016</pre>
1017
1018</body>
1019</section>
1020<section>
958<title>A Big thank you to...</title> 1021<title>A big thank you to...</title>
959<body> 1022<body>
960 1023
961<p> 1024<p>
962Everyone who contributed to the earlier version of the Gentoo ALSA Guide: 1025Everyone who contributed to the earlier version of the Gentoo ALSA Guide:
963Vincent Verleye, Grant Goodyear, Arcady Genkin, Jeremy Huddleston, 1026Vincent Verleye, Grant Goodyear, Arcady Genkin, Jeremy Huddleston,

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

  ViewVC Help
Powered by ViewVC 1.1.20