USB mic on Linux

From Audacity Wiki
Jump to: navigation, search
This page provides some help getting a USB microphone to work with Audacity on Linux.


On Linux, recording with a USB microphone is best done under ALSA (Advanced Linux Sound Architecture). Audacity Beta 1.3.x provides native ALSA support. Stable 1.2.x versions of Audacity only support the older OSS (Open Sound System), but can work with ALSA using an OSS emulation layer.

USB-microphone in Open Sound System

USB-microphones in OSS are usually setup as /dev/dsp1 under Linux.

The stable version of Audacity will not find /dev/dsp1 unless there is also a device called /dev/dsp0. (This is a bug in PortAudio that should be fixed in a future version.)

To work around this bug, try setting the AUDIODEV environment variable (at a terminal):

    $ AUDIODEV=/dev/dsp1 audacity

or try running

    # ln -s /dev/dsp /dev/dsp0

as root. Please let us know whether this helps or not. - this does not work. (Wez 07)

It is also possible to run Audacity through an ALSA emulation layer, with:

    $ aoss audacity

which should enable audacity to use ALSA-devices natively.

USB-microphone in ALSA

Audacity 1.3.0beta has native support for ALSA devices using the Portaudio v19 library. To get the most out of trying this, download the latest version from the CVS repository, and also the latest version of Portaudio from

To compile Audacity, check out CompilingAudacityForBeginners, Developing On Linux and Audacity_1.3_beta_testing.

Detecting the device

To see if the device is detected, do:

    $ cat /proc/bus/usb/devices

And search for the name of your microphone in the output. If you see the mic detected, check for Driver= to see which USB-driver has been loaded for the mic.

Displaying a thorough list of USB-devices is done by issuing the command

    $ lsusb --verbose | less

Search for the lines which contains Audio and Control Device like in the screendump below:

    Bus 001 Device 004: ID 17a0:0001  
    Device Descriptor:
    bLength                18
    bDescriptorType         1
    bcdUSB               1.10
    bDeviceClass            0 (Defined at Interface level)
    bDeviceSubClass         0 
    bDeviceProtocol         0 
    bMaxPacketSize0         8
    idVendor           0x17a0 
    idProduct          0x0001 
    bcdDevice            0.01
    iManufacturer           1 Samson Technologies      
    iProduct                2 Samson C01U              
    iSerial                 0 
    bNumConfigurations      1
    Configuration Descriptor:
      bLength                 9
      bDescriptorType         2
      wTotalLength          177
      bNumInterfaces          2
      bConfigurationValue     1
      iConfiguration          0 
      bmAttributes         0x80
        (Bus Powered)
      MaxPower               90mA
      Interface Descriptor:
        bLength                 9
        bDescriptorType         4
        bInterfaceNumber        0
        bAlternateSetting       0
        bNumEndpoints           0
        bInterfaceClass         1 Audio
        bInterfaceSubClass      1 Control Device
        bInterfaceProtocol      0 
        iInterface              0 
        AudioControl Interface Descriptor:
          bLength                 9
          bDescriptorType        36
          bDescriptorSubtype      1 (HEADER)
          bcdADC               1.00
          wTotalLength           40
          bInCollection           1
          baInterfaceNr( 0)       1
          AudioControl Interface Descriptor:
          bLength                12
          bDescriptorType        36
          bDescriptorSubtype      2 (INPUT_TERMINAL)
          bTerminalID             1
          wTerminalType      0x0201 Microphone
          bAssocTerminal          2
          bNrChannels             2
          wChannelConfig     0x0003
            Left Front (L)
            Right Front (R)
         iChannelNames           0 
         iTerminal               0 

In the top row, (Bus 001 Device 004: ID 17a0:0001) is the USB bus number. In the listing there are many noteworthy preferences for the microphone, sample rates and the like.

To look for installed modules regarding the sound system, do a:

   $ lsmod | grep snd
   snd_intel8x0           33692  3
   snd_ac97_codec         92704  1 snd_intel8x0
   snd_ac97_bus            2304  1 snd_ac97_codec
   snd_usb_audio          78784  0
   snd_pcm_oss            53664  0
   snd_mixer_oss          18688  1 snd_pcm_oss
   snd_usb_lib            16640  1 snd_usb_audio
   snd_rawmidi            25504  1 snd_usb_lib
   snd_seq_device          8716  1 snd_rawmidi
   snd_hwdep               9376  1 snd_usb_audio
   snd_pcm                89864  5 snd_intel8x0,snd_ac97_codec,snd_usb_audio,snd_pcm_oss
   snd_timer              25220  2 snd_pcm
   snd                    55268  14 snd_intel8x0,snd_ac97_codec,snd_usb_audio,snd_pcm_oss,snd_mixer_oss,snd_rawmidi,snd_seq_device,snd_hwdep,snd_pcm,snd_timer
   soundcore              10208  1 snd
   snd_page_alloc         10632  2 snd_intel8x0,snd_pcm
   usbcore               130692  5 snd_usb_audio,snd_usb_lib,ehci_hcd,uhci_hcd

and look for the modules usbcore, snd_usb_audio, snd_usb_lib. If they are loaded, the USB sound should work.

OSS emulation

To make sure that ALSA can use the USB-mic in OSS-emulation mode, do a:

    $ cat /dev/sndstat
    Audio Devices:
    0: Intel 82801DB-ICH4 (DUPLEX)
    1: Samson C01U
    0: Analog Devices AD1981B
    1: Samson C01U

Making sure ALSA detects the mic

To see if the USB-microphone is detected and installed, try:

    $ cat /proc/asound/cards


    $ cat /proc/asound/pcm
    00-00: Intel ICH : Intel 82801DB-ICH4 : playback 1 : capture 1
    00-01: Intel ICH - MIC ADC : Intel 82801DB-ICH4 - MIC ADC : capture 1
    00-02: Intel ICH - MIC2 ADC : Intel 82801DB-ICH4 - MIC2 ADC : capture 1
    00-03: Intel ICH - ADC2 : Intel 82801DB-ICH4 - ADC2 : capture 1
    00-04: Intel ICH - IEC958 : Intel 82801DB-ICH4 - IEC958 : playback 1
    01-00: Samson C01U : capture 1


    $ arecord --list-devices
    card 0: I82801DBICH4 [Intel 82801DB-ICH4], device 0: Intel ICH [Intel 82801DB-ICH4]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: I82801DBICH4 [Intel 82801DB-ICH4], device 1: Intel ICH - MIC ADC [Intel 82801DB-ICH4 - MIC ADC]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: I82801DBICH4 [Intel 82801DB-ICH4], device 2: Intel ICH - MIC2 ADC [Intel 82801DB-ICH4 - MIC2 ADC]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 0: I82801DBICH4 [Intel 82801DB-ICH4], device 3: Intel ICH - ADC2 [Intel 82801DB-ICH4 - ADC2]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 1: default [Samson C01U              ], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0

There is also a couple of new devices in /dev/snd/, depending on the system and devices installed. An example may include:

  • PCM interface: /dev/snd/pcmC1D0c (Pulse Code Modulation - Card #1 Device #0 - capture)
  • Control interface : /dev/snd/controlC1 (Control Card #1)

Tedious PCM detailed listing

To get a detailed list of all PCM's and their configuration, try:

     $ arecord --list-pcms

which will output all sound hardware on the system and its configuration. To most of us, its a heap of junk with no discernible information, but it is good to know about how to get it on screen.

Setting the stage

To set the volume levels and other controls for your USB-mic, and get a nice Ncurses interface to do it in, do:

     $ alsamixer -c 1 # if your mic has card number 1 in the "arecord --list-devices" listing.

Be sure to unmute the capture channel, else no sound will be recorded anywhere.

Useful Alsamixer commands:

  • To toggle mute/unmute on a channel, navigate to it using arrow-keys, and press m or M to mute/unmute on both channels.
  • To toggle mute on the right of the stereo channels, press ">".
  • To toggle mute on the left of the stereo channels, press "<".
  • To show the capture-controls only, press F4.
  • To toggle the capture facility, press [space].

Another mixer that can be used is aumix which is a more elaborate tool than the native Gnome mixer.

For the hardcore people out there, there is always the amixer, which is a text-based tool to set recording levels, muting and unmuting channels and so on. Some help may be found at

Recording with ALSA

To test the recording capabilities of your USB-mic in Linux, there is a number of neat programs to try. However, since not all programs are especially designed for PlugNPlay with USB-mics, the ALSA development people has included a rather sluggish but usable recording utility that works without any fancy GUI and effect junk that could mess things up. It is called arecord and we have used its versatility above, to display devices and PCMs. It can also be used to record, hence the name.

The syntax for recording is:

    arecord -f [format] -D hw:card,device -d [duration]

and if one wishes to record in cd-quality for 20 seconds using the USB microphone detected as Card #1 Device #0 as in the listing above, and save it to test.wav issue the command:

    $ arecord -f cd -D hw:1,0 -d 20 test.wav

The result can be played using the aplay utility, also available in ALSA.

    $ aplay -f cd test.wav

If it works, then you will be able to use the microphone in any setting, even if you have to dabble a lot to get things working correctly.

Setting default recording device

Editing ~/.asoundrc and putting this snippet below might work for some:

 pcm.!default {
         type asym
         playback.pcm {
                 type plug
                 slave.pcm "hw:0,0"
         capture.pcm {
                 type plug
                 slave.pcm "hw:1,0"

This little ALSA configuration setting uses the default sound card as playback device (hw:0,0) and sets hw:1,0 (that suppose to be your USB-mic) to become the default capture device.

More on ALSA-configuration file syntax may be found here.

More on running two sound cards simultaneously here.

Samson C01U and Q1U USB microphones

The Samson C01U (condenser) and Q1U (dynamic) USB microphones are detected correctly as USB audio devices by the Linux Kernel. The issues specific to these two Samson microphones are related to setting the correct recording levels.

In Ubuntu Linux, Audacity 1.2.x packages will not work with the Samson C01U microphone for the reasons listed at the top of the page (ALSA vs. OSS). However the program called "Sound Recorder" seems to work fine with the microphone on plug-and-play (recording levels and all). Audacity can then be used to import a FLAC audio file which was recorded with Sound Recorder.

There are apparently some quirks with using the Samson C01U USB-microphone under Linux. There are some documents outlining the problem:

Review of Samson C01U USB Microphone with Linux

  • First post (although with not entirely correct assumptions under the "Bad news" heading)
  • Follow-up

Check this Samson C01U USB Mic Low Noise HowTo for setting the correct recording-level for the C01U. As described, the signal is routed through both channels of the mic preamp, giving it a seemingly odd configuration if you use it in Linux.

Only the left channel should be recorded as a mono track. The right channel of the audio should be ignored; it's an intermediate stage and is out of polarity with the desired signal.

Setting both channels to the same level does not automatically minimize the noise, as described by Philicorda. They are independent signals and don't need to be at the same level. (Think of the right channel's level as the trim control on a mixer, and the left channel's level as the fader.) The SoftPre software provided by Samson does not work in Linux. It just hides the right channel's signal and remaps the two gain controls onto one slider.

Samson C03U and UB1 USB microphones

The Samson C03U seems to work plug-and-play on Linux, although there seems to be a lot of noise in the signal. Can anybody confirm this ? Zevv 03:43, 17 December 2006 (PST)

The C03U and UB1 condenser microphones have the same signal on both channels; there is no special consideration for the gain controls. The C03U has a pad switch which can be set in combination with the internal gain control to minimize noise for a given signal level.