0

I recently bought a usb soundcard and a 3.5mm microphone for my raspberry pi 4 to use for a python project for speech recognition where I want the pi to be able to hear to conversational volume voices from anyone inside the same room it's in. I have been scouring the internet for ways to configure the usb device with alsa in order to get the microphone working. I found this very helpful response and followed the instructions exactly and I was able to hear clear test sounds from the earbuds I have connected to the pi through the soundcard. However, when recording with arecord --device=hw:1,0 --format S16_LE --rate 48000 -c1 -V mono test.wav with the alsamixer capture volume at 100 there appears to be no sound coming in from the microphone and when playing the audio back with aplay -D plughw:1,0 test.wav I hear only low white noise. When I use the microphone that is attached to my earbuds as input, I can record very faint, but audible, audio. Additionally, the 3.5mm microphone works fine on my mac so I am assuming the issue is with the gain levels from alsa.

lsusb:

Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 005: ID 046d:c52f Logitech, Inc. Unifying Receiver
Bus 001 Device 004: ID 248a:8367 Maxxter 
Bus 001 Device 003: ID 1b3f:2008 Generalplus Technology Inc. 
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Generalplus Technology Inc. is the soundcard.

aplay -l && arecord -l:

**** List of PLAYBACK Hardware Devices ****
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

my ~/.asoundrc file looks like:

pcm.!default {
    type hw
    card 1
}
ctl.!default {
    type hw
    card 1
}

and if I try to change it at all, I get errors when I try to record or test the speakers.

amixer:

Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 30
  Mono:
  Front Left: Playback 19 [63%] [-16.50dB] [on]
  Front Right: Playback 19 [63%] [-16.50dB] [on]
Simple mixer control 'Mic',0
  Capabilities: pvolume pvolume-joined cvolume cvolume-joined pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Mono
  Capture channels: Mono
  Limits: Playback 0 - 14 Capture 0 - 30
  Mono: Playback 14 [100%] [9.00dB] [on] Capture 30 [100%] [33.00dB] [on]
Simple mixer control 'Auto Gain Control',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]

Again, I'm assuming the problem is that the capture volume for the mic is capped at 33 decibels, so I'm wondering how I can raise that cap. Any help with this would be appreciated.

5
  • Ah, my experience is that piezo/crystal mics speak louder than dynamic/moving coil mics. I was disappointed with the more expensive dynamic guys and switched to dirt cheap piezo guys and listen happily ever after. So my conclusion is: "Cheaper is Louder."
    – tlfong01
    Jan 2 '20 at 5:06
  • Well, I'd prefer to use the mic I have. The fact that the recorded audio is still very quiet even with my earbud's mic tells me this is more of a configuration thing than a hardware thing.
    – Dan
    Jan 2 '20 at 17:07
  • Ah, I agree, for speech recognition you need a good quality. Using cheapie piezo thing. One thing I might try is to use a professional quality pre amp to amplify output from mic, before feeding it to aux.
    – tlfong01
    Jan 3 '20 at 0:55
  • "How to increase mic input volume?" superuser.com/a/160660/576975 . I'm not sure but I hope it would help.
    – M. Rostami
    Jan 3 '20 at 2:32
  • That post is helpful for setting the microphone level, but I need a way to increase the cap above 33dB. Thanks though.
    – Dan
    Jan 3 '20 at 16:34
2

Hey so I know that this is late but I actually found a good answer! This is my first post too so I don't know how to do things like formating, but I am going to try my best. I found this information on the website PiMyLifeUp. The link to the article is here: https://pimylifeup.com/raspberrypi-microphone/. What it says to do is this:

  1. Plug in the microphone
  2. update your Pi using 'sudo apt update' and 'sudo apt upgrade'
  3. with that out of the way go into the terminal and type 'arecord -l'. This will show you what mics are connected to the Pi. If yours doesn't show up then try disconnecting it, then reconnecting it.
  4. In the list that shows up from the 'arecord -l' command there are 2 things that you need to pay attention to. Those are: 1) the card number 2) the device number. Write those down on a piece of paper as they are needed later on.
  5. Run 'nano /home/pi/.asoundrc'
  6. within that file, edit it to look like this: 'pcm.!default { type asym capture.pcm "mic" } pcm.mic { type plug slave { pcm "hw:[card number],[device number]" } } ' Make sure to change '[card number]' and '[device number]' with the card and device number that you put down on your piece of paper. After you are done with that file hit CTRL+X, then Y, then ENTER.
  7. To test if the microphone is working, run the command 'arecord --format=S16_LE --rate=16000 --file-type=wav out.wav'. To end the recording and exit out of that tool, press CTRL+C.
  8. If you receive and error while recording, try these things to fix it. 1) make sure that the microphone is properly plugged in. 2) make sure that you configured the '.asoundrc' file correctly.
  9. Play the recording with 'aplay out.wave' If you need to control the volume (make microphone louder or quieter) then follow these steps.
  10. run the command 'alasmixer'
  11. If your microphone is not available, use F6 to select your microphone.
  12. use the arrow keys to increase or decrease the gain.
  13. When you are done, hit 'ESCAPE' to exit out of the tool. And you are done! With this you should be able to fix your microphone!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.