# IGModAudioChannel/FFT

## Contents |

# Description

Computes the DFT (discrete Fourier transform) of the sound channel.

The size parameter specifies the number of consecutive audio samples to use as the input to the DFT and is restricted to a power of two. A Hann window is applied to the input data.

The computed DFT has the same number of frequency bins as the number of samples. Only half of this DFT is returned, since the DFT magnitudes are symmetric for real input data. The magnitudes of the DFT (values from 0 to 1) are used to fill the output table, starting at index 1.

**Visualization protip:** For a size N DFT, bin k (1-indexed) corresponds to a frequency of (k - 1) / N * sampleRate.

**Visualization protip:** Sound energy is proportional to the square of the magnitudes. Adding magnitudes together makes no sense physically, but adding energies does.

**Visualization protip:** The human ear works on a logarithmic amplitude scale. You can convert to decibels by taking 20 log_{10} of frequency magnitudes, or 10 log_{10} of energy. The decibel values will range from -infinity to 0.

# Arguments

table tbl

# Arguments

number size