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.