i2s microphone with Raspberry Pi

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jbeale
 
Posts: 48
Joined: Sat Nov 13, 2010 3:34 am

i2s microphone with Raspberry Pi

Post by jbeale »

I got the Adafruit I2S microphone SPH0645LM4H and connected it as described at
https://learn.adafruit.com/adafruit-i2s ... iring-test
and I got the provided example command using 'arecord' to work:
arecord -D plughw:1 -c1 -r 48000 -f S32_LE -t wav -V mono -v file.wav
this produces a usable audio recording, so clearly both the hardware and kernel driver works.

Now I would like to use 'ffmpeg' instead of 'arecord' for some other features it has. I have not had any problems in the past using ffmpeg to record from USB audio adaptors, but so far it doesn't work with the Adafruit I2S mic. A command like:
ffmpeg -loglevel verbose -f alsa -i plughw:1 test.wav
does not generate any error, the output file is the expected length, but it is entirely zeros.

Has anyone ever got ffmpeg to record from an Adafruit I2S mic, and if so how?

User avatar
jbeale
 
Posts: 48
Joined: Sat Nov 13, 2010 3:34 am

Re: i2s microphone with Raspberry Pi

Post by jbeale »

I still don't know how to do it entirely from ffmpeg, but as a workaround it is possible to use arecord and then pipe it over:

Code: Select all

arecord -D plughw:1 -c1 -r 24000 -d 10 -f S32_LE -t raw -v | ffmpeg -f s32le -ar 24k -ac 1 -i pipe: test.wav

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: i2s microphone with Raspberry Pi

Post by mikeysklar »

Maybe something like this since mems defaults to pcm_s32le output.

Code: Select all

ffmpeg -ar 24k -acodec pcm_s32le -ac 1 -f alsa -i plughw:1

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

Return to “General Project help”