# FFT Analyzer

Paste samples and get the frequency spectrum: magnitude, phase, dominant peaks, bin resolution and Nyquist, with windowing, dB scaling, CSV and JSON.

## Run it

- **CLI:** `gizza tool fft-analyzer "0, 1.1690, 0.6464, 0.5158, 0.5, -0.8984, -1.3536, -0.2452"`
- **Web:** https://gizza.ai/tools/fft-analyzer/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/fft-analyzer/tool.json

## Inputs

- `data` — Samples _(field)_
- `sample_rate` — Sample rate (Hz) _(field)_
- `window` — Window function _(field)_
- `pad` — Transform length _(field)_
- `spectrum` — Spectrum view _(field)_
- `scale` — Level scale _(field)_
- `phase_unit` — Phase unit _(field)_
- `remove_dc` — Remove DC offset (subtract the mean) _(field)_
- `peaks` — Peaks to list _(field)_
- `decimals` — Decimal places _(field)_
- `format` — Output _(field)_

## Output

- Spectrum (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `data` — Samples
- `sample_rate` — Sample rate (Hz)
- `window` — Window function
- `pad` — Transform length
- `spectrum` — Spectrum view
- `scale` — Level scale
- `phase_unit` — Phase unit
- `remove_dc` — Remove DC offset (subtract the mean)
- `peaks` — Peaks to list
- `decimals` — Decimal places
- `format` — Output

Example: `https://gizza.ai/tools/fft-analyzer/?data=0%2C%201.1690%2C%200.6464%2C%200.5158%2C%200.5%2C%20-0.8984%2C%20-1.3536%2C%20-0.2452&sample_rate=16&window=rectangular&pad=pow2&spectrum=auto&scale=amplitude&phase_unit=degrees&remove_dc=true&peaks=5&decimals=4&format=text`

---

## About this tool

FFT Analyzer turns a pasted time-domain sample list into a frequency-domain report. It accepts real or complex samples separated by commas, semicolons, spaces or newlines, applies optional windowing and zero padding, and returns the bin frequency, level, phase, real and imaginary components, dominant peaks, bin resolution and Nyquist frequency.

Use it when you have measured samples, generated values, sensor readings, or a short DSP test vector and need to check which frequencies are present. Set the sample rate in hertz to get a real frequency axis, or leave it at `1` for normalised cycles-per-sample output. The default `amplitude` scale makes a unit cosine report an amplitude near `1`; `magnitude`, `normalized`, `db`, `power`, `csv`, `json`, and `chart` are available for debugging and export.

Worked example: paste `0, 1, 0, -1, 0, 1, 0, -1`, set `sample_rate` to `8`, and keep the default rectangular window. The strongest peak appears at bin `2`, frequency `2`, because the samples contain a two-cycle cosine over one second.

Limits: the tool accepts up to 65,536 input samples. `pad=pow2` zero-pads to the next power of two and uses an FFT; `pad=none` preserves exact length, but non-power-of-two exact transforms use a direct DFT capped at 4,096 samples. Zero padding adds frequency bins for interpolation, not extra physical resolution.

## FAQ

<details>
<summary>What is the difference between magnitude, normalized, amplitude and dB?</summary>

`magnitude` is the raw DFT bin length, so it grows with the number of samples. `normalized` divides by the sample count. `amplitude` is the one most people want for real signals: a cosine with amplitude `1` reports about `1` in the matching one-sided bin. `db` is `20·log10(amplitude)`, so a unit-amplitude tone is `0 dB`.

</details>

<details>
<summary>Should I use a window function?</summary>

Use `rectangular` when the signal contains an exact whole number of cycles in the sample window. If the tone falls between bins, spectral leakage spreads energy into neighbouring bins; `hann` or `hamming` usually gives a cleaner peak list, while `blackman`, `blackman-harris`, and `flattop` trade wider peaks for lower side lobes or more accurate amplitude readings.

</details>

<details>
<summary>Why does zero padding change the transform length but not the resolution?</summary>

Zero padding asks the FFT to evaluate more bin positions between the frequencies implied by the original data. That can make a peak easier to locate visually, but the true resolution still comes from the sample rate divided by the original observation duration. The report states `resolution = sample_rate / transform_length` for the computed grid and reminds you not to treat padding as new measurements.

</details>

<details>
<summary>When should I choose one-sided or two-sided output?</summary>

For real-valued input, positive and negative frequency bins mirror each other, so the default `auto` view shows the compact one-sided spectrum from DC to Nyquist. Complex input can carry different positive and negative frequencies, so `auto` switches to a two-sided table. You can force either view with the `spectrum` control.

</details>

## Related tools

- [Convert AIFF to FLAC](https://gizza.ai/tools/aiff-to-flac/): Convert AIFF or AIF audio to lossless FLAC in your browser — preserve samples and textual tags, choose FLAC compression level 0-12, and download the result.
- [Bleep or Mute Regions of an Audio File](https://gizza.ai/tools/audio-bleep-censor/): Censor an audio file in your browser — bleep, mute, or duck the exact time regions you pick. Set a tone frequency and output format. Nothing is uploaded, free.
- [Audio Channel Tool](https://gizza.ai/tools/audio-channel/): Swap left/right channels, downmix stereo to mono, up-mix mono to stereo, or copy one side onto both — right in your browser. Nothing is uploaded, free.
- [Compress an Audio File](https://gizza.ai/tools/audio-compress/): Shrink MP3, WAV, M4A or any audio file right in your browser — pick a target bitrate (96 kbps default) and format. Nothing is uploaded, free.
- [Compress Audio Dynamic Range](https://gizza.ai/tools/audio-compressor/): Even out loud and quiet parts of an audio file in your browser with threshold, ratio, attack, release and make-up gain. Local and private.
