/[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.54 Revision 1.69
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.54 2005/07/12 19:17:38 fox2mike Exp $ --> 2<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.69 2006/07/07 14:40:08 rane 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>
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.5 --> 18<!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
19<license/> 19<license/>
20 20
21<version>2.3</version> 21<version>2.14</version>
22<date>2005-07-12</date> 22<date>2006-07-06</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>
83 <li> 83 <li>
84 Use Gentoo's <c>media-sound/alsa-driver</c> package. 84 Use Gentoo's <c>media-sound/alsa-driver</c> package.
85 </li> 85 </li>
86</ol> 86</ol>
87 87
88<p> 88<p>
89We shall take a peek into both before finally deciding on one. 89We shall take a peek into both before finally deciding on one.
90</p> 90</p>
91 91
92<p> 92<p>
93If you were to use ALSA provided by the kernel, the following are the pros and 93If you were to use ALSA provided by the kernel, the following are the pros and
144 144
145<p> 145<p>
146The main difference between using <c>alsa-driver</c> and ALSA that comes with 146The main difference between using <c>alsa-driver</c> and ALSA that comes with
147the kernel is that <c>alsa-driver</c> is generally more up to date than the 147the kernel is that <c>alsa-driver</c> is generally more up to date than the
148version in the kernel. Since this does not make any huge difference as 148version in the kernel. Since this does not make any huge difference as
149such, you are encouraged to use the ALSA provided by the kernel. 149such, you are encouraged to use the ALSA provided by the kernel for ease of use.
150Before reporting any sound related issues to <uri
151link="https://bugs.gentoo.org">Gentoo Bugzilla</uri>, please try to reproduce
152them using <c>alsa-driver</c> and file the bug report no matter what the
153result.
150</p> 154</p>
151 155
152</body> 156</body>
153</section> 157</section>
154<section id="lspci"> 158<section id="lspci">
227<p> 231<p>
228Let us now configure the kernel to enable ALSA. 232Let us now configure the kernel to enable ALSA.
229</p> 233</p>
230 234
231<impo> 235<impo>
232<c>genkernel</c> users should now run <c>genkernel --menuconfig</c> and then follow 236<c>genkernel</c> users should now run <c>genkernel --menuconfig all</c> and
233the instructions in <uri link="#doc_chap2_pre3">Kernel Options for ALSA</uri>. 237then follow the instructions in <uri link="#doc_chap2_pre3">Kernel Options for
238ALSA</uri>.
234</impo> 239</impo>
235 240
236<pre caption="Heading over to the source"> 241<pre caption="Heading over to the source">
237# <i>cd /usr/src/linux</i> 242# <i>cd /usr/src/linux</i>
238# <i>make menuconfig</i> 243# <i>make menuconfig</i>
249</p> 254</p>
250 255
251<p> 256<p>
252Please note that for the sake of ease, all examples show ALSA built as modules. 257Please note that for the sake of ease, all examples show ALSA built as modules.
253It is advisable to follow the same as it then allows the use of <c>alsaconf</c> 258It 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 259which is a boon when you want to configure your card. Please do <e>not</e> skip
255link="#alsa-config">Configuration</uri> section of this document. If you still 260the <uri link="#alsa-config">Configuration</uri> section of this document. If
256like to have options built-in, ensure that you make changes to your config 261you still like to have options built-in, ensure that you make changes to your
257accordingly. 262config accordingly.
258</p> 263</p>
259 264
260<pre caption="Kernel Options for ALSA"> 265<pre caption="Kernel Options for ALSA">
261Device Drivers ---&gt; 266Device Drivers ---&gt;
262 Sound ---&gt; 267 Sound ---&gt;
304USB Devices ---&gt; 309USB Devices ---&gt;
305</pre> 310</pre>
306 311
307<p> 312<p>
308Now that your options are set, you can (re)compile the kernel and ALSA support 313Now that your options are set, you can (re)compile the kernel and ALSA support
309for your card should be functional once you reboot into the new kernel. 314for 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.
310You can now proceed to <uri link="#alsa-utilities">ALSA Utilities</uri> and 316You can now proceed to <uri link="#alsa-utilities">ALSA Utilities</uri> and
311see if everything is working as it should. 317see if everything is working as it should.
312</p> 318</p>
313 319
314</body> 320</body>
332</p> 338</p>
333 339
334<pre caption="Adding ALSA_CARDS to make.conf"> 340<pre caption="Adding ALSA_CARDS to make.conf">
335<comment>(For one sound card)</comment> 341<comment>(For one sound card)</comment>
336ALSA_CARDS="emu10k1" 342ALSA_CARDS="emu10k1"
337<comment>(For more than one, seperate names with spaces)</comment> 343<comment>(For more than one, separate names with spaces)</comment>
338ALSA_CARDS="emu10k1 via82xx" 344ALSA_CARDS="emu10k1 via82xx"
339</pre> 345</pre>
340 346
341<p> 347<p>
342If you have compiled your kernel and want to use <c>alsa-driver</c>, please 348If you have compiled your kernel and want to use <c>alsa-driver</c>, please
444your devices and try to find out your sound card. You will be asked to pick 450your devices and try to find out your sound card. You will be asked to pick
445your sound card from a list. Once that's done, it will ask you permission to 451your sound card from a list. Once that's done, it will ask you permission to
446automatically make required changes to <path>/etc/modules.d/alsa</path>. 452automatically make required changes to <path>/etc/modules.d/alsa</path>.
447It will then adjust your volume settings to optimum levels, run 453It will then adjust your volume settings to optimum levels, run
448<c>modules-update</c> and start the <path>/etc/init.d/alsasound</path> service. 454<c>modules-update</c> and start the <path>/etc/init.d/alsasound</path> service.
449Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA initscript. 455Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA
456initscript.
450</p> 457</p>
451 458
452</body> 459</body>
453</section> 460</section>
454<section id="initscript"> 461<section id="initscript">
457 464
458<p> 465<p>
459We're now almost all setup. Whichever method you chose to install ALSA, you'll 466We're now almost all setup. Whichever method you chose to install ALSA, you'll
460need to have something load your modules or initialize ALSA and restore your 467need to have something load your modules or initialize ALSA and restore your
461volume settings when your system comes up. The ALSA Initscript handles all of 468volume settings when your system comes up. The ALSA Initscript handles all of
462this for you and is called <c>alsasound</c>. Add it to the default run-level. 469this for you and is called <c>alsasound</c>. Add it to the boot runlevel.
463</p> 470</p>
464 471
465<pre caption="Adding ALSA to default"> 472<pre caption="Adding ALSA to the boot runlevel">
466# <i>rc-update add alsasound boot</i> 473# <i>rc-update add alsasound boot</i>
467 * alsasound added to runlevel boot 474 * alsasound added to runlevel boot
468 * rc-update complete. 475 * rc-update complete.
469</pre> 476</pre>
470 477
483<p> 490<p>
484Before we move on to testing, there's one last <e>important</e> thing that needs 491Before 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. 492to 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 493This 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 494in 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 495that 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 496users 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 497access sound devices. We'll use <c>gpasswd</c> here and you need to be logged in
491as root for this to work. 498as root for this to work.
492</p> 499</p>
493 500
513<comment>(ALSA as modules)</comment> 520<comment>(ALSA as modules)</comment>
514# <i>/etc/init.d/alsasound start</i> 521# <i>/etc/init.d/alsasound start</i>
515 * Loading ALSA modules ... 522 * Loading ALSA modules ...
516 * Loading: snd-card-0 ... [ ok ] 523 * Loading: snd-card-0 ... [ ok ]
517 * Loading: snd-pcm-oss ... [ ok ] 524 * Loading: snd-pcm-oss ... [ ok ]
518 * Loading: snd-seq ... [ ok ] 525 * Loading: snd-seq ... [ ok ]
519 * Loading: snd-emu10k1-synth ... [ ok ] 526 * Loading: snd-emu10k1-synth ... [ ok ]
520 * Loading: snd-seq-midi ... [ ok ] 527 * Loading: snd-seq-midi ... [ ok ]
521 * Restoring Mixer Levels ... [ ok ] 528 * Restoring Mixer Levels ... [ ok ]
522<comment>(ALSA compiled in)</comment> 529<comment>(ALSA compiled in)</comment>
523# <i>/etc/init.d/alsasound start</i> 530# <i>/etc/init.d/alsasound start</i>
524 * Loading ALSA modules ... 531 * Loading ALSA modules ...
525 * Restoring Mixer Levels ... [ ok ] 532 * Restoring Mixer Levels ... [ ok ]
537</pre> 544</pre>
538 545
539<impo> 546<impo>
540If you have issues starting up <c>alsamixer</c> and get errors such as 547If 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, 548alsamixer: 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 549this is usually an issue with udev setting up the devices. Run <c>killall
543udevd; udevstart</c> to reload /dev entries and fire up <c>alsamixer</c>. It 550udevd; udevstart</c> to reload <path>/dev</path> entries and fire up
544should solve the issue. 551<c>alsamixer</c>. It should solve the issue.
545</impo> 552</impo>
546 553
547<p> 554<p>
548This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay 555This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay
549attention to the Master and PCM channels which both have an MM below them. 556attention to the Master and PCM channels which both have an MM below them.
594</body> 601</body>
595</section> 602</section>
596<section> 603<section>
597<title>Sound Check!</title> 604<title>Sound Check!</title>
598<body> 605<body>
599
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 606
623<p> 607<p>
624Finally. Some music. If everything above is perfect, you should now be able to 608Finally. Some music. If everything above is perfect, you should now be able to
625listen to some good music. A quick way to test is to use a command line tool 609listen to some good music. A quick way to test is to use a command line tool
626like <c>media-sound/madplay</c>. You could also use something more well known 610like <c>media-sound/madplay</c>. You could also use something more well known
666</pre> 650</pre>
667 651
668</body> 652</body>
669</section> 653</section>
670<section> 654<section>
671<title> ALSA and USE</title> 655<title>ALSA and USE</title>
672<body> 656<body>
673 657
674<p> 658<p>
675You can now add the <c>alsa</c> use flag to <path>/etc/make.conf</path> to 659You 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 660ensure that your applications that support ALSA get built with it. Some
733 717
734Mixers: 718Mixers:
7350: SigmaTel STAC9721/23 7190: SigmaTel STAC9721/23
736</pre> 720</pre>
737 721
722<p>
723The other most common issue users face is the dreaded "Unknown symbol in module"
724error. An example of the same is shown below.
725</p>
726
727<pre caption="Unknown Symbol in module error">
728# <i>/etc/init.d/alsasound start</i>
729 * Loading ALSA modules ...
730 * Loading: snd-card-0 ... [ ok ]
731 * Loading: snd-pcm-oss ...
732WARNING: Error inserting snd_mixer_oss
733(/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown
734symbol in module, or unknown parameter (see dmesg) FATAL: Error inserting
735snd_pcm_oss
736(/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-pcm-oss.ko): Unknown
737symbol in module, or unknown parameter (see dmesg)
738 [ !! ]
739 * Loading: snd-mixer-oss ...
740FATAL: Error inserting snd_mixer_oss
741(/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown
742symbol in module, or unknown parameter (see dmesg)
743 [ !! ]
744 * Loading: snd-seq ... [ ok ]
745 * Loading: snd-emu10k1-synth ... [ ok ]
746 * Loading: snd-seq-midi ... [ ok ]
747 * Restoring Mixer Levels ... [ ok ]
748</pre>
749
750<p>
751And when you take a look at <c>dmesg</c> as suggested, you're quite likely to
752see:
753</p>
754
755<pre caption="dmesg output">
756<comment>(Only relevant portions are shown below)</comment>
757# <i>dmesg | less</i>
758ACPI: PCI Interrupt 0000:02:06.0[A] -> Link [APC3] -> GSI 18 (level, low) -> IRQ 209
759snd_mixer_oss: Unknown symbol snd_unregister_oss_device
760snd_mixer_oss: Unknown symbol snd_register_oss_device
761snd_mixer_oss: Unknown symbol snd_mixer_oss_notify_callback
762snd_mixer_oss: Unknown symbol snd_oss_info_register
763snd_pcm_oss: Unknown symbol snd_unregister_oss_device
764snd_pcm_oss: Unknown symbol snd_register_oss_device
765snd_pcm_oss: Unknown symbol snd_mixer_oss_ioctl_card
766snd_pcm_oss: Unknown symbol snd_oss_info_register
767snd_mixer_oss: Unknown symbol snd_unregister_oss_device
768snd_mixer_oss: Unknown symbol snd_register_oss_device
769snd_mixer_oss: Unknown symbol snd_mixer_oss_notify_callback
770snd_mixer_oss: Unknown symbol snd_oss_info_register
771</pre>
772
773<p>
774The above issue is caused when you switch from <c>alsa-driver</c> to in-kernel
775ALSA because when you unmerge <c>alsa-driver</c> the module files are config
776protected and hence get left behind. So, when you switch to in-kernel
777drivers, running <c>modprobe</c> gives you a mix of <c>alsa-driver</c> and
778in-kernel modules thus causing the above errors.
779</p>
780
781<p>
782The solution is quite easy. We just need to manually remove the problem causing
783directory after you unmerge <c>alsa-driver</c>. Be sure to remove the correct
784kernel version and not the current one!
785</p>
786
787<pre caption="Removing the alsa-driver modules">
788# <i>rm -rf /lib/modules/$(uname -r)/alsa-driver</i>
789</pre>
790
791<p>
792Another reason for error messages similar to the ones above could be a file in
793<path>/etc/modules.d</path> supplying a <c>device_mode</c> parameter when it
794isn't required. Confirm that this is indeed the issue and find out which file
795is the culprit.
796</p>
797
798<pre caption="Confirming and searching for device_mode">
799<comment>(Check dmesg to confirm)</comment>
800# <i>dmesg | grep device_mode</i>
801snd: Unknown parameter `device_mode'
802<comment>(Now, to get to the source of the issue)</comment>
803# <i>grep device_mode /etc/modules.d/*</i>
804</pre>
805
806<p>
807Usually it is a file called <path>alsa</path> with the line <c>options snd
808device_mode=0666</c>. Remove this line and restart the alsasound service and
809that should take care of this issue.
810</p>
811
738</body> 812</body>
739</section> 813</section>
740</chapter> 814</chapter>
741 815
742<chapter> 816<chapter>
777change the path to suit your machine. 851change the path to suit your machine.
778</note> 852</note>
779 853
780<pre caption="Loading Soundfonts"> 854<pre caption="Loading Soundfonts">
781<comment>(First, copy the Soundfont)</comment> 855<comment>(First, copy the Soundfont)</comment>
782# <i>cp /mnt/win2k/Program\ Files/CreativeSBLive2k/SFBank/8MBGMSFX.SF2 /usr/share/sounds/sf2/</i> 856# <i>cp /mnt/win2k/Program\ Files/CreativeSBLive2k/SFBank/8MBGMSFX.SF2 /usr/share/sounds/sf2/</i>
857<comment>(Or get it from your SoundBlaster CD)</comment>
858# <i>cp /mnt/cdrom/AUDIO/ENGLISH/SFBANK/8MBGMSFX.SF2 /usr/share/sounds/sf2/</i>
783<comment>(We load the specific Soundfont)</comment> 859<comment>(We load the specific Soundfont)</comment>
784# <i>asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2</i> 860# <i>asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2</i>
785</pre> 861</pre>
786 862
787<p> 863<p>

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

  ViewVC Help
Powered by ViewVC 1.1.20