I put this in the “chit-chat” area, because I am not looking for help, and because I do not, by any stretch, know enough about this subject to write a How-To, and I most definitely do NOT know enough to answer questions on configuring some one else’s mic (which is invariably what happens if one writes a How To). So instead, I thought I would just write my experience in chit-chat.
I had previous tried to get the USB mic working under Linux with my old Phillips Webcam, and I failed miserably. I now have a newer Logitech HD Pro Webcam C910 that comes with a USB mic and I thought I would try with it.
Recording with a USB mic
In short, I have it working with ‘arecord’. The command line I used for a short 5 second recording is:
arecord -f cd -D hw:1,0 -d 5 test.wav
**Detail: **
The first question I always have when I see some confusing Linux command line is, OK, sure it works, but what does it mean ??
If one types “man arecord” one gets an explanation of the arecord arguments that is very confusing with a zillion options, and so to save some effort I note:
-
-f
:```
–format=FORMAT
Sample format
Recognized sample formats are: S8 U8 S16_LE S16_BE U16_LE U16_BE S24_LE S24_BE U24_LE
U24_BE S32_LE S32_BE U32_LE U32_BE FLOAT_LE FLOAT_BE FLOAT64_LE FLOAT64_BE IEC958_SUB-
FRAME_LE IEC958_SUBFRAME_BE MU_LAW A_LAW IMA_ADPCM MPEG GSM
Some of these may not be available on selected hardware
There are also two format shortcuts available:
-f cd (16 bit little endian, 44100, stereo -f S16_LE -c2 -r44100]
-f dat (16 bit little endian, 48000, stereo) -f S16_LE -c2 -r48000]
If no format is given U8 is used.
- **-D**
: --device=NAME, Select PCM by name
- **-d**
: duration (in seconds) - Interrupt after # seconds. A value of zero means infinity. The default is zero, so if this option is omitted then the arecord process will run until it is killed.
- **test.wav**
is where the audio is stored after recordingNow "-d" is easy, but the other two difficult.
At first, I struggled with "-D". How does one know what to put there? I noted from the "man arecord" page, that I typed:
arecord -l
the USB mic section of the output was:
card 1: U0x46d0x821 [USB Device 0x46d:0x821], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Great, BUT that did not help me. :( ... then I stumbled across this internet page: [Linux: How to determine your audio card's, or USB mic's, maximum sampling rate - voxforge.org](http://voxforge.org/home/docs/faq/faq/linux-how-to-determine-your-audio-cards-or-usb-mics-maximum-sampling-rate) which told me to pay attention to the card# and the device#, which is "1" and "0" respectively. Ergo this is "**hw:1,0**" where "1" is the card, and "0" the device.
So I then tried (and failed) to get a 5 second recording:
arecord -D hw:1,0 -d 5 test.wav
which gave me the error (with no recording):
Recording WAVE ‘test.wav’ : Unsigned 8 bit, Rate 8000 Hz, Mono
arecord: set_params:979: Sample format non available
... Hmmm "sample format non available". Wav not available? How sad ! So I looked again at the "man arecord" for formats, noting it stated "***Some of these may not be available on selected hardware***" and also noting it stated "***There are also two format shortcuts available***" "-f cd" and "-f dat". So I decided to try the first, and tried for a 5 second recording:
arecord -f cd -D hw:1,0 -d 5 test.wav
And it worked !
So there is no rocket science above. Rather just the record of a humble Linux user trying to learn a command line function to get the mic on my new webcam working. And it works !!