To use USB mini microphone on Raspbian

From Wiki
Revision as of 01:22, 3 May 2018 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Introduction

Mkdd1.jpg

This is a tiny USB Microphone that plugs into your laptop or desktop computer. No microphone on your computer? No problem - just plug this incredibly small microphone into a USB port and add microphone functionality. No need to install any extra software; Microsoft Windows will detect the device and automatically install it. Simply launch within any program such as Skype or Google Hangouts.

There is no need to configure the USB mini microphone, it can be used directly. You can also use it in Rasperry Pi which has been burned with Raspbian, Here are the steps.

Components

-Raspberry Pi

-A TF card burned with the Raspbian

-5V DC power adapter, 2A or above with micro USB interface

-HDMI interface display (or VGA interface display with a VGA to HDMI adaptor)

-USB mouse and keyboard

-Speakers or headphones in the standard of 3.5mm

-USB mini microphone

Steps

Step1: Ready to start the Raspberry Pi and insert the mini microphone module as well as audio/headphones.

Open the Terminal of the Raspberry Pi

Mddk2.jpg

Step2: Check the USB connection

Enter the following commands to check the usb connection

lsusb

You can see the USB devices connected by the Raspberry Pi

Mddk3.jpg

“C-Media Electronics, Inc. CM108 Audio Controller” is the USB mini microphone. Check the microphone with arecord

arecord -l

(“l” is lower “L”). You will see the recording device:

Ddmk4.jpg

You will see device card1, device0. Use plughw:1,0 to represent.

Mk5.jpg

Step3: Records testing

Record for three seconds and play it

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

Mk6.jpg

Here we use arecord to record and aplay to play;“-D” to choose the device and “-d” to set the recording time

You can input “arecord --help” and “aplay --help” for details.

If the sound is low, you can adjust the gain of the microphone.

Step4: Adjust the gain of the microphone

Open the Audio Device Settings: Open the Menu in the top left corner, and go through Preferences => Audio Device Settings.

Mk7.jpg

Choose USB PnP Sound Device(Alsa mixer)in the Sound card column. It there appears No controls visible, open the Select Controls in the lower left corner.

Mk8.jpg

Tick the Microphone in the Select Controls page and click Close in the lower right corner.

Mk9.jpg

At this time, No controls visible in the middle of the Audio Device Settings page becomes Capture.

Adjust the slider below to adjust the gain of the microphone.

Mk10.jpg

After adjusting, record again:

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

Enjoy!

FAQ

Q1:Microphone doesn't work or defective.

You can open the Audio Device Settings in the Raspberry Pi.

AD Settings.png

then you can see the USB PNP Sound Card in the drop-down menu of the Sound Card.

Sound Card.png

After selecting, the default below does not show any settings, you need to click Select Controls, and check the two controls, then click Close to close the page.

Select Controls.png

Now, you can see two Tabs, Capture and Switches. You can set the volume of Capture to the max, and click OK to close the setting.

Capture Switches.png

Volume.png

Test:
You can open the Terminal and enter command arecord -l, then you will get USB PnP Sound Device.
Then enter the command:
arecord -D plughw:1,0 -d 3 test.wav
You can record 3 seconds of sound and save to test.wav, next you can use aplay test.wav to listen to it.

Test.png