Closed marco711 closed 1 month ago
Hi @marco711
In dsp_view
void dsps_view(const float *data, int32_t len, int width, int height, float min, float max, char view_char);
you define amount of points to show on the X axis: width.
It means all samples from your input array will be fit to this width
points. In the example, it will be N/2, means 128 samples will be fit to the 64 samples.
Hello @dmitry1945
Thanks for your reply. To be clear, in the following example:
[2024-07-25_13:32:46:46.542207] W (48745) FFT: Signal audio 64 length
[2024-07-25_13:32:46:46.555478] I (48745) view: Data min[122] = -85.514282, Data max[1] = 11.955421
[2024-07-25_13:32:46:46.556381] ________________________________________________________________
[2024-07-25_13:32:46:46.557176] 0 |
[2024-07-25_13:32:46:46.570453] 1 |
[2024-07-25_13:32:46:46.571031] 2| |
[2024-07-25_13:32:46:46.571548] 3 |
[2024-07-25_13:32:46:46.586858] 4 |
[2024-07-25_13:32:46:46.587426] 5 | |
[2024-07-25_13:32:46:46.603128] 6 ||||| |
[2024-07-25_13:32:46:46.603908] 7 |||| |
[2024-07-25_13:32:46:46.604542] 8 || |||||||| | || |
[2024-07-25_13:32:46:46.618592] 9 | | || ||||||||||||||||||||||||||||||||||||||
[2024-07-25_13:32:46:46.619142] 0123456789012345678901234567890123456789012345678901234567890123
[2024-07-25_13:32:46:46.619679] I (48815) view: Plot: Length=128, min=-60.000000, max=40.000000
[2024-07-25_13:32:46:46.634020] W (48825) FFT: Signal audio 128 length
[2024-07-25_13:32:46:46.634676] I (48825) view: Data min[122] = -85.514282, Data max[1] = 11.955421
If the ADC sampling rate is 40 kHz, does this mean that the space between the 64 points in the image is 40 kHz/64 = 0.625 kHz? And if the width
is set to 128, will the space between points be 40 kHz/128 = 0.3125 kHz?
@marco711 If you have sample rate 40k and width = 64, then 40/2/64 = 0.3125 Hz if width is 128, then it's 0.625 Hz
@dmitry1945 Thank you very much for the explanation.
Answers checklist.
General issue report
I'm testing the fft example provided by Espressif. Nevertheless, in my application I'm injecting the audio signal captured by a microphone connected to the ADC input. What I'd like to know is how to read the frequencies displayed by the
dsps_view
function. With the example provided by Espressif I get:But I don't know the frequency of the signales. With my application (microphone connected to the ADC) I get:
Below is the code I'm using to calculate the FFT of the audio signal:
In my code
run_fft
receives as input the arrayaudio_signal
. This array contains the ADC values divided by 4095 (12-bit resolution ADC). The values are recovered from the DMA which is set with a sampling frequency of 40 KHz. The DMA is read by an independent task. Below the code I'm using for the ADC: