<sub><sup>24/08/2023</sup></sub>

#### 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](https://www.youtube.com/@TheCodingTrain){target="_blank"} where he builds a [Fourier Transform](https://en.wikipedia.org/wiki/Fourier_transform) visualiser from scratch. If you are interested in the subject, I highly suggest watching his [original video](https://www.youtube.com/watch?v=MY4luNgGfms&ab_channel=TheCodingTrain){target="_blank"} and [3Blue1Brown](https://www.youtube.com/@3blue1brown){target="_blank"}'s [video](https://youtu.be/r6sGWTCMz2k?si=ZeChr9GsbYU-XC-X){target="_blank"}.

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](https://p5js.org/){target="_blank"}. 

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. 

![](http://mirza.town/media/fft.png)

Want to check my *horrible* code? Head over to the [GitHub repo](https://github.com/doneforaiur/fft){target="_blank"}. You can also check the live version [**right here**](http://mirza.town/code/fft/){target="_blank"}. A much, much better version can be found [here](https://editor.p5js.org/codingtrain/sketches/jawHqwfda){target="_blank"} 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. :^)