Mic on Raspberry Pi
Mic on Raspberry Pi
Don't know if happen to you that sometimes you have many things to do but an idea arises, an email from someone, something you think you can do, and leave it all to get to it.
That's what happened to me today. I wanted to test a microphone on the Pi and I'll do it. Will it work?
I have one that comes with the Singstar PS2 with an USB adapter. Karaoke is one of my passions frustrated.
I remind you that the Raspberry Pi has no microphone input and the only way to try one with Jack connector is buying a external USB Sound Card.
The first thing we have to do when Raspbian boot up is to check if any microphone is detected. There are many ways to do it, but I remember now this:
lsusb
As you can see, has been detected in the device 006 a Microphone Sony SingStar USB.
Now let's see where it has been placed in the list of sound cards (the system detects it as a sound card):
cat /proc/asound/cards
With that information we can now launch a recording program. I'll use arecord that comes installed with ALSA utilities:
arecord -f cd -D hw:1,0 -d 20 text.wav
With this parameters we recorded with CD quality for 20 seconds a file called test.wav, using the hardware of the card 1 (microphone).
To play the sound, with a simple aplay test.wav is enought. If you don't hear anything, in advanced options with sudo raspi-config utility you can change the audio output jack to HDMI and vice versa...
ADDITIONAL NOTE: If after the first record we detect that the recordings are incorrect, we have to disable the USB 2.0 driver to use the USB 1.1. To do this, add the file /boot/cmdline.txt to the next line, to ensure that the recording is done perfectly:
dwc_otg.speed=1
Happy Friday!
Help: wiki.audacityteam.org
Link: wiki.linuxaudio.org > Raspberry Pi and realtime, low-latency audio
Forum: raspberrypi.org > any recommendations for a USB microphone