Raspberry Pi microphone setup with USB sound card

Two options of attaching a microphone into Raspberry Pi. One is to have USB mic, another to have an external USB sound card. Regardless the choice, the following instruction will work in setting up some basic microphone setup, before doing something cool like recording music, or experimenting with voice recognition modules.
  1. To enable USB audio output, load the sound driver:
sudo modprobe snd_bcm2835

2. To prevent the internal sound card to appear at the top comment out line, and change index from -2 to 1:

sudo nano /etc/modprobe.d/alsa-base.conf

options snd-usb-audio index=1

3. Enable USB audio output by default

sudo nano /etc/asound.conf
pcm.!default {
  type plug
  slave {
    pcm "hw:1,0"
ctl.!default {
  type hw
  card 1

4. Reboot now:

sudo reboot

5. To record:

arecord -D plughw:1,0 -f cd test.wav

6. To playback:

aplay test.wav
7. You may want to adjust some volumes:
8. To save your settings:
sudo alsactl store
Have you tried anything cool with a microphone on your Raspberry Pi? Please share your experience here.

Viewed: (14204)

  • http://-.-- Urbano

    Hello. I’m trying to make a soun studio about the acustic contamination in my classroom, so I need that my raspberry can check the volmune or intensity or db about the sound. Can you help me ? :) Ty

  • Dipto Pratyaksa

    Hi, sure, you can hook RPi to external sound sensors or simple microphone, and write a python program to detect the decibels.

  • Avichal Sahai

    arecord -D plughw:0,0 -f cd test.wav
    sir i think it should be,
    arecord -D plughw:1,0 -f cd test.wav

  • Pingback: Audio Configuration in Raspberry pi | Corredera Jorge

  • David Bendell

    Hello Urbano. Did you have any success with this project? Could you share some details of how you did this? Thanks.