mirza.town
about archive rss

24/08/2023

FFT but Freehand!

Finding a good looking signal is hard so why not freehand it? Most of the calculators online use a pre-defined signal which is useful for learning but not for fun.

Back while I was in college, saw a video of The Coding Train where he builds a Fourier Transform visualiser from scratch. If you are interested in the subject, I highly suggest watching his original video and 3Blue1Brown’s video.

With my limited memory of the subject and lack of JavaScript knowledge, I decided to build my own version of it. I used p5.js.

While I intended to include sine and cosine waves for visuals, I scratched the idea. Might implement in the future. :^) In hindsight, I should not have used Cooley-Tukey algorithm because padding or trimming the input is a headache.

Want to check my horrible code? Head over to the GitHub repo. You can also check the live version right here. A much, much better version can be found here which is written by the Coding Train himself.

Note: If you have a keen eye, you might notice that the output of IFFT is pushed from the center of the canvas. Debugged it a lot, couldn’t find why. :^)