Log In  

Cart #vectorized_fft-1 | 2024-06-17 | Embed ▽ | License: CC4-BY-NC-SA

(This is slower after 0.1.0h but still fairly quick overall - maybe I'll update these numbers eventually.)

Here's some fairly fast FFT code for Picotron. It abuses the fact that matmul() is extremely cheap right now, and also decomposes shuffles into either matrix transposes or large-stride vector shuffles - so even if matmul() gets more expensive this should remain fairly efficient. A 256-point complex FFT currently takes about 1.4% CPU at 60fps.

Hit Z or X to switch to the visualizer mode, which demonstrates feeding tracker output into the FFT to get frequency visualization. You could try taking the FFT code to use this with your own music!

This works on complex signals only at the moment, but since it's quite fast and accepts separate real and imaginary vectors as inputs, using it for real signals shouldn't be too bad - just provide a zero imaginary part and ignore the upper half of the returned frequencies.

General FFT code is in fft.lua, demo-specific code is in main.lua. I’ll probably stick a MIT license or similar on the FFT code soonish - if you want to use it and I haven’t done that by the time you read this (and the CC license won’t work for you), get in touch and remind me!

P#150033 2024-06-16 21:57 ( Edited 2024-07-20 20:05)

[Please log in to post a comment]