Raspberry Pi USB Webcam Built In Microphone

Configure USB Webcam Microphone on RASPBIAN JESSIE

I had a Microsoft LifeCam HD 3000 laying around so decided to use it on a Raspberry Pi project.  The webcam is Plug and Play, but the microphone does not work by default.

Goal:  I wanted the default audio input to be the Built-In Webcam Mic, and the default sound output to be the normal 3.5mm jack on the Raspberry Pi.

I found lots of information on changing the default hardware device to a USB Sound Card.  The problem with the instructions I found, is they redirect all the audio (Input and Output) to a secondary USB device.  In my case, I am not using a USB Audio Card. I just wanted to change the default audio capture input to my USB Microphone which is built-in to the webcam.  I don’t want to change the default audio output on the Raspberry Pi!

After a lot of searching around along with trial and error, I’ve finally got it working.

First ran the command arecord -l and received the following output:

**** List of CAPTURE Hardware Devices ****
card 1: HD3000 [Microsoft® LifeCam HD-3000], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

That told me the system does in fact recognize my USB Audio Microphone as Card 1 Device 0

Second I edited the alsa.conf file to set my USB Device as default.  Find the lines “defaults.ctl.card 0” & “defaults.pcm.card 0”  replace the “0” with “1”

sudo nano /usr/share/alsa/alsa.conf (Use Ctrl-O to save the file, and Ctrl-X to exit)

My ~/usr/share/alsa/alsa.conf File

defaults.ctl.card 1
defaults.pcm.card 1

Third I edited the ALSA configuration file .asoundrc. I used nano to edit the file.

sudo nano ~/.asoundrc  (Use Ctrl-O to save the file, and Ctrl-X to exit)  Notice the capture.pcm device is now hw:1,0 which points to my USB Audio at Card 1, Device 0.

My ~/.ascoundrc File

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

 ctl.!default {
        type hw
        card 0
}

To test the microphone I used the following commands.

Record audio using:  arecord test.wav

Play audio using:  aplay test.wav

Thank you, I hope this helps anyone looking for a similar solution.  Feel free to leave comments.

One thought on “Raspberry Pi USB Webcam Built In Microphone

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.