I2S MEMS SPH0645 Microphone - Volume way too low

Breakout boards, sensors, other Adafruit kits, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: I2S MEMS SPH0645 Microphone - Volume way too low

Post by adafruit2 »

lol that is really really annoying - but explains why i've had so many problems with softvol :) will add later today!

User avatar
adafruit2
 
Posts: 22148
Joined: Fri Mar 11, 2005 7:36 pm

Re: I2S MEMS SPH0645 Microphone - Volume way too low

Post by adafruit2 »

ok finally got around to testing - guide is updated with the softvol hack!

https://learn.adafruit.com/adafruit-i2s ... g-and-test

oddly alsamixer crashes when you use F4 for me, so i just used F5 to select the recording volume

User avatar
michthom
 
Posts: 1
Joined: Wed Feb 28, 2018 3:53 pm

Re: I2S MEMS SPH0645 Microphone - Volume way too low

Post by michthom »

I've been testing a slightly different approach, using the Device Tree overlay system to try to avoid direct module manipulation. I've got the I2S MEMS microphone (https://learn.adafruit.com/adafruit-i2s ... t/overview) and the I2S Amplifier (https://learn.adafruit.com/adafruit-max ... p?view=all) breakout boards working with my Raspberry Pi 3.
For details see the latter part of this thread (https://www.raspberrypi.org/forums/view ... 6#p1279486). Might be worth another guide update, if my results are replicated by and useful to others?
Cheers
Mike

User avatar
KdhruvR
 
Posts: 2
Joined: Mon Mar 19, 2018 8:37 am

Re: I2S MEMS SPH0645 Microphone - Volume way too low

Post by KdhruvR »

RickTracer wrote:Ok, I think I have it licked after much on and off trying!

The solution comes from https://www.raspberrypi.org/forums/view ... 71#p607371 solution dated Tue Sep 02, 2014 6:51 pm but hopefully I can help the newbie a bit better with all steps (adjusting the volume in mixer and changing the arecord options to use the soft volume device).

First you need to edit your alsa configuration file

Code: Select all

sudo nano ~/.asoundrc
asoundrc.txt
Update it like the file attached here which is also repeated at the bottom of this post. What this does is add in a reference to your I2S Mic and then create a software mixer.

Once you've done that you then have to use the alsa mixer to turn up the volume :

Code: Select all

alsamixer
F6 and select your I2S mic "snd_rpi_simple_card"
F4 to set the capture volume
Arrow up until about 50% (if you do too much and the recording hits MAX too much you won't have a recording)
AlsaMixer.JPG
Now you can record using arecord, you have to use

Code: Select all

-D dmic_sv
to use the soft volume and must also specify the channels as 2 (yet to figure out how to make it fully mono) - note very case sensitive

Code: Select all

arecord -D dmic_sv -c2 -r 48000 -f S32_LE -t wav -V mono -v myfile.wav
Watch the volume bar, if it goes up to max and stays there turn the volume down in the mixer and record again or you won't hear anything on playback.

Now

Code: Select all

aplay myfile.wav
And you should have a louder recording!
You can record without the software volume using

Code: Select all

arecord -D dmic_hw -c2 -r 48000 -f S32_LE -t wav -V mono -v quiet.wav
aplay quiet.wav
Hope this helps! Here's the .asoundrc - if anyone can help with how to set different default recording and playback devices please post! :

Code: Select all

#The below 2 sections are commented, they control the default sound card to use
#This set up is for a Pi with an I2S microphone attached using the guide
#from adafruit at
# https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout
#Uncomment and the I2S will be your default card (assuming same setup)
#but you won't get audio playback because both recording and playback will be
#defaulted
#TODO - Figure out how to set default for recording separately
#To adjust use aplay -l to work out the devices you have and their card number
#For recording devices use arecord -l

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

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

#This section makes a reference to your I2S hardware, adjust the card name
# to what is shown in arecord -l after card x: before the name in []
#You may have to adjust channel count also but stick with default first
pcm.dmic_hw {
	type hw
	card sndrpisimplecar
	channels 2
	format S32_LE
}

#This is the software volume control, it links to the hardware above and after
# saving the .asoundrc file you can type alsamixer, press F6 to select
# your I2S mic then F4 to set the recording volume and arrow up and down
# to adjust the volume
# After adjusting the volume - go for 50 percent at first, you can do
# something like 
# arecord -D dmic_sv -c2 -r 48000 -f S32_LE -t wav -V mono -v myfile.wav
pcm.dmic_sv {
	type softvol
	slave.pcm dmic_hw
	control {
		name "Boost Capture Volume"
		card sndrpisimplecar
	}
	min_dB -3.0
	max_dB 30.0
}


Hi @RickTracer and hopefully anyone who can help me here,
I have this issue of the volume way low. i tried implementing this configuration and changes to asoundrc
but even though the controls are there changing the controls with F4 has no effect on the Mic volume
going above 30% volume infact gives no sound on the recording. and from 0 - 30 there is no change in intensity.
Is there something else that I can try?
also could you give a look at your /var/lib/alsa/asound.state

User avatar
jimmies
 
Posts: 1
Joined: Fri Mar 23, 2018 3:21 pm

Re: I2S MEMS SPH0645 Microphone - Volume way too low

Post by jimmies »

So the installation has been quite painful but I finally managed to get it to work. For anyone looking at this thread in the future... I would like to share some improvements I did to the driver.

First, you no longer need to edit anything in the kernel module. Just compile and pass it a parameter and it will work.

Second, thanks to DKMS, you no longer need to recompile every time you upgrade your kernel, and if you haven't rpi-update the Pi, installing `raspberrypi-kernel-headers` is enough. Installing just `dkms` and then download my deb file, and `dpkg -i` the downloaded file, and everything will be done automatically for you.

I shared all my improvements, the sourcecode, and documentation here:

https://github.com/htruong/snd-i2s_rpi

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Products from Adafruit”