atomic14 / m5stack-core2-audio-monitor

A fun little project to test out the mic on the M5Stack CORE2
Creative Commons Zero v1.0 Universal
67 stars 17 forks source link

Differential pressure sensor spectrogram #7

Open dizcza opened 1 year ago

dizcza commented 1 year ago

Hi, I've ported your example to plot a spectrogram of differential pressure sensor output and it looks promising! It's cool to see that I only needed to change the Sampler class logic to read I2C differential pressure values and pipe read data (in surprisingly the same data format, int16_t) to the Processor. And the application works fine.

You haven't touched the intrinsics of FFT processing in your youtube video, and I'm struggling to figure out a couple of things. The most important one, what's the magic number 30 in

https://github.com/atomic14/m5stack-core2-audio-monitor/blob/28f4231296b2cd1ce0321a1bad74768b0a6d2cba/src/AudioProcessing/Processor.cpp#L35

Does it bear physical meaning or it's simply a scaling factor derived empirically to make the plots look nice?

Also, the sampling rate of my sensor is unfortunately way below 16 kHz: it's 1024 Hz. If I'm interested in all possible frequencies, from 0 to 1024/2, shouldn't I set the WINDOW_SIZE to 1024?