Use USB Microphone with Raspberry PI and Raspbian Buster Lite

AliExpress.com Product - Latest Raspberry Pi 4 Model B with 1/2/4GB RAM BCM2711 Quad core Cortex-A72 ARM v8 1.5GHz Support 2.4/5.0 GHz WIFI Bluetooth 5.0

Some advanced projects with Raspberry Pi can foresee also the use of voice controls. While these projects are not simple to setup (I’m scheduling some tests in the very next future), giving a microphone to your RPI can be a very simple operation. A very interesting project, in this sense, is the Google home assistant project.

Remember that Raspberry Pi doesn’t come with a built-in audio device. A very cheap solution is the use of some USB microphones which can be found on-line, costing a few dollars.

USB microphone

Installing USB microphone from a terminal is simple and is the only way if you don’t have a desktop environment installed.

What We Need

We’ll use an SSH session to connect our Raspberry Pi, so no USB keyboards or video cables are needed.

  • Raspberry Pi with power supply
  • An SD Card

We’ll start from a fresh installation of the recent Raspbian Buster Lite (here the procedure).

I’ll use a Raspberry Pi 3 A+, but the procedure is the same for all recent RPI models.

Step-By-Step Procedure

Once Raspbian is installed and the USB Microphone is plugged in, check the USB device connection:

lsusb

this will show the following output:

USB microphone lsusb cmd

Bus 001 Device 001 is the phisical hub inside RPI board, while Bus 001 Device 002 is my USB microphone. With RPI model B this could show 5 devices, being RPI model B equipped with 4 USB ports (+ internal hub).

Let’s check the list of audio input devices with the following:

arecord -l

this output should be shown:

USB microphone arecord cmd

So, my microphone matches with card 1 / device 0. This will be mapped in the following with plughw:1,0.

Now, we can test a simple recording by typing:

arecord -D plughw:1,0 -d 3 test.wav

The following output will appear:

USB microphone arecord rec cmd

Now you can simple check this file by connecting and downloading it with your favourite FTP software (for example Filezilla) to your RPI with ad SFTP connection (using your RPI user and password, pi and raspberry if you left the factory ones).

Bonus

Recording volume can be very low in some cases. Alsamixer helps us with a simple interface to manage audio devices volumes. Type in your terminal:

alsamixer

You’ll see the default console:

alsamixer default

Now,  you have to switch to the correct audio device by pressing F6:

alsamixer switch device

In my case, the correct sound card is the one marked as bcm2835 ALSA:

alsamixer bcm

Use up / down arrow keys to regulate at your choice. Press ESC to save and exit. Test againg.

 

Enjoy!

AliExpress.com Product - Raspberry Pi Zero W (Wireless) (new 2017 model)AliExpress.com Product - Memory Card 32GB 16GB 8GB 128GB 64GB Microsd
Please follow and like us:
error