Forum Rule: Always post complete source code & details to reproduce any issue!
-
-
Then you'll need to map your x coord to frequency through an exponential function, and use that to decide which FFT bin corresponds
to that frequency. And you'll probably want to interpolate between bins at the low frequencies for a smoother curve there, and
average multiple bins at the higher frequencies.
-
for the x axis I thought to force the values that interest me in an array because if I use an exponential function to draw the axes because I think that I will not have the precision between 0 and 1Khz as in my example (1 khz is at half of the axis).
For interpolation and averaging, how will I go about it?
thank you
-

Originally Posted by
fred_france
for the x axis I thought to force the values that interest me in an array because if I use an exponential function to draw the axes because I think that I will not have the precision between 0 and 1Khz as in my example (1 khz is at half of the axis).
The FFT output is always equally spaced frequency bins, nothing you can do to change that, you simply want
to present that information recscaled logarithmically. For each x position map to an actual frequency (exponential
conversion as I said), then lookup the value in the FFT bins. Simple.
For interpolation and averaging, how will I go about it?
thank you
Standard mathematical operations, thousands of online tutorials about this kind of thing, you'll probably find some
code examples too if you search.
You could stat just by taking the nearest bin reading - the curve will end up rather steppy at the start, but it would
be a starting point for refinement.
-
thank you
I realize that if I want to put 1 khz roughly half of the screen (x = 320/2 = 160px), the precision will not be good because of the insufficient number of bins (512 for 22Khz, so 23 for 1khz).
So if I want to display 23 bins on 160px, that's a maximum of 7 bars that can be displayed on this half of the screen.
I guess I need to increase the sample rate (base at 44100Hz)
What can be done on the Teensy 4 to enhance this sampling?
-
I try the library fft4096 found here : https://forum.pjrc.com/threads/42221...-on-Teensy-3-6
this seems good to me for my application, I will now think about your advice
-

Originally Posted by
fred_france
thank you
I realize that if I want to put 1 khz roughly half of the screen (x = 320/2 = 160px), the precision will not be good because of the insufficient number of bins (512 for 22Khz, so 23 for 1khz).
So if I want to display 23 bins on 160px, that's a maximum of 7 bars that can be displayed on this half of the screen.
I guess I need to increase the sample rate (base at 44100Hz)
What can be done on the Teensy 4 to enhance this sampling?
No, you want to reduce the sampling rate or increase the number of FFT bins or both.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules