4 ms·
The complexity of a (i)FFT scales with O(n·log(n)), whereas a naive, direct fourier transform scales with O(n·m) where `n` is the number of samples and m is the
by datenwolf 9y ago
The complexity of a (i)FFT scales with O(n·log(n)), whereas a naive, direct fourier transform scales with O(n·m) where `n` is the number of samples and m is the number of channels. Therefore for any `m > log(n)` the direct method wastes a lot of computational power.
The base of the logarithm depends on the radix of the FFT implementation, but in the end it comes out as a constant factor anyway, and for most FFTs out there it's a base in the range of 2…5, so it's at most a factor of about log(5)/log(2) =~= 2.32
Say you're synthezising a waveform of 1024 samples, then the break even between a fast against a direct fourier transform comes it at around 10 channels. For small numbers of channels the direct method is better. Prime example: Quadratur demodulators where you operate on just a single frequency with the real and imaginary parts.
But when you want to do simple additive synthesis, just put your amplitudes and phases at the right places in the spectrum and to a Inverse fourier transform. It's almost always going to beat any other method. Also it's numerically more stable (although the amplitudes in audio synthesis are never going to be so spread out that precision is going to be a problem).
- tntn 9y agoI understand the complexity and function of the FFT. However, the sluggishness of this demo is not due to the actual synthesis of the final wave, it is due to calculating and render each individual waves. I agree you could easily synthesize the final wave with the IFFT, but the point of the demo is to display all the components. The IFFT wouldn't help with this.