ALSA Wiki FAQ
Last Modified: 12th July 2004 - 3:04 PM
License: http://www.gnu.org/licenses/fdl.txt

[Wiki]  This is an unofficial Wiki-based ALSA FAQ that can be freely edited or added to by anyone. If you have some time to spare, please also take a look at those questions that have not been answered yet and answer them if you know the solution..
  • The static single page: http://alsa.opensrc.org/faq
  • The dynamic Wiki page: http://alsa.opensrc.org/?FAQ
  • The discussion page: http://alsa.opensrc.org/?ThisWiki
  • Update static page link: http://alsa.opensrc.org/faq/mkfaq.php
  • Mailing List: alsa | alsa-subscribe | alsa-unsubscribe at opensrc dot org
    Answer : How can I see which audio [pcm], midi [seq] and mixer [ctl] devices my ALSA installation sees?

    Answer : Can I use my old OSS apps with ALSA?

    Answer : Nothing works at all. I tried everything!

    Answer : My ALSA modules seem to be loaded fine but I hear no sound. Why is that?

    Answer : Loading my driver module fails with "no such device" [or something similar]

    Answer : Loading my driver module fails with "unresolved symbols"

    Answer : How can I check whether ALSA works?

    Answer : How can I see if a channel is muted in alsamixer ?

    Answer : How can I enable "digital out" on my soundcard?

    Answer : Can I have OSS and ALSA modules loaded at the same time?

    Answer : How can I find out whether I have OSS emulation modules loaded?

    Answer : Where are the ALSA drivers installed?

    Answer : How can I connect ALSA MIDI-applications?

    Answer : Where can I talk to real people about ALSA if I have questions not answered in the FAQ or other ALSA-documentation?

    Answer : MIDI timing is very unstable. How can I improve that?

    Answer : My sound crackles when the system is under load. How can I improve that?

    Answer : My usb-audio device has problems when using sample rates above 22 kHz. Why's that?

    Answer : Can I use several applications at once? The second program I try to run seems to block until the first one releases the device.

    Answer : Is there an official FAQ?

    Answer : "aplay -D rear " fails with "Invalid type for PCM rear definition" What does this error mean? How do you fix it?

    Answer : Every time I boot my computer all volumes are at zero and all channels are muted

    Answer : What are the relationships among devices, subdevices, PCM definitions, channels, and speakers? Does a PCM correspond to a device or a subdevice? To a channel?

    Answer : When I try to play Enemy Territory or other games based on the Quake 3 engine, I get an "/dev/dsp: Input/output error Could not mmap /dev/dsp" message

    Answer : How can I update the ALSA version when running a 2.6.x kernel?

    Answer : ALSA utilities don't work unless I'm root on my Linux system. What's up with that?

    Answer : How can I change the default ALSA device?

    Answer : What's all this dmix/dsnoop/asym stuff? How does it work?

    Answer : Can I play stereo files over all speakers of my 4.0, 5.1 or 7.1 surround-sound setup?

    Answer : How can I find out whether I have the OSS sound driver modules loaded?

    Answer : I am seeing (and hearing) xruns whenever the hard disk is accessed

    Answer : What is a "mixer"?

    Answer : I get "no such file or directory" errors from all alsa-utils . What's wrong?

    Answer : Are there any VU meters available for ALSA?

    Answer : Is there a way to get mplayer working with ALSA plug:dmix ?

    Answer : Can I use multiple soundcards with JACK / in sync

    Answer : Which is the relationship between ALSA and sound daemons, like ARTS or Esound? May be possible in the future to replace ARTS and Esound by ALSA, so every program doesn't have to support different sound servers?

    Answer : When I try to play files with my card the sound randomly crashes after a while. Why is that? (This question is too vague, "sound randomly crashes" does not describe the problem well enough)

    [TOP]  [Wiki]  How can I see which audio [pcm], midi [seq] and mixer [ctl] devices my ALSA installation sees?

    Use the information provided by ALSA's /proc interface. Use...
        cat /proc/asound/cards
    
    to see which cards are seen by your ALSA installation. Use...
        cat /proc/asound/devices
    
    to see which devices these cards have. If you get errors like "No such file or directory" on the above commands, then your ALSA modules are probably not yet loaded. Try browsing in /proc to see which other info your kernel provides. Also check Takashi's explanation of /proc in the AlsaTips section.

    In future /proc will be used for process information only, and the place to look for ALSA info will be sysfs. In the 2.6 kernel source, there's a file called
        Documentation/filesystems/sysfs.txt
    
    with some info about this. You can also use the aadebug script to provide a brief snapshot of your system suitable for emailing to someone else for help.

    [TOP]  [Wiki]  Can I use my old OSS apps with ALSA?

    Most of the OSS apps work very well with ALSA's kernel-level OSSEmulation [to use this you need to load three ALSA modules snd-pcm-oss , snd-seq-oss and snd-mixer-oss ].

    However, the OSS sequencer module snd-seq-oss which emulates /dev/sequencer only half works with OSS MIDI sequencers. Recording from MIDI keyboards does not work; it produces MIDI files with corrupted time-values for note-on and note-off events. This is a known bug (''see alsa-devel [http://bugtrack.alsa-project.org/alsa-bug/bug_view_advanced_page.php?bug_id=28 2004/02/02] 2002/8/26 and 2003/12/7'). Playback to MIDI keyboards works ok.

    Optionally you can use the aoss script from the alsa-oss package. It has the advantage of being able to use the PCM plugin layer of ALSA. This enables you to use software-mixing for both capture and playback. For more info, see the pages about DmixPlugin , OssEmulation and AlsaTips .

    Sometimes problems arise when an app uses mmap'd mode. Check the OssEmulation page for more details and also look at Answer .

    [TOP]  [Wiki]  Nothing works at all. I tried everything!

    Try upgrading your ALSA-drivers and/or your kernel. ;)

    [TOP]  [Wiki]  My ALSA modules seem to be loaded fine but I hear no sound. Why's that?

    Play around with alsamixer . The relevant audio channels are probably just muted and/or set to zero or a very quiet volume-level.

    There is also another possibility. Maybe you have many devices that appear as soundcards. One of them may be a modem. Apparently, it can play stuff, but you probably won't hear anything and you certainly don't want to use a modem as the default soundcard. You can see whether this is your problem by examining /proc/asound/cards. See Answer about how to change your default soundcard.

    [TOP]  [Wiki]  Loading my driver module fails with "no such device" [or something similar]

    This can have several reasons:

    1] It is the wrong driver [check the SoundCard matrix from the http://alsa-project.org website to see if you use the correct driver. Also check the AlsaDrivers page of this wiki.

    2] You have specified some incorrect module options. Some soundcards [especiall ISA cards] need to have their DMA, io and irq specified. Check your hardware documentation for the corresponding [jumper] settings.

    3] The driver is already loaded in the kernel. Check this with the help of the command

    lsmod

    Attempting to load a driver twice will fail, since the hardware is already occupied by the first driver module. It is possible to load multiple driver modules if you have more than one card of the same type installed.

    4] You have OSS modules loaded in the kernel. Remove them. See the corresponding FAQ entry

    5] You have OSS support for your soundcard compiled statically into the kernel. In this case you must recompile your kernel without OSS support. If you want to have OSS available, compile it as modules.



    [TOP]  [Wiki]  Loading my driver module fails with "unresolved symbols"

    If you are building your own ALSA modules from source code and seeing unresolved symbol errors, this could be caused by having old modules in your source tree. See the page " Unresolved Symbols " on this wiki for a fix.



    [TOP]  [Wiki]  How can I check whether ALSA is working?

    First of all, have a look at the output of lsmod. It should show quite a few modules starting with "snd-" or "snd_". This is, of course, only the case if the ALSA modules are not built into the kernel.

    The single most important module to be loaded is the driver module for your card. In my case it is the terratec dmx xfire 1024 module [snd-cs46xx]:

        tapas@mango :~$ lsmod |grep snd-cs46xx                
       snd-cs46xx             72808   3
       snd-ac97-codec         49532   0 [snd-cs46xx]
       snd-pcm                67168   1 [snd-pcm-oss snd-cs46xx]
       snd-page-alloc          7028   0 [snd-cs46xx snd-pcm]
       snd-rawmidi            15456   0 [snd-cs46xx]
       snd                    35460   2 [snd-pcm-oss 
     snd-mixer-oss snd-cs46xx snd-ac97-codec snd-pcm snd-rawmidi 
     snd-seq-dummy snd-seq snd-timer snd-seq-device]
    
    (the above "snd" line is artifically wrapped, remove the chars and put the snd-
  • items all on one line)

    The above command also show which modules snd-cs46xx depends upon. There's quite a few low-level alsa modules, which provide alsas basic infrastructure.

    Next thing is to use
       cat /proc/asound/version
    
    This should show you the installed ALSA version. If you get an error, chances are that ALSA is not loaded.

    If you get an output like:
        tapas@mango :~$ cat /proc/asound/version 
       Advanced Linux Sound Architecture Driver Version 1.0.2a.
       Compiled on Feb  3 2004 for kernel 2.4.22 (SMP) with versioned symbols.
    
    you know that at least the basic ALSA infrastructure is loaded. Next try:
       cat /proc/asound/cards
    
    It should show something like this:
        tapas@mango :~$ cat /proc/asound/cards   
       0 [CS46xx         ]: CS46xx - Sound Fusion CS46xx
                            Sound Fusion CS46xx at 0xcffef000/0xcfe00000, irq 5
    
    Of course with your card info. Lastly check /proc/asound/devices for a list of the supported hardware devices on your card[s].

    Use the aplay program to test the devices. You need to have a .wav file ready to send to the soundcard. If you don't have a .wav file available you can use mpg123 to convert a .mp3 file to a .wav file; for example, you could use mpg123 -w file.wav file.mp3.
       aplay file_name.wav
    
    should play the file via the default pcm-device . If you hear nothing but also do not get an error message, chances are that your sound is just muted. Make sure that "Master" is unmuted using "alsamixer" (use arrow keys and "m") or "alsamixergui" (click on top of the bar). If you get an error message about "permission denied" or similar, then the permissions of the alsa device files are not setup correctly (see ls -l /dev/snd/*). If you get an error message about mismatching sample rates, period sizes, etc, then the wav file you tried to play does not "fit" the PCM device. You can specify a different PCM device via the -D switch. This can be useful to test rear/front outputs or digital outputs:
       aplay -Dfront file_name.wav 
    

    aplay -Drear file_name.wav

    aplay -Dsurround51 file_name.wav
    are some examples. Use aplay -L to list all available PCM devices.

    You can also try the Speaker-Test program to test different setups.

    [TOP]  [Wiki]  How can I see whether a channel is muted in alsamixer ?

    Check for a little "MM" at the top of alsamixer's display. "MM" means the left+right stereo channels are muted. You can toggle muting on or off by pressing the "m" key.

    [TOP]  [Wiki]  How can I enable digital-out on my soundcard?

    This is card-specific and is usually toggled by some IEC switch in alsamixer . Check the documentation for your driver module and also the corresponding wiki page in the AlsaDrivers section for more info.

    [TOP]  [Wiki]  Can I have OSS and ALSA modules loaded at the same time?

    It depends on whether you mean "OSS modules" to refer to OSS sound driver modules, which are from the old sound driver included in 2.4.x and earlier Linux kernels, or to OSS emulation modules, which are provided in the newer ALSA sound system as a compatible replacement for the old OSS sound driver.

    OSS sound driver modules You can use either 1) modules from the ALSA sound driver or 2) modules from the OSS sound driver, but not both 1) and 2) at the same time. The only sound module that is allowed in the kernel at the same time as the ALSA modules is the "soundcore" module.

    OSS emulation modules Since one of the aims of ALSA is to provide full OSS compatibility for OSS applications, there are OssEmulation modules available in ALSA (if you enable them) which emulate the old OSS sound driver. It is perfectly ok to have any of the three OSS emulation modules snd-pcm-oss and snd-mixer-oss and snd-seq-oss loaded at the same time as the ALSA driver modules because they are actually part of ALSA. They are harmless and do not interfere with the rest of ALSA. If you need ALSA's OSS emulation, load ALSA's OSS emulation modules; if you don't, leave them alone.

    Recommended option: load ALSA's OSS emulation modules to emulate the OSS sound driver, and do not use the OSS sound driver modules.

    How to tell ALSA modules from OSS driver modules All ALSA modules start with a prefix "snd-" or "snd_". Therefore if you own an emu10k1 based cards and you see "emu10k1" in the output of lsmod [not "snd-emu10k1", then you have the OSS driver module loaded.. Which is, of course, bad if you want to run ALSA [s.a].

    [TOP]  [Wiki]  How can I find out whether I have OSS emulation modules loaded?

    To find out whether ALSA's OSS emulation modules are loaded, use these commands (please use cut-and-paste!):

    :lsmod | awk '$1~/oss/ || NR==1'

    :If ALSA's OSS emulation modules are loaded, you should see output similar to the following:

             Module                  Size  Used by    Not tainted
             snd-seq-oss            24930   0 (autoclean) (unused)
             snd-mixer-oss          11094   1 (autoclean) [snd-pcm-oss]
             snd-pcm-oss            38862   0 (autoclean) (unused)
    


    :If no OSS emulation modules are loaded, you should see just:

             Module                  Size  Used by    Not tainted
    
    :in which case you may want to load the OSS emulation modules by using the commands:
             echo snd-seq-oss snd-pcm-oss snd-mixer-oss | xargs -n 1 modprobe
    


    :If that doesn't work, it means you probably do not have OSS emulation enabled in ALSA and will have to recomplile ALSA with the OSS emulation option for the configure script enabled.

    ALSA's OSS emulation modules are for OSSemulation and provide the OSS device s. They are harmless and do not interfere with the normal operation of ALSA. If you need OSS emulation, load the OSS emulation modules; if you don't, leave them alone.

    Don't confuse the ALSA " OSS emulation modules" with the non-ALSA " OSS sound driver modules". See Answer for a full explanation of these modules and Answer for the answer to "How can I find out whether I have OSS sound driver modules loaded?".

    [TOP]  [Wiki]  Where are the ALSA drivers installed?

    They should be in a subdirectory of your kernel modules directory. On my system that's:
       /lib/modules/2.4.22/kernel/sound
    
    It might be different for 2.6 kernels. ALSA modules all start with a "snd-" or "snd_" prefix.

    [TOP]  [Wiki]  How can I connect ALSA MIDI-applications?

    Use the program aconnect from the alsa-utils package. You can also install one of several graphical alsa-midi patchbay apps [for example: alsa-patch-bay ]

    [TOP]  [Wiki]  Where can I talk to real people about ALSA if I have questions not answered in the FAQ or other ALSA-documentation?

    First of all, check the #alsa channel on irc.freenode.org. Then check the alsa-user and alsa-dev mailing lists [see the ALSA project webpage http://www.alsa-project.org/ for subscription info]

    [TOP]  [Wiki]  My sound crackles when the system is under load. How can I improve that?

    There might be a multitude of reasons for this behaviour: PCI/ISA interrupt issues, buggy drivers, etc. As a first step you should try updating ALSA, then play around with different slots for the soundcard. Also, in the case of xruns , maybe a kernel with LowLatency /Preemptible patches might help.



    [TOP]  [Wiki]  My usb-audio device has problems when using sample rates above 22kHz. Why's that?

    I am not sure whether it is because of Linux-usb, Alsa or because of the Creative USB Sound Blaster Audigy 2 NX itself, but when you play sounds using a 44.1kHz sample-rate the sound is always crackled. One possible workaround is to force all sounds to play at a 48kHz sample-rate. An example of a .asoundrc file which does this is: (thx to Florian Schmidt [tapas] for the idea to do so)

    pcm.fixed {
       type plug slave {
            pcm "hw:1,0"
            rate 48000
       }
    }
    
    Be sure to choose the correct card: hw:1,0 is the 2nd soundcard (soundcards numbering starts from 0), while hw:0,0 would be the first soundcard.

    More information about the Creative USB Sound Blaster Audigy 2 NX under linux can be found on my homepage: http://nix.bockb.de I'll post more information as soon as I get to know more about this issue. (page created: 2004-03-25 19:50 CET by Benjamin Bock [bnjmnbck])

    [TOP]  [Wiki]  Can I use several applications at once? The second program I try to run seems to block until the first one releases the device.

    The reason for this is that your soundcard and/or your soundcard driver do not support hardware mixing of multiple streams.

    Check the DmixPlugin page and the .asoundrc page for possible remedies. Also see Hardware mixing, software mixing for an overview of the problem.

    [TOP]  [Wiki]  Is there an official FAQ?

    Yes, follow this link [the ALSA HOWTO/FAQ docs]:

    http://www.alsa-project.org/alsa-doc/alsa-howto

    direct link to the FAQ:

    http://www.alsa-project.org/alsa-doc/alsa-howto/c2039.htm

    [TOP]  [Wiki]  "aplay -D rear " fails with "Invalid type for PCM rear definition" What does this error mean? How can you fix it?

    Takashi answered:

    It means that the alsa-lib doesn't support the rear output of your soundcard yet. Usually it's defined in /usr/share/alsa/cards/*.conf.

    ... ok, a bit more explanation for the common cases. This error can appear also when you try "rear" output with the AC97 chip supporting 5.1 output. This is because the AC97 doesn't support the independent rear output. That is, you cannot access only the rear speakers. The rear output is always together with the front (4.0) or the front/center/LFE (5.1). Ditto for "center_lfe" output.

    BTW, the individual output is possible by setting up all 5.1 channels and splitting them via dshare plugin, An adventurous user can try that :)

    [TOP]  [Wiki]  Every time I boot my computer all volumes are at zero and all channels are muted

    Have a look at the alsactl page. Basically the problem is this: every time an ALSA driver is loaded all channels are muted and pulled down to zero by default for safety reasons. If the mixer was left in an undefined state there could be unexpected feedback problems, or worse, damage to your speakers and eardrums. What is the solution then?

    ALSA provides a program called alsactl to restore driver and mixer settings. However, you normally don't have to deal with alsactl yourself. ALSA provides a script which can be called at startup and shutdown to do all this for you.

    So check if this script is installed properly:

    1. Check if the file /etc/init.d/alsasound exists. This should be there even when installing from source and especially when installing from a precompiled package, so if it does not you might have not installed ALSA properly.

    2. Check if the following files exists and are symlinks to /etc/init.d/alsasound:

    /etc/rc0.d/K15alsasound /etc/rc1.d/K15alsasound /etc/rc6.d/K15alsasound /etc/rcS.d/S59alsasound

    3. If these files exist and it still doesn't work, reboot your machine and watch the boot messages carefully. If you see a line like this:
    ALSA driver is already running.
    


    In this case, check you're boot messages again. Some other boot-up script is pre-loading the ALSA drivers and thusly preventing the alsasound script to load the drivers and the mixer settings. A script known to do this is the hotplug startup script.

    There's several ways to fix this. The easiest is to write a script with one line:
    alsactl restore
    
    and to save it as 'alsasoundrestoremixer' in /etc/init.d/. Create a symlink to run this straight after alsasound:
    % ln -s /etc/init.d/alsasoundrestoremixer /etc/rcS.d/S59alsasoundrestoremixer
    
    This forces the loading of the mixer settings every time the system is booted.

    It still doesn't work!

    Before you consult the mailing list, try this:

  • Set your mixer
  • Run 'alsactl store' (This command should save the mixer settings to /etc/asound.state).
  • Change the mixer settings
  • Run 'alsactl restore'

    Did this work? If yes, then I suggest starting again at the top. If this didn't work, check if ALSA is installed properly.



    [TOP]  [Wiki]  What are the relationships among devices, subdevices, PCM definitions, channels, and speakers? Does a PCM correspond to a device or a subdevice? To a channel?

    I'll try to answer this question as well as I can. Please correct me.

    First take a look at the contents of the file

    /proc/asound/devices}

    On my system it looks like this:
        0: [0- 0]: ctl
        8: [0- 0]: raw midi
       18: [0- 2]: digital audio playback
       17: [0- 1]: digital audio playback
       16: [0- 0]: digital audio playback
       24: [0- 0]: digital audio capture
        1:       : sequencer
       33:       : timer
       32: [1- 0]: ctl
       43: [1- 3]: raw midi
       42: [1- 2]: raw midi
       41: [1- 1]: raw midi
       40: [1- 0]: raw midi
    
    This is the list of devices known on the lowest level, the kernel level. I have got one soundcard cs46xx and the virtual MIDI soundcard virmidi loaded. If you look at the first number in the "[ ]" in the above listing you will see that there are devices [0- x] and [1- x]. The 0 and 1 correspond to the card which contains this device. Here's the contents of /proc/asound/cards

       0 [CS46xx         ]: CS46xx - Sound Fusion CS46xx
                            Sound Fusion CS46xx at 0xcffef000/0xcfe00000, irq 5
       1 [VirMIDI        ]: VirMIDI - VirMIDI
                            Virtual MIDI Card 1
    
    So we have card 0 and card 1 and each contains some devices as can be seen from the above contents of /proc/asound/devices.

    There are different types of devices [digital audio devicess, ctl-device s, midi-devices]. For now, we are only interested in the digital audio devices.

    It's important to know that applications that use ALSA to play sound usually do not use the kernel modules directly. They rather access the alsa-lib to open PCM-device s. These PCM devices can be either aliases for real hardware devices (digital audio playback and capture devices) on the soundcard or they can be "virtual" devices defined in the plugin layer of alsa-lib .

    The user can use a config file .asoundrc to define new PCM devices and to use some of the plugins provided by alsa-lib to configure them. See the DmixPlugin and LADSPA plugins pages for some uses of this. A typical ALSA-installation has many predefined PCM names like "front", "rear", 'surround", etc.. These are mostly aliases for some of the hardware devices on the soundcard. You can also access the hardware devices through alsa-lib via special names. For example "hw:0,0" means: the first digital audio device on the first soundcard. "plughw:1,2" means the third device on the second soundcard but the sample stream is converted to the hardware's native format by alsa-lib first [the "plug" prefix]..

    PCM devices can have any number of channels. If it's a hardware PCM device then the channel count is determined by the hardware. Depending on the plugin type (see .asoundrc a PCM device can have any number of channels. It is for example possible to combine several hardware PCM devices into one virtual PCM device with the help of the multi plugin.

    I don't know what subdevices are. Please fill this in.

    So as you can see from above, a certain PCM can map to many different hardware devices depending on how it is setup.

    There's not necessarily a correspondance between audio playback and capture devices and the jacks of the soundcard. Depending on the soundcard and how it is setup via alsamixer , the capture device can capture different things: line-in, microphone, the output of the soundcard, etc.

    The same is true for the playback devices. Depending on your hardware setup, the playback devices can produce output on different jacks of your soundcard. This is especially true with professional-grade multitrack cards that allow sophisticated routing. On consumer grade cards, the ctl device usually only controls whether to send the audio via the digital out or analog, etc.

    [TOP]  [Wiki]  When I try to play Enemy Territory or other games based on the Quake 3 engine, I get an "/dev/dsp: Input/output error Could not mmap /dev/dsp" message

    Read the OssEmulation documentation about setting the parameters for OSS via the /proc interface.

    For some people trying to play ET, the following works:

         echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss
    
    You will generally need to add write permissions even for the root user in order to echo anything to /proc/asound/card0/pcm0p/oss. Also remember your new settings will not be preserved following a reboot.

    ::which changes the playback part of OSS (indicated by the "p" in "pcm0p").

    You may also need to try this:
         echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss 
    
    ::which disables capture (meaning microphone input? PCM input?):

    This is not enough for some driver modules such as cs46xx for which you need to enable mmap explicitly via a module option. See the relevant AlsaDrivers pages for more info on your driver modules.

    [TOP]  [Wiki]  How do I update the ALSA version when running a Linux 2.6.x kernel?

    If there's a newer kernel version available, it's likely the included ALSA drivers have been updated too. You may find it easier just to download the newer kernel rather than trying to update the ALSA parts inside your existing kernel source code.

    If you want to update the ALSA version included with your current kernel, check the AlsaBuild2.6 page.



    [TOP]  [Wiki]  ALSA utilities don't work unless I'm root on my Linux system. Why is that?

    Your files probably have incorrect permissions. The device files in /dev/snd need to be user-readable and user-writable (the tool alsactl is only meant to be run by root though).

    Here's the output of ls /dev/snd -l on my system:

     tapas@mango :~$ ls /dev/snd/ -l
    total 0
    crw-rw
    1 root audio 116, 0 Nov 17 04:32 controlC0 crw-rw
    1 root audio 116, 32 Nov 17 04:32 controlC1 crw-rw
    1 root audio 116, 64 Nov 17 04:32 controlC2 crw-rw
    1 root audio 116, 96 Nov 17 04:32 controlC3 crw-rw
    1 root audio 116, 4 Nov 17 04:32 hwC0D0 crw-rw
    1 root audio 116, 5 Nov 17 04:32 hwC0D1 crw-rw
    1 root audio 116, 6 Nov 17 04:32 hwC0D2 ... etc ...


    In this setup, I, as the user belong to the group audio and therefore have read-write access (shown by rw above) to the ALSA device files. You can use the command groups to see which groups you belong to:

        tapas@mango :~$ groups 
       tapas cdrom audio wheel priv
    


    Read this page for general linux/unix help:

    http://www.tldp.org/

    and especially: http://www.tldp.org/LDP/intro-linux/html/chap_03.html

    Look for unix/linux introductory guides to know more about filesystems and how to set change permissions. If this is too much for you and you just want a quick hack which disregards all security concerns, you can just do [as root]:
       chmod a+rw /dev/snd/




  • [TOP]  [Wiki]  How can I change the default ALSA device?

    Ok, if you want to change the default device on your soundcard, you need to edit your ~/.asoundrc file and put something like this into it:

    pcm.!default {
      type hw
      card 0
      device 2
    }
    


    This selects hw:0,2 as the default device. If you want to do sample-rate conversion, etc, using the plug plugin, you can try this:

    pcm.!default {
      type plug {
        slave.pcm "hw,0,2"
      }
    }
    



    - If you need to change the default soundcard you need to edit one of the ALSA configuration files:

    :/etc/asound.conf for system-wide options that affect all users :~/.asoundrc for options that affect only your own user account

    To one of these files (probably /etc/asound.conf) add something similar to the following:
       pcm.!default {
           type hw
           card 2
       }
    

    ctl.!default { type hw card 2 }
    You can find out which number you need to put in the card line by looking at /proc/asound/cards. If this file doesn't exist or the contents are empty, it means ALSA is not working properly on your computer. Let's assume ALSA is working ok. For example:
       $ cat /proc/asound/cards
    

    0 [Dummy ]: Dummy - Dummy Dummy 1

    1 [VirMIDI ]: VirMIDI - VirMIDI Virtual MIDI Card 1

    2 [AudioPCI ]: ENS1371 - Ensoniq AudioPCI Ensoniq AudioPCI ENS1371 at 0xe400, irq 11
    In this example we can see that soundcard number 0 "Dummy" is a dummy soundcard (useful for certain types of testing), soundcard number 1 "VirMIDI" is a virtual soundcard (useful for testing MIDI programs), and last but most importantly, soundcard number 2 "AudioPCI" is the real soundcard. Question: How can you tell which soundcard is a real soundcard? Answer: real soundcards always have an irq. In this example, only soundcard 2 AudioPCI has an irq, so it must be the real soundcard.
    - So the general case is:

    pcm.!default {
      type hw
      card X
      device Y
    }
    


    Also if you ever want to change your default soundcard, you should change the ctl.!default device to that card:

    ctl.!default {
      type hw
      card X
    }
    



    You can also make the default device use any other defined pcm device:

    pcm.foo {
       type dmix
       slave.pcm "hw:0,0"
    }
    

    pcm.!default { type plug slave.pcm "foo" }


    In this example the slave definition references the "foo" pcm device defined above..



    [TOP]  [Wiki]  What's all this dmix/dsnoop/asym stuff? How does it work?

    Well-programmed ALSA apps don't talk to the ALSA kernel modules directly. They leave this job to the ALSA library alsa-lib which is designed to do the high-level stuff. Therefore apps talk to alsa-lib instead of the kernel modules.

    alsa-lib now has the ability to offer more devices to the application than just the hardware devices. These additional devices can be defined in one of the config files (see the .asoundrc file for per-user settings -- there are also other config files for system-wide settings which affect all users).

    alsa-lib also has a list of "plugins" that can be used in the same way. So, for example it is possible to define a PCM called "foo" which uses the DmixPlugin to create a device that is capable of mixing several audio streams in realtime, in software.

    So see the .asoundrc page for more info. Also check the alsa-lib page. Look at asym , too, and at Hardware mixing, Software mixing

    [TOP]  [Wiki]  Can I play stereo files over all speakers of my 4.0, 5.1 or 7.1 surround-sound setup?

    Yes, you need to edit your .asoundrc file for this to work. I quote Takashi's email from the alsa-user mailing list:

    At Wed, 28 Jan 2004 18:05:46 +0100, Florian Schmidt wrote:
    > 
    > Hi, as far as i understand it, the copy plugin does nothing but copy its
    > input to its output. I wonder if it would be easily possible to extend
    > this plugin to copy to multiple slave PCMs. This way it would be
    > (easily?) possible to "distribute" a stereo signal to 4 or even 6
    > channels.
    


    The route and plug plugins already can do that. For example,
       pcm.ch40dup {
    	type route
    	slave.pcm surround40
    	slave.channels 4
    	ttable.0.0 1
    	ttable.1.1 1
    	ttable.0.2 1
    	ttable.1.3 1
       }
    

    pcm.ch51dup { type route slave.pcm surround51 slave.channels 6 ttable.0.0 1 ttable.1.1 1 ttable.0.2 1 ttable.1.3 1 ttable.0.4 0.5 ttable.1.4 0.5 ttable.0.5 0.5 ttable.1.5 0.5 }


    and you can play two channel WAV using

    	% aplay -Dch40dup 2ch-stereo.wav
    

    % aplay -Dch51dup 2ch-stereo.wav
    for 4.0 and 5.1 surrounds, respectively. Of course, this is just a copy of the left/right samples and no Dolby Prologic effect is included ;)

    Takashi

    One email later:
    At Wed, 28 Jan 2004 18:37:32 +0100,
    I wrote:
    > 
    > At Wed, 28 Jan 2004 18:05:46 +0100,
    > Florian Schmidt wrote:
    > > 
    > > 
    > > Hi, as far as i understand it, the copy plugin does nothing but copy its
    > > input to its output. I wonder if it would be easily possible to extend
    > > this plugin to copy to multiple slave pcms. This way it would be
    > > (easily?) possible to "distribute" a stereo signal to 4 or even 6
    > > channels.
    > 
    > route (and plug) plugin already can do that.
    > for example,
    
    ah, in your question, multiple slave PCMs are assumed. In such a case, combine the multiple PCMs via the multi plugin at first, then use the route plugin over it.

    Takashi

    See .asoundrc and alsa-lib




    To use the ch40dup or ch51dup devices with XMMS go to Preferences (Ctrl+P), choose the ALSA output plugin in the Output Plugin box, choose Configure and fill in the device of your choice at Audio device (it won't be in the list).

    [TOP]  [Wiki]  How do i find out if i got OSS modules loaded?


    Doesn't Answer already deal with the same question?

    no, OSS emu and OSS are different things. BTW: thanks for all the edits you made. I'm the dsl.something.arcor-ip.net guy.. Give yourself a nick then we can adress these issues at each other personally..
    Use the program

    lsmod

    and take a look at its manpage (man lsmod). If you have modules loaded for your soundcard but they do not start with "snd-" then probability is high that these are OSS modules. Remove them from the kernel using the command

    rmmod

    (see man rmmod). If you get message about the device being busy, make sure you unload the modules in the right order. Also make sure that no application is using sound at the moment of unloaded. You have to eventually kill artsd or esd with the help of the kill command (see man kill)

    [TOP]  [Wiki]  I am seeing (and hearing) xruns whenever the hard disk is accessed

    hdparm -d1 /dev/hda

    might help if there are lots of xruns (and you hear noise instead of music) when the hard disk is accessed.

    [TOP]  [Wiki]  What is a Mixer?

    A mixer is a device that controls the sound inputs and sound outputs on a soundcard . A mixer requires both hardware and software components. The hardware mixer is part of the electronics inside a soundcard. A software mixer is some software which provides a user interface for controlling the hardware mixer. Examples of software mixers include: alsamixer , aumix , gamix , xmix , ...

    A software mixer does not control the hardware mixer directly; the ALSA sound driver is always an interface between the software mixer and the hardware mixer. This is because different soundcards have different interfaces to their hardware mixers. The purpose of the ALSA sound driver is to provide a standard interface for controlling the different hardware-mixer interfaces. This means one software mixer can work with many different soundcards. Typical examples of mixer controls are:
        Master Volume (L,R)
        Bass Tone (L,R)
        Treble Tone (L,R)
        Line Input (L,R)
        PCM Volume (L,R)
        FM Synth Volume (L,R)
        CD/DVD Volume (L,R)
        Microphone Input Gain (L,R)
    
    A software mixer usually has two separate controls for independently controlling the volumes of the left and right (L,R) channels of each stereo sound source. There may also be controls for mono sound sources, e.g. mono microphones. A mixer is implemented inside ALSA using a ctl-device .

    For more technical information, see the page ALSAMixers .

    [TOP]  [Wiki]  I get "no such file or directory" errors from all alsa-utils . What's wrong?

    If you are sure you have ALSA installed and all necessary modules loaded into the kernel, then one reason could be a version mismatch. Especially version mismatches across major version numbers [like 0.9.7 -> 1.0.2] are bad.

    If you're running a 2.6.x ( x <=5 ) series kernel with ALSA compilied into the kernel, you might try running the MAKEDEV.snd script found in the scripts/ directory of your Linux source tree. If the /dev/snd directory is not present, this script will build and populate it with the appropriate devices, which very well might fix your problem. Note: this script must be run as root.

    [TOP]  [Wiki]  Are there any VU meters available for ALSA?

    Yes, there are several VU meters for ALSA. Here are some examples:

    ameter - http://laugeo.free.fr/ameter.html ecasignalview - http://www.eca.cx/ecasound - part of Escasound, text based

    meterbridge - http://plugin.org.uk/meterbridge - Not strictly Alsa, works with Jack


    Thanks for removing the colon. I didn't know that indent colons don't work with the static Wiki FAQ. I also found you cannot use headings for FAQ questions using the === markup. It seems a bit restrictive of the Wiki software that you cannot use all of the available markup language. Does anyone else want to extend the Wiki static FAQ generation script http://alsa.opensrc.org/faq/mkfaq.php to handle the missing markup? Maybe this sort of problem should be mentioned in FormattingRules or HowToUseAWiki?

    -- no prob. The FAQ and it's future uses are being discussed on the ThisWiki page. I also have mail contact with MarkConstable who created this wiki..

    Yeah, I'd be happy if anyone spent some time on the PHP code that generates the FAQ but it might not work off-site for anyone else. I found that to go any further with the idea it would involve deeper hacking into the code of this Wiki itself and therefor would no longer be a simple standalone PHP script. I keep saying I am going to write another Wiki-like interface for this site and I intend to do so by the end of 2004... so if anyone comes up with a better FAQ generator it will get used here, or in the code that takes over. Any ideas can be outlined in ThisWiki and I'm happy to coop as best I can but I'm not willing to spend much more time on the current simple script.

    http://alsa.opensrc.org/faq/mkfaq.php.txt

    [TOP]  [Wiki]  Is there a way to get mplayer working with ALSA plug:dmix ?

    Yes, you need to use SDL to get sound output when using mplayer and plug:dmix (see the page DMixPlugin for info on software mixing of multiple PCM streams). The reason is that the current mplayer 1.0pre3 alsa9 doesn't handle ALSA devices properly by design according to a message on the mailinglist.

    To use SDL, set up the SDL audio handlers like this if you use the bash shell:

       export SDL_AUDIODRIVER=alsa
       export AUDIODEV=plug:dmix
    


    Now use the mplayer SDL audio output:

       mplayer -ao sdl
    


    --Isn't there an alsa1x driver already? Does it handle the ALSA devices better? I tried mplayer cvs at Thu Mar 25 00:18:21 CET 2004 mplayer now has the alsa1x ao, works beautifully with dmix indeed!

    Footnote: You can also use mplayer without plug:dmix but then you would not be able to do software mixing of multiple PCM streams.

    [TOP]  [Wiki]  Can I use multiple soundcards with JACK / in sync?

    Probably not.

    If your soundcard doesn't have a S/PDIF / ADAT / wordclock in then it's basically not possible. Apparently Delta 44 cards can be synced in the kernel, but that's currently only implemented under Windows XP.

    If you don't need the cards to run in sync then you can use a MultipleCards asoundrc to configure them to appear as one device, but this will not work with jack, or if you need sample sync between the cards.

    If you do have wordclock then linking the wordclock ports (with appropriate t-pieces and terminators) and setting the master/slave controls on the card should lock the clocks and using a MultipleCards asoundrc should make them work as one card.

    If you have ADAT or S/PDIF and your card can take its master clock from the input then you might be able to do the same thing, by linking the digital output of the master card to the digital input of the slave card, but if your card does resampling (e.g the Soundblaster Live) it may be difficult, or impossible to persuade it to take its clock from the digital in.

    The PHP source code to regenerate this static FAQ page is available here.