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. A generic such USB sound card as the ‘Sound Blaster Play!’ dongle can be purchased for this exercise.
1. Plug in the dongle and check the version of your sound card with lsusb:
Bus 001 Device 004: ID 041e:30d3 Creative Technology, Ltd Sound Blaster Play!
2. To enable USB audio output, load the sound driver:
$sudo modprobe snd_bcm2835
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
4. Reboot now:
5. To record:
$arecord -D plughw:1,0 -f cd test.wav
6. To playback:
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.
(Visited 24,068 times, 15 visits today)