| 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.57 2005/07/14 19:22:54 fox2mike Exp $ --> |
2 | <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/alsa-guide.xml,v 1.66 2006/05/01 05:52:31 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> |
| … | |
… | |
| 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.6</version> |
21 | <version>2.12</version> |
| 22 | <date>2005-07-14</date> |
22 | <date>2006-05-01</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> |
| 89 | We shall take a peek into both before finally deciding on one. |
89 | We shall take a peek into both before finally deciding on one. |
| 90 | </p> |
90 | </p> |
| 91 | |
91 | |
| 92 | <p> |
92 | <p> |
| 93 | If you were to use ALSA provided by the kernel, the following are the pros and |
93 | If you were to use ALSA provided by the kernel, the following are the pros and |
| … | |
… | |
| 231 | <p> |
231 | <p> |
| 232 | Let us now configure the kernel to enable ALSA. |
232 | Let us now configure the kernel to enable ALSA. |
| 233 | </p> |
233 | </p> |
| 234 | |
234 | |
| 235 | <impo> |
235 | <impo> |
| 236 | <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 |
| 237 | the instructions in <uri link="#doc_chap2_pre3">Kernel Options for ALSA</uri>. |
237 | then follow the instructions in <uri link="#doc_chap2_pre3">Kernel Options for |
|
|
238 | ALSA</uri>. |
| 238 | </impo> |
239 | </impo> |
| 239 | |
240 | |
| 240 | <pre caption="Heading over to the source"> |
241 | <pre caption="Heading over to the source"> |
| 241 | # <i>cd /usr/src/linux</i> |
242 | # <i>cd /usr/src/linux</i> |
| 242 | # <i>make menuconfig</i> |
243 | # <i>make menuconfig</i> |
| … | |
… | |
| 253 | </p> |
254 | </p> |
| 254 | |
255 | |
| 255 | <p> |
256 | <p> |
| 256 | Please note that for the sake of ease, all examples show ALSA built as modules. |
257 | Please note that for the sake of ease, all examples show ALSA built as modules. |
| 257 | It is advisable to follow the same as it then allows the use of <c>alsaconf</c> |
258 | It is advisable to follow the same as it then allows the use of <c>alsaconf</c> |
| 258 | which is a boon when you want to configure your card. Please do <e>not</e> skip the <uri |
259 | which is a boon when you want to configure your card. Please do <e>not</e> skip |
| 259 | link="#alsa-config">Configuration</uri> section of this document. If you still |
260 | the <uri link="#alsa-config">Configuration</uri> section of this document. If |
| 260 | like to have options built-in, ensure that you make changes to your config |
261 | you still like to have options built-in, ensure that you make changes to your |
| 261 | accordingly. |
262 | config accordingly. |
| 262 | </p> |
263 | </p> |
| 263 | |
264 | |
| 264 | <pre caption="Kernel Options for ALSA"> |
265 | <pre caption="Kernel Options for ALSA"> |
| 265 | Device Drivers ---> |
266 | Device Drivers ---> |
| 266 | Sound ---> |
267 | Sound ---> |
| … | |
… | |
| 308 | USB Devices ---> |
309 | USB Devices ---> |
| 309 | </pre> |
310 | </pre> |
| 310 | |
311 | |
| 311 | <p> |
312 | <p> |
| 312 | Now that your options are set, you can (re)compile the kernel and ALSA support |
313 | Now that your options are set, you can (re)compile the kernel and ALSA support |
| 313 | for your card should be functional once you reboot into the new kernel. |
314 | for your card should be functional once you reboot into the new kernel. Don't |
|
|
315 | forget to update your GRUB configuration to use the newly built kernel. |
| 314 | You can now proceed to <uri link="#alsa-utilities">ALSA Utilities</uri> and |
316 | You can now proceed to <uri link="#alsa-utilities">ALSA Utilities</uri> and |
| 315 | see if everything is working as it should. |
317 | see if everything is working as it should. |
| 316 | </p> |
318 | </p> |
| 317 | |
319 | |
| 318 | </body> |
320 | </body> |
| … | |
… | |
| 336 | </p> |
338 | </p> |
| 337 | |
339 | |
| 338 | <pre caption="Adding ALSA_CARDS to make.conf"> |
340 | <pre caption="Adding ALSA_CARDS to make.conf"> |
| 339 | <comment>(For one sound card)</comment> |
341 | <comment>(For one sound card)</comment> |
| 340 | ALSA_CARDS="emu10k1" |
342 | ALSA_CARDS="emu10k1" |
| 341 | <comment>(For more than one, seperate names with spaces)</comment> |
343 | <comment>(For more than one, separate names with spaces)</comment> |
| 342 | ALSA_CARDS="emu10k1 via82xx" |
344 | ALSA_CARDS="emu10k1 via82xx" |
| 343 | </pre> |
345 | </pre> |
| 344 | |
346 | |
| 345 | <p> |
347 | <p> |
| 346 | If you have compiled your kernel and want to use <c>alsa-driver</c>, please |
348 | If you have compiled your kernel and want to use <c>alsa-driver</c>, please |
| … | |
… | |
| 448 | your devices and try to find out your sound card. You will be asked to pick |
450 | your devices and try to find out your sound card. You will be asked to pick |
| 449 | your sound card from a list. Once that's done, it will ask you permission to |
451 | your sound card from a list. Once that's done, it will ask you permission to |
| 450 | automatically make required changes to <path>/etc/modules.d/alsa</path>. |
452 | automatically make required changes to <path>/etc/modules.d/alsa</path>. |
| 451 | It will then adjust your volume settings to optimum levels, run |
453 | It will then adjust your volume settings to optimum levels, run |
| 452 | <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. |
| 453 | Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA initscript. |
455 | Once <c>alsaconf</c> exits, you can proceed with setting up the ALSA |
|
|
456 | initscript. |
| 454 | </p> |
457 | </p> |
| 455 | |
458 | |
| 456 | </body> |
459 | </body> |
| 457 | </section> |
460 | </section> |
| 458 | <section id="initscript"> |
461 | <section id="initscript"> |
| … | |
… | |
| 487 | <p> |
490 | <p> |
| 488 | Before we move on to testing, there's one last <e>important</e> thing that needs |
491 | Before we move on to testing, there's one last <e>important</e> thing that needs |
| 489 | to be setup. Rule of thumb in a *nix OS : Do not run as root unless needed. |
492 | to be setup. Rule of thumb in a *nix OS : Do not run as root unless needed. |
| 490 | This applies here as well ;) How? Well, most of the times you should be logged |
493 | This applies here as well ;) How? Well, most of the times you should be logged |
| 491 | in as a user and would like to listen to music or access your soundcard. For |
494 | in as a user and would like to listen to music or access your soundcard. For |
| 492 | that to happen, you need to be in the "audio" group. At this point, we'll add |
495 | that to happen, you need to be in the "audio" group. At this point, we'll add |
| 493 | users to the audio group, so that they won't have any issues when they want to |
496 | users to the audio group, so that they won't have any issues when they want to |
| 494 | access sound devices. We'll use <c>gpasswd</c> here and you need to be logged in |
497 | access sound devices. We'll use <c>gpasswd</c> here and you need to be logged in |
| 495 | as root for this to work. |
498 | as root for this to work. |
| 496 | </p> |
499 | </p> |
| 497 | |
500 | |
| … | |
… | |
| 517 | <comment>(ALSA as modules)</comment> |
520 | <comment>(ALSA as modules)</comment> |
| 518 | # <i>/etc/init.d/alsasound start</i> |
521 | # <i>/etc/init.d/alsasound start</i> |
| 519 | * Loading ALSA modules ... |
522 | * Loading ALSA modules ... |
| 520 | * Loading: snd-card-0 ... [ ok ] |
523 | * Loading: snd-card-0 ... [ ok ] |
| 521 | * Loading: snd-pcm-oss ... [ ok ] |
524 | * Loading: snd-pcm-oss ... [ ok ] |
| 522 | * Loading: snd-seq ... [ ok ] |
525 | * Loading: snd-seq ... [ ok ] |
| 523 | * Loading: snd-emu10k1-synth ... [ ok ] |
526 | * Loading: snd-emu10k1-synth ... [ ok ] |
| 524 | * Loading: snd-seq-midi ... [ ok ] |
527 | * Loading: snd-seq-midi ... [ ok ] |
| 525 | * Restoring Mixer Levels ... [ ok ] |
528 | * Restoring Mixer Levels ... [ ok ] |
| 526 | <comment>(ALSA compiled in)</comment> |
529 | <comment>(ALSA compiled in)</comment> |
| 527 | # <i>/etc/init.d/alsasound start</i> |
530 | # <i>/etc/init.d/alsasound start</i> |
| 528 | * Loading ALSA modules ... |
531 | * Loading ALSA modules ... |
| 529 | * Restoring Mixer Levels ... [ ok ] |
532 | * Restoring Mixer Levels ... [ ok ] |
| … | |
… | |
| 541 | </pre> |
544 | </pre> |
| 542 | |
545 | |
| 543 | <impo> |
546 | <impo> |
| 544 | If you have issues starting up <c>alsamixer</c> and get errors such as |
547 | If you have issues starting up <c>alsamixer</c> and get errors such as |
| 545 | alsamixer: function snd_ctl_open failed for default: No such file or directory, |
548 | alsamixer: function snd_ctl_open failed for default: No such file or directory, |
| 546 | this is usually an issue with udev setting up the devices. Run <c>killall -9 |
549 | this is usually an issue with udev setting up the devices. Run <c>killall |
| 547 | udevd; udevstart</c> to reload /dev entries and fire up <c>alsamixer</c>. It |
550 | udevd; udevstart</c> to reload <path>/dev</path> entries and fire up |
| 548 | should solve the issue. |
551 | <c>alsamixer</c>. It should solve the issue. |
| 549 | </impo> |
552 | </impo> |
| 550 | |
553 | |
| 551 | <p> |
554 | <p> |
| 552 | This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay |
555 | This is how the ALSA Mixer <e>might</e> look the first time you open it. Pay |
| 553 | attention to the Master and PCM channels which both have an MM below them. |
556 | attention to the Master and PCM channels which both have an MM below them. |
| … | |
… | |
| 598 | </body> |
601 | </body> |
| 599 | </section> |
602 | </section> |
| 600 | <section> |
603 | <section> |
| 601 | <title>Sound Check!</title> |
604 | <title>Sound Check!</title> |
| 602 | <body> |
605 | <body> |
| 603 | |
|
|
| 604 | <p> |
|
|
| 605 | The irritating way to check your soundcard is to see if you can hear static on |
|
|
| 606 | the speakers. This isn't exactly fun, but hey, it tells you the card is |
|
|
| 607 | configured and working. |
|
|
| 608 | </p> |
|
|
| 609 | |
|
|
| 610 | <pre caption="Bring on th static"> |
|
|
| 611 | # <i>cat /dev/urandom > /dev/dsp</i> |
|
|
| 612 | </pre> |
|
|
| 613 | |
|
|
| 614 | <note> |
|
|
| 615 | <path>/dev/dsp</path> is a symlink to <path>/dev/sound/dsp</path> and should be |
|
|
| 616 | automatically created. Try re-directing the output to |
|
|
| 617 | <path>/dev/sound/dsp</path> in case you don't get a "No such file or directory" |
|
|
| 618 | error. |
|
|
| 619 | </note> |
|
|
| 620 | |
|
|
| 621 | <p> |
|
|
| 622 | You should hear static. Press <c>Ctrl + C</c> to stop. If you don't hear |
|
|
| 623 | anything, now is a good time to go back and check/trace out the issue and |
|
|
| 624 | rectify it. |
|
|
| 625 | </p> |
|
|
| 626 | |
606 | |
| 627 | <p> |
607 | <p> |
| 628 | Finally. Some music. If everything above is perfect, you should now be able to |
608 | Finally. Some music. If everything above is perfect, you should now be able to |
| 629 | listen to some good music. A quick way to test is to use a command line tool |
609 | listen to some good music. A quick way to test is to use a command line tool |
| 630 | like <c>media-sound/madplay</c>. You could also use something more well known |
610 | like <c>media-sound/madplay</c>. You could also use something more well known |
| … | |
… | |
| 670 | </pre> |
650 | </pre> |
| 671 | |
651 | |
| 672 | </body> |
652 | </body> |
| 673 | </section> |
653 | </section> |
| 674 | <section> |
654 | <section> |
| 675 | <title> ALSA and USE</title> |
655 | <title>ALSA and USE</title> |
| 676 | <body> |
656 | <body> |
| 677 | |
657 | |
| 678 | <p> |
658 | <p> |
| 679 | You can now add the <c>alsa</c> use flag to <path>/etc/make.conf</path> to |
659 | You can now add the <c>alsa</c> use flag to <path>/etc/make.conf</path> to |
| 680 | ensure that your applications that support ALSA get built with it. Some |
660 | ensure that your applications that support ALSA get built with it. Some |
| … | |
… | |
| 737 | |
717 | |
| 738 | Mixers: |
718 | Mixers: |
| 739 | 0: SigmaTel STAC9721/23 |
719 | 0: SigmaTel STAC9721/23 |
| 740 | </pre> |
720 | </pre> |
| 741 | |
721 | |
|
|
722 | <p> |
|
|
723 | The other most common issue users face is the dreaded "Unknown symbol in module" |
|
|
724 | error. 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 ... |
|
|
732 | WARNING: Error inserting snd_mixer_oss |
|
|
733 | (/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown |
|
|
734 | symbol in module, or unknown parameter (see dmesg) FATAL: Error inserting |
|
|
735 | snd_pcm_oss |
|
|
736 | (/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-pcm-oss.ko): Unknown |
|
|
737 | symbol in module, or unknown parameter (see dmesg) |
|
|
738 | [ !! ] |
|
|
739 | * Loading: snd-mixer-oss ... |
|
|
740 | FATAL: Error inserting snd_mixer_oss |
|
|
741 | (/lib/modules/2.6.12-gentoo-r6/kernel/sound/core/oss/snd-mixer-oss.ko): Unknown |
|
|
742 | symbol 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> |
|
|
751 | And when you take a look at <c>dmesg</c> as suggested, you're quite likely to |
|
|
752 | see: |
|
|
753 | </p> |
|
|
754 | |
|
|
755 | <pre caption="dmesg output"> |
|
|
756 | <comment>(Only relevant portions are shown below)</comment> |
|
|
757 | # <i>dmesg | less</i> |
|
|
758 | ACPI: PCI Interrupt 0000:02:06.0[A] -> Link [APC3] -> GSI 18 (level, low) -> IRQ 209 |
|
|
759 | snd_mixer_oss: Unknown symbol snd_unregister_oss_device |
|
|
760 | snd_mixer_oss: Unknown symbol snd_register_oss_device |
|
|
761 | snd_mixer_oss: Unknown symbol snd_mixer_oss_notify_callback |
|
|
762 | snd_mixer_oss: Unknown symbol snd_oss_info_register |
|
|
763 | snd_pcm_oss: Unknown symbol snd_unregister_oss_device |
|
|
764 | snd_pcm_oss: Unknown symbol snd_register_oss_device |
|
|
765 | snd_pcm_oss: Unknown symbol snd_mixer_oss_ioctl_card |
|
|
766 | snd_pcm_oss: Unknown symbol snd_oss_info_register |
|
|
767 | snd_mixer_oss: Unknown symbol snd_unregister_oss_device |
|
|
768 | snd_mixer_oss: Unknown symbol snd_register_oss_device |
|
|
769 | snd_mixer_oss: Unknown symbol snd_mixer_oss_notify_callback |
|
|
770 | snd_mixer_oss: Unknown symbol snd_oss_info_register |
|
|
771 | </pre> |
|
|
772 | |
|
|
773 | <p> |
|
|
774 | The above issue is caused when you switch from <c>alsa-driver</c> to in-kernel |
|
|
775 | ALSA because when you unmerge <c>alsa-driver</c> the module files are config |
|
|
776 | protected and hence get left behind. So, when you switch to in-kernel |
|
|
777 | drivers, running <c>modprobe</c> gives you a mix of <c>alsa-driver</c> and |
|
|
778 | in-kernel modules thus causing the above errors. |
|
|
779 | </p> |
|
|
780 | |
|
|
781 | <p> |
|
|
782 | The solution is quite easy. We just need to manually remove the problem causing |
|
|
783 | directory after you unmerge <c>alsa-driver</c>. Be sure to remove the correct |
|
|
784 | kernel version and not the current one! |
|
|
785 | </p> |
|
|
786 | |
|
|
787 | <pre caption="Removing the alsa-driver modules"> |
|
|
788 | <comment>(Replace KERNELVER with your kernel version)</comment> |
|
|
789 | # <i>rm -rf /lib/modules/KERNELVER/alsa-driver</i> |
|
|
790 | </pre> |
|
|
791 | |
|
|
792 | <p> |
|
|
793 | Another reason for error messages similar to the ones above could be a file in |
|
|
794 | <path>/etc/modules.d</path> supplying a <c>device_node</c> parameter when it |
|
|
795 | isn't required. Confirm that this is indeed the issue and find out which file |
|
|
796 | is the culprit. |
|
|
797 | </p> |
|
|
798 | |
|
|
799 | <pre caption="Confirming and searching for device_node"> |
|
|
800 | <comment>(Check dmesg to confirm)</comment> |
|
|
801 | # <i>dmesg | grep device_mode</i> |
|
|
802 | snd: Unknown parameter `device_mode' |
|
|
803 | <comment>(Now, to get to the source of the issue)</comment> |
|
|
804 | # <i>grep device_mode /etc/modules.d/*</i> |
|
|
805 | </pre> |
|
|
806 | |
|
|
807 | <p> |
|
|
808 | Usually it is a file called <path>alsa</path> with the line <c>options snd |
|
|
809 | device_mode=0666</c>. Remove this line and restart the alsasound service and |
|
|
810 | that should take care of this issue. |
|
|
811 | </p> |
|
|
812 | |
| 742 | </body> |
813 | </body> |
| 743 | </section> |
814 | </section> |
| 744 | </chapter> |
815 | </chapter> |
| 745 | |
816 | |
| 746 | <chapter> |
817 | <chapter> |
| … | |
… | |
| 781 | change the path to suit your machine. |
852 | change the path to suit your machine. |
| 782 | </note> |
853 | </note> |
| 783 | |
854 | |
| 784 | <pre caption="Loading Soundfonts"> |
855 | <pre caption="Loading Soundfonts"> |
| 785 | <comment>(First, copy the Soundfont)</comment> |
856 | <comment>(First, copy the Soundfont)</comment> |
| 786 | # <i>cp /mnt/win2k/Program\ Files/CreativeSBLive2k/SFBank/8MBGMSFX.SF2 /usr/share/sounds/sf2/</i> |
857 | # <i>cp /mnt/win2k/Program\ Files/CreativeSBLive2k/SFBank/8MBGMSFX.SF2 /usr/share/sounds/sf2/</i> |
|
|
858 | <comment>(Or get it from your SoundBlaster CD)</comment> |
|
|
859 | # <i>cp /mnt/cdrom/AUDIO/ENGLISH/SFBANK/8MBGMSFX.SF2 /usr/share/sounds/sf2/</i> |
| 787 | <comment>(We load the specific Soundfont)</comment> |
860 | <comment>(We load the specific Soundfont)</comment> |
| 788 | # <i>asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2</i> |
861 | # <i>asfxload /usr/share/sounds/sf2/8MBGMSFX.SF2</i> |
| 789 | </pre> |
862 | </pre> |
| 790 | |
863 | |
| 791 | <p> |
864 | <p> |