FFTWindow
Window functions for FFT spectrum analysis.
Read time 1 minuteLast updated 5 days ago
Definition
- Type: Enum
- Namespace: UnityEngine
- Assembly: UnityEngine.AudioModule
public enum FFTWindow
Remarks
Pass a value from this enum to the parameter of AudioListener.GetSpectrumData or AudioSource.GetSpectrumData. Unity applies the window to the time-domain samples before the FFT to reduce spectral leakage (energy spreading from one frequency bin into neighboring bins).
windowStronger windows taper the signal more at the edges of the analysis block, which typically lowers sidelobe leakage but widens the effective main lobe and can reduce frequency resolution. A more complex window can also be less efficient. For background on the tradeoff, see the notes on AudioSource.GetSpectrumData.
Typical choices:
- FFTWindow.Rectangular — sharpest bins, most leakage; useful for quick checks or when leakage is acceptable.
- FFTWindow.Triangle — light tapering; a step between rectangular and raised-cosine windows.
- FFTWindow.Hamming or FFTWindow.Hanning — common general-purpose raised-cosine windows.
- FFTWindow.Blackman or FFTWindow.BlackmanHarris — stronger sidelobe suppression when you need cleaner peaks at the cost of wider bins.
Additional Resources: AudioListener.GetSpectrumData, AudioSource.GetSpectrumData.
Fields
Value | Description |
|---|---|
| Blackman | Blackman window for FFT spectrum analysis. |
| BlackmanHarris | Blackman-Harris window for FFT spectrum analysis. |
| Hamming | Hamming window for FFT spectrum analysis. |
| Hanning | Hanning (Hann) window for FFT spectrum analysis. |
| Rectangular | Rectangular (no) window for FFT spectrum analysis. |
| Triangle | Triangular (Bartlett) window for FFT spectrum analysis. |