/[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.53 Revision 1.54
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.53 2005/06/08 19:54:07 fox2mike Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.54 2005/07/12 19:17:38 fox2mike 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>
13<abstract> 13<abstract>
14This document helps a user setup ALSA on Gentoo Linux. 14This document helps a user setup ALSA on Gentoo Linux.
15</abstract> 15</abstract>
16 16
17<!-- The content of this document is licensed under the CC-BY-SA license --> 17<!-- The content of this document is licensed under the CC-BY-SA license -->
18<!-- See http://creativecommons.org/licenses/by-sa/2.0 --> 18<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
19<license/> 19<license/>
20 20
21<version>2.2</version> 21<version>2.3</version>
22<date>2005-06-09</date> 22<date>2005-07-12</date>
23 23
24<chapter> 24<chapter>
25<title>Introduction</title> 25<title>Introduction</title>
26<section> 26<section>
27<title>What is ALSA?</title> 27<title>What is ALSA?</title>
68 68
69<warn> 69<warn>
70The methods shown below are mutually exclusive. You cannot have ALSA compiled 70The 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. 71in your kernel and use <c>media-sound/alsa-driver</c>. It <e>will</e> fail.
72</warn> 72</warn>
73
74<impo>
75<c>genkernel</c> users have their config built such a way that the ALSA
76sub-system in the kernel is active. Therefore <c>genkernel</c> users can
77proceed to the <uri link="#alsa-utilities">ALSA Utilities</uri> section
78directly.
79</impo>
80 73
81<p> 74<p>
82The two options are : 75The two options are :
83</p> 76</p>
84 77
162<title>Before you proceed</title> 155<title>Before you proceed</title>
163<body> 156<body>
164 157
165<p> 158<p>
166Whichever method of install you choose, you need to know what drivers your 159Whichever method of install you choose, you need to know what drivers your
160sound card uses. In most cases, sound cards (onboard and otherwise) are PCI
167sound card uses. <c>lspci</c> will help you in digging out the required 161based and <c>lspci</c> will help you in digging out the required information.
168information. Please <c>emerge sys-apps/pciutils</c> to get <c>lspci</c>, if 162Please <c>emerge sys-apps/pciutils</c> to get <c>lspci</c>, if you don't have it
169you don't have it installed already. We now proceed to find out details about 163installed already. In case you have a USB sound card, <c>lsusb</c> from
170the sound card. 164<c>sys-apps/usbutils</c> <e>might</e> be of help. For ISA cards, try using
165<c>sys-apps/isapnptools</c>. Also, the following pages <e>may</e> help users
166with ISA based sound cards.
167</p>
168
169<ul>
170 <li>
171 <uri link="http://www.roestock.demon.co.uk/isapnptools/">The ISAPNPTOOLS
172 Page</uri>
173 </li>
174 <li>
175 <uri link="http://www2.linuxjournal.com/article/3269">LinuxJournal PnP
176 Article</uri>
177 </li>
178 <li>
179 <uri link="http://www.tldp.org/HOWTO/Sound-HOWTO/x320.html">TLDP Sound
180 HowTo</uri>
181 </li>
182</ul>
183
184<note>
185For ease of use/explanation, we assume the user has a PCI based sound card for
186the remainder of this guide.
187</note>
188
189<p>
190We now proceed to find out details about the sound card.
171</p> 191</p>
172 192
173<pre caption="Soundcard Details"> 193<pre caption="Soundcard Details">
174# <i>lspci -v | grep -i audio</i> 194# <i>lspci -v | grep -i audio</i>
1750000:00:0a.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 06) 1950000:00:0a.0 Multimedia audio controller: Creative Labs SB Live! EMU10k1 (rev 06)
206 226
207<p> 227<p>
208Let us now configure the kernel to enable ALSA. 228Let us now configure the kernel to enable ALSA.
209</p> 229</p>
210 230
231<impo>
232<c>genkernel</c> users should now run <c>genkernel --menuconfig</c> and then follow
233the instructions in <uri link="#doc_chap2_pre3">Kernel Options for ALSA</uri>.
234</impo>
235
211<pre caption="Heading over to the source"> 236<pre caption="Heading over to the source">
212# <i>cd /usr/src/linux</i> 237# <i>cd /usr/src/linux</i>
213# <i>make menuconfig</i> 238# <i>make menuconfig</i>
214</pre> 239</pre>
215 240
221<p> 246<p>
222Now we will look at some of the options we will have to enable in the 2.6 247Now we will look at some of the options we will have to enable in the 2.6
223kernel to ensure proper ALSA support for our sound card. 248kernel to ensure proper ALSA support for our sound card.
224</p> 249</p>
225 250
226<note> 251<p>
227Please note that for the sake of ease, all examples show a modular kernel. It 252Please note that for the sake of ease, all examples show ALSA built as modules.
228is advisable to follow the same. Please do <e>not</e> skip the 253It is advisable to follow the same as it then allows the use of <c>alsaconf</c>
254which is a boon when you want to configure your card. Please do <e>not</e> skip the <uri
229<uri link="#alsa-config">Configuration</uri> section of this document. If 255link="#alsa-config">Configuration</uri> section of this document. If you still
230you still like to have options built-in, ensure that you make changes to your 256like to have options built-in, ensure that you make changes to your config
231config accordingly. 257accordingly.
232</note> 258</p>
233 259
234<pre caption="Kernel Options for ALSA"> 260<pre caption="Kernel Options for ALSA">
235Device Drivers ---&gt; 261Device Drivers ---&gt;
236 Sound ---&gt; 262 Sound ---&gt;
237 263
315<p> 341<p>
316If you have compiled your kernel and want to use <c>alsa-driver</c>, please 342If you have compiled your kernel and want to use <c>alsa-driver</c>, please
317ensure the following before proceeding, else <c>alsa-driver</c> is likely to 343ensure the following before proceeding, else <c>alsa-driver</c> is likely to
318fail. The next code listing gives you one way of performing the checks. 344fail. The next code listing gives you one way of performing the checks.
319</p> 345</p>
346
347<note>
348<c>genkernel</c> users can proceed with <uri link="#doc_chap2_pre6">Installing
349alsa-driver</uri> as their configuration is in sync with the one shown below by
350default.
351</note>
320 352
321<ol> 353<ol>
322 <li> 354 <li>
323 <c>CONFIG_SOUND</c> is set. (Basic Sound support enabled) 355 <c>CONFIG_SOUND</c> is set. (Basic Sound support enabled)
324 </li> 356 </li>
345<comment>(and 3. is true)</comment> 377<comment>(and 3. is true)</comment>
346CONFIG_SND is not set 378CONFIG_SND is not set
347</pre> 379</pre>
348 380
349<p> 381<p>
350Now all you have to do is type the magic words...and no, its not abracadabra. 382Now all you have to do is type the magic words... and no, it's not abracadabra.
351</p> 383</p>
352 384
353<pre caption="Installing alsa-driver"> 385<pre caption="Installing alsa-driver">
354# <i>emerge alsa-driver</i> 386# <i>emerge alsa-driver</i>
355</pre> 387</pre>
410<p> 442<p>
411You will now see a neat menu guided interface that will automatically probe 443You will now see a neat menu guided interface that will automatically probe
412your devices and try to find out your sound card. You will be asked to pick 444your devices and try to find out your sound card. You will be asked to pick
413your sound card from a list. Once that's done, it will ask you permission to 445your sound card from a list. Once that's done, it will ask you permission to
414automatically make required changes to <path>/etc/modules.d/alsa</path>. 446automatically make required changes to <path>/etc/modules.d/alsa</path>.
415It will then adjust your volume settings to optimum levels and run 447It will then adjust your volume settings to optimum levels, run
416<c>modules-update</c> and starts the <path>/etc/init.d/alsasound</path> 448<c>modules-update</c> and start the <path>/etc/init.d/alsasound</path> service.
417service. Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA 449Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA initscript.
418initscript.
419</p> 450</p>
420 451
421</body> 452</body>
422</section> 453</section>
423<section id="initscript"> 454<section id="initscript">
430volume settings when your system comes up. The ALSA Initscript handles all of 461volume settings when your system comes up. The ALSA Initscript handles all of
431this for you and is called <c>alsasound</c>. Add it to the default run-level. 462this for you and is called <c>alsasound</c>. Add it to the default run-level.
432</p> 463</p>
433 464
434<pre caption="Adding ALSA to default"> 465<pre caption="Adding ALSA to default">
435# <i>rc-update add alsasound default</i> 466# <i>rc-update add alsasound boot</i>
436 * alsasound added to runlevel default 467 * alsasound added to runlevel boot
437 * rc-update complete. 468 * rc-update complete.
438</pre> 469</pre>
439 470
440<p> 471<p>
441Next, just check the <path>/etc/conf.d/alsasound</path> file and ensure that 472Next, just check the <path>/etc/conf.d/alsasound</path> file and ensure that
444</p> 475</p>
445 476
446</body> 477</body>
447</section> 478</section>
448<section> 479<section>
480<title>Audio Group</title>
481<body>
482
483<p>
484Before we move on to testing, there's one last <e>important</e> thing that needs
485to be setup. Rule of thumb in a *nix OS : Do not run as root unless needed.
486This applies here as well ;) How? Well, most of the times you should be logged
487in as a user and would like to listen to music or access your soundcard. For
488that to happen, you need to be in the "audio" group. At this point, we'll add
489users to the audio group, so that they won't have any issues when they want to
490access sound devices. We'll use <c>gpasswd</c> here and you need to be logged in
491as root for this to work.
492</p>
493
494<pre caption="Adding users to the audio group">
495<comment>(Substitute &lt;username&gt; with your user)</comment>
496# <i>gpasswd -a &lt;username&gt; audio </i>
497Adding user &lt;username&gt; to group audio
498</pre>
499
500</body>
501</section>
502<section>
449<title>Volume Check!</title> 503<title>Volume Check!</title>
450<body> 504<body>
451 505
452<p> 506<p>
453We've completed all the setups and pre-requisites, so let's fire up ALSA. If 507We've completed all the setups and pre-requisites, so let's fire up ALSA. If
454you ran <c>alsaconf</c>, you can skip this step, since <c>alsaconf</c> already 508you ran <c>alsaconf</c>, you can skip this step, since <c>alsaconf</c> already
455does this for you. 509does this for you.
456</p> 510</p>
457 511
458<pre caption="Start the service"> 512<pre caption="Start the service">
459<comment>(Modular Kernels)</comment> 513<comment>(ALSA as modules)</comment>
460# <i>/etc/init.d/alsasound start</i> 514# <i>/etc/init.d/alsasound start</i>
461 * Loading ALSA modules ... 515 * Loading ALSA modules ...
462 * Loading: snd-card-0 ... [ ok ] 516 * Loading: snd-card-0 ... [ ok ]
463 * Loading: snd-pcm-oss ... [ ok ] 517 * Loading: snd-pcm-oss ... [ ok ]
464 * Loading: snd-seq ... [ ok ] 518 * Loading: snd-seq ... [ ok ]
470 * Loading ALSA modules ... 524 * Loading ALSA modules ...
471 * Restoring Mixer Levels ... [ ok ] 525 * Restoring Mixer Levels ... [ ok ]
472</pre> 526</pre>
473 527
474<p> 528<p>
475Now that the required things have been take care of, we need to check up on 529Now that the required things have been taken care of, we need to check up on
476the volume as in certain cases, it is muted. We use <c>alsamixer</c> for this purpose. 530the volume as in certain cases, it is muted. We use <c>alsamixer</c> for this
531purpose.
477</p> 532</p>
478 533
479<pre caption="Starting alsamixer"> 534<pre caption="Starting alsamixer">
480<comment>(Opens up a console program. Only required settings are shown)</comment> 535<comment>(Opens up a console program. Only required settings are shown)</comment>
481# <i>alsamixer</i> 536# <i>alsamixer</i>
482</pre> 537</pre>
538
539<impo>
540If you have issues starting up <c>alsamixer</c> and get errors such as
541alsamixer: function snd_ctl_open failed for default: No such file or directory,
542this is usually an issue with udev setting up the devices. Run <c>killall -9
543udevd; udevstart</c> to reload /dev entries and fire up <c>alsamixer</c>. It
544should solve the issue.
545</impo>
483 546
484<p> 547<p>
485This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay 548This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay
486attention to the Master and PCM channels which both have an MM below them. 549attention to the Master and PCM channels which both have an MM below them.
487That means they are muted. If you try to play anything with <c>alsamixer</c> 550That means they are muted. If you try to play anything with <c>alsamixer</c>
493<p> 556<p>
494Now, we shall unmute the channels, and set volume levels as needed. 557Now, we shall unmute the channels, and set volume levels as needed.
495</p> 558</p>
496 559
497<warn> 560<warn>
498Both Master <e>and</e> PCM need to be unmuted and set to audible volume levels if 561Both Master <e>and</e> PCM need to be unmuted and set to audible volume levels
499you want to hear some output on your speakers. 562if you want to hear some output on your speakers.
500</warn> 563</warn>
501 564
502<ul> 565<ul>
503 <li> 566 <li>
504 To move between channels, use your left and right arrow keys. (&lt;- 567 To move between channels, use your left and right arrow keys. (&lt;-
533<section> 596<section>
534<title>Sound Check!</title> 597<title>Sound Check!</title>
535<body> 598<body>
536 599
537<p> 600<p>
601The irritating way to check your soundcard is to see if you can hear static on
602the speakers. This isn't exactly fun, but hey, it tells you the card is
603configured and working.
604</p>
605
606<pre caption="Bring on th static">
607# <i>cat /dev/urandom > /dev/dsp</i>
608</pre>
609
610<note>
611<path>/dev/dsp</path> is a symlink to <path>/dev/sound/dsp</path> and should be
612automatically created. Try re-directing the output to
613<path>/dev/sound/dsp</path> in case you don't get a "No such file or directory"
614error.
615</note>
616
617<p>
618You should hear static. Press <c>Ctrl + C</c> to stop. If you don't hear
619anything, now is a good time to go back and check/trace out the issue and
620rectify it.
621</p>
622
623<p>
538Finally. Some music. If everything above is perfect, you should be able to now 624Finally. Some music. If everything above is perfect, you should now be able to
539listen to some good music. A quick way to test is to use a command line tool 625listen to some good music. A quick way to test is to use a command line tool
540like <c>media-sound/madplay</c>. You could also use something more well known 626like <c>media-sound/madplay</c>. You could also use something more well known
541like <c>mpg123</c> or <c>xmms</c>. If you are an ogg fan, you could use 627like <c>mpg123</c> or <c>xmms</c>. If you are an ogg fan, you could use
542<c>ogg123</c> provided by <c>media-sound/vorbis-tools</c>. Use any player you 628<c>ogg123</c> provided by <c>media-sound/vorbis-tools</c>. Use any player you
543are comfortable with. As always, <c>emerge</c> what you need. 629are comfortable with. As always, <c>emerge</c> what you need.
544</p> 630</p>
545 631
580</pre> 666</pre>
581 667
582</body> 668</body>
583</section> 669</section>
584<section> 670<section>
671<title> ALSA and USE</title>
672<body>
673
674<p>
675You can now add the <c>alsa</c> use flag to <path>/etc/make.conf</path> to
676ensure that your applications that support ALSA get built with it. Some
677architectures like x86 and amd64 have the flag enabled by default.
678</p>
679
680</body>
681</section>
682<section>
585<title>Issues?</title> 683<title>Issues?</title>
586<body> 684<body>
587 685
588<p> 686<p>
589If for some reason you're unable to hear sound, the first thing to do would 687If for some reason you're unable to hear sound, the first thing to do would
590be to check your <uri link="#doc_chap3_pre5">alsamixer</uri> settings. 80% of 688be to check your <uri link="#doc_chap3_pre6">alsamixer</uri> settings. 80% of
591the issues lie with muted channels or low volume. Also check your Window 689the issues lie with muted channels or low volume. Also check your Window
592Manager's sound applet and verify that volumes are set to audible levels. 690Manager's sound applet and verify that volumes are set to audible levels.
593</p> 691</p>
594 692
595<p> 693<p>

Legend:
Removed from v.1.53  
changed lines
  Added in v.1.54

  ViewVC Help
Powered by ViewVC 1.1.20