Fast Fourier Transform
An implementation of a Fast Fourier Transform, Inverse Fast Fourier Transform, and a frequency calculator for the FFT.
This library is part of audiergon, built by Hamd Waseem (https://github.com/hamdivazim/Audiergon)
- Available Methods:
iterative_fft
iterative_ifft
iterative_fftfreq
- Dependencies:
cmath
audiergon.bit_reverse
- audiergon.fast_fourier_transform.iterative_fft(arr)[source]
An iterative Fast Fourier Transform implementation within Python.
Computes the one-dimensional discrete Fourier Transform (DFT) of an array using the Cooley-Tukey algorithm.
- Parameters:
arr (list or numpy.ndarray) – The time-domain samples to be transformed.
- Returns:
A list of complex numbers representing the frequency spectrum.
- Return type:
list
- Raises:
ValueError – If the length of the array is not a power of two.
- audiergon.fast_fourier_transform.iterative_fftfreq(l, d=1.0)[source]
An iterative calculation of the frequencies for the FFT output.
Generates the sample frequencies for each bin location based on the total sequence window length and spacing interval.
- Parameters:
l (int) – Window length (number of bins).
d (float, optional) – Sample spacing/interval (inverse of the sampling rate), defaults to 1.0.
- Returns:
A list containing the calculated frequency values for each bin.
- Return type:
list
- Raises:
ValueError – If the length of the frame is not a power of two.
- audiergon.fast_fourier_transform.iterative_ifft(arr)[source]
An iterative Inverse Fast Fourier Transform implementation within Python.
Computes the inverse discrete Fourier Transform (DFT) to convert a frequency-domain array back into the time-domain, utilising the Cooley-Tukey algorithm.
- Parameters:
arr (list or numpy.ndarray) – The complex frequency-domain coefficients.
- Returns:
An array of numbers scaled down by the sequence length.
- Return type:
numpy.ndarray
- Raises:
ValueError – If the length of the array is not a power of two.