USB mic on Linux
USB-microphones 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.
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
Detecting the device
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, samplerates and the like.
To look for installed modules regarding the soundsystem, 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.
To really make sure that ALSA has detected your USB microphone, do a:
$ cat /dev/sndstat . . Audio Devices: 0: Intel 82801DB-ICH4 (DUPLEX) 1: Samson C01U . . Mixers: 0: Analog Devices AD1981B 1: Samson C01U
To see if the USB-microphone is detected and installed, try:
$ 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)
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 dicernible 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 http://dsl.org/cookbook/cookbook_27.html.
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.
Samson C01U USB-microphone
There are apparently some issues with using the Samson C01U USB-microphone under Linux. There are some documents outlining the problem:
See also ...
... this Forum thread for further discussion.