Luau FFT is a module which can be used to perform discrete Fourier transforms on Roblox.
- Bundled with an easy-to-use complex number module
- Calculate fast Fourier transforms
- Calculate discrete Fourier transforms
In simple terms, a Fourier transform can be used to find out the intensity of sine waves of various frequencies that can be used to construct virtually any function. A common use for this is to calculate the frequency spectrum of a group of audio samples for audio visualization. I won’t get into the mathematical side of it here, but if you’re interested, you can check out the documentation of this module, Wikipedia or a bunch of other sources.
To get the discrete Fourier transform of a table of numbers, simply require the
fourier module and call either the
fft function with the arguments
(samples, nil, true). More advanced ways to use the module are in the documentation.
An example of what this module could potentially be used for.
The Roblox Luau VM cannot perform thousands of iterations of a loop quickly, so using large sample tables is not recommended for real-time applications. Using large amounts of samples will quickly increase the time it takes to calculate the DFT/FFT. As for audio visualizers, being able to only sample audio at 60 Hz (max framerate without an unlocker) means that the spectrum can only be calculated for frequencies up to 30 Hz per the Nyquist-Shannon sampling theorem.
- Documentation on GitHub
- GitHub repository
- The module on the Roblox Creator Marketplace
- Example model which I made for the video above
FFT_Example_model.rbxm (15.3 KB)
If you use this, put it in
This resource is licensed under the Mozilla Public License Version 2.0.