ZipCPU / dblclockfft

A configurable C++ generator of pipelined Verilog FFT cores
221 stars 34 forks source link

How would I use this FFT for my 20khz sampled audio signal? #14

Closed Magmanat closed 2 years ago

Magmanat commented 2 years ago

I am using windows, but i use windows subsystem for linux (WSL) to make the fft program and also to generate my FFT's

I am using a BASYS3 board with 100MHz clock, I want my FFT to be able to bin the audio signal of 20Khz sampling to around a 20Hz frequency resolution Is it possible to get some guidance to use this?

./fftgen -f 1024 -n 12 -m 6 -p 20 -k 5000

these are the current commands i use to generate my FT as i believe that to have 20Hz binning resolution it is 20Khz / 1024 which gives me 20Hz bins.

my pmod mic 3 outputs 12 bit data and i have an oled screen that has 64 pixels in height hence i put the output in 6 bits to be able to map my output to the oled screen

-p 20 as i saw that BASYS3 has DSP elements and hence this is more efficient

-k 5000 as i am currently using my 100Mhz clock while pushing in the 20khz samples

is this the correct implementation? or am i doing something wrongly

ZipCPU commented 2 years ago

Sounds good. Let me know how it works out for you.

Some insights you might wish to consider:

Dan

Magmanat commented 2 years ago
  1. Ahh that makes more sense... Hahaha i was wondering why my output did not change
  2. Sounds good, i will probably use 12 bits, find the abs and then bitshift it down back to 6 bits
  3. Thanks for the heads up, for the moment i am crudely hardcoding notes into my program to detect, however i might need to use cents over a pitch method eventually, may i clarify that oversampling is just feeding my fft more points than my source? For e.g. clocking my fft at 40Khz when my source is 20Khz

But overall, wow what an amazing tool you have built... Really saving my life here thanks!

ZipCPU commented 2 years ago

You might find this article valuable. It explains some of the issues associated with overlap and oversampling. You might also find rudimentary logarithms to be valuable when trying to work with large dynamic ranges.

Good luck!

Dan