Replies: 1 comment
-
Yes, you have to read for a sufficiently long time and sample rate data from the audio channel, depending on the lowest and highest frequency you want to display, and feed that data into a FFT algorithm, which returns the spectrum. The lowest frequency you can get is the determined by the sample time T and is 1/T. So if your sample time is 10 ms, the lowest frequency is 100Hz. The highest frequency is sample_frequency/2. so with a sample frequency of 8 kHz you get 4 kHz as the highest frequency in the spectrum. 10ms at 8 kHz are 800 samples. FFT works best if the input data size is 2**n, So you should use 1024 samples instead, which is easy to handle. Note: I moved that topic to discussions, since it is not about a bug or something that must be changed. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm currently looking at creating a light bar to light up in different ways/animations depending on the current frequencies being played through a speaker. I haven't tried yet, but from the documentation of the I2S module, there isn't a way of seeing this information from an audio stream:
After looking at the documentation for the I2S module for MicroPython, the closest method of potentially doing this would be using what is read from the
.readinto(buffer)
function.I will do some testing on a RPi Pico and see if I can get something figured out, I will update this thread soon.
Mitch
Beta Was this translation helpful? Give feedback.
All reactions