# Export Audio Features to CSV

Export per-frame audio features — RMS, spectral centroid, ZCR, rolloff, flatness, bandwidth, flux — to CSV, TSV, or JSON. Runs in your browser.

## Run it

- **CLI:** `gizza tool audio-feature-csv-exporter 'url=https://example.com/input' 'input_format=base64' 'output=csv' 'frame_ms=25' 'hop_ms=10' 'window=hann' 'center=true' 'channel=mix' 'resample_hz=0' 'rms=true' 'centroid=true' 'zcr=true' 'rolloff=true' 'flatness=true' 'bandwidth=true' 'flux=true' 'rolloff_percent=85' 'rms_scale=dbfs' 'flatness_scale=ratio' 'include_time=true' 'include_frame=true' 'decimals=6'`
- **Web:** https://gizza.ai/tools/audio-feature-csv-exporter/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/audio-feature-csv-exporter/tool.json

## Inputs

- `input` — Audio file _(file; accept: audio/*)_
- `input_format` — Input encoding _(field)_
- `output` — Output format _(field)_
- `frame_ms` — Frame length (ms) _(field)_
- `hop_ms` — Hop length (ms) _(field)_
- `window` — Analysis window _(field)_
- `center` — Centered frames (librosa center=True) _(field)_
- `channel` — Channel _(field)_
- `resample_hz` — Analysis sample rate (Hz, 0 = native) _(field)_
- `rms` — RMS level column _(field)_
- `centroid` — Spectral centroid column _(field)_
- `zcr` — Zero-crossing-rate column _(field)_
- `rolloff` — Spectral rolloff column _(field)_
- `flatness` — Spectral flatness column _(field)_
- `bandwidth` — Spectral bandwidth column _(field)_
- `flux` — Spectral flux column _(field)_
- `rolloff_percent` — Rolloff energy (%) _(field)_
- `rms_scale` — RMS units _(field)_
- `flatness_scale` — Flatness units _(field)_
- `include_time` — Include time_s column _(field)_
- `include_frame` — Include frame index column _(field)_
- `decimals` — Decimal places _(field)_

## Output

- Feature table (text)

## Query parameters

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

- `input_format` — Input encoding
- `output` — Output format
- `frame_ms` — Frame length (ms)
- `hop_ms` — Hop length (ms)
- `window` — Analysis window
- `center` — Centered frames (librosa center=True)
- `channel` — Channel
- `resample_hz` — Analysis sample rate (Hz, 0 = native)
- `rms` — RMS level column
- `centroid` — Spectral centroid column
- `zcr` — Zero-crossing-rate column
- `rolloff` — Spectral rolloff column
- `flatness` — Spectral flatness column
- `bandwidth` — Spectral bandwidth column
- `flux` — Spectral flux column
- `rolloff_percent` — Rolloff energy (%)
- `rms_scale` — RMS units
- `flatness_scale` — Flatness units
- `include_time` — Include time_s column
- `include_frame` — Include frame index column
- `decimals` — Decimal places
- `url` — fetch the input file from a public URL (CORS-permitting)

Example: `https://gizza.ai/tools/audio-feature-csv-exporter/?url=https://example.com/input&input_format=base64&output=csv&frame_ms=25&hop_ms=10&window=hann&center=true&channel=mix&resample_hz=0&rms=true&centroid=true&zcr=true&rolloff=true&flatness=true&bandwidth=true&flux=true&rolloff_percent=85&rms_scale=dbfs&flatness_scale=ratio&include_time=true&include_frame=true&decimals=6`

---

## About this tool

Audio Feature CSV Exporter turns a short audio clip into a tidy frame-by-frame table of classic signal features: RMS level, spectral centroid, zero-crossing rate, spectral rolloff, spectral flatness, plus optional bandwidth and flux. The defaults use 25 ms frames and 10 ms hops, which match common music-information-retrieval and speech-analysis workflows while keeping the CSV small enough to inspect in a spreadsheet.

Upload WAV, MP3, FLAC, OGG/Vorbis, M4A/AAC, AIFF, CAF, MKV/WebM, or another supported audio container. The tool decodes the first usable audio track, mixes or selects a stereo channel, optionally resamples to a fixed analysis rate, then exports CSV, TSV, or JSON. Use the preset chips for a standard feature table, all-feature export, librosa-style centered frames, onset-detection flux, or metadata-rich JSON.

Worked example:

1. Upload a 3-second WAV tone.
2. Keep `frame_ms = 25`, `hop_ms = 10`, `window = hann`, and `output = csv`.
3. Run the tool. The output starts with a header such as `time_s,rms_dbfs,centroid_hz,zcr,rolloff_hz,flatness` followed by roughly 298 rows for a 3-second clip.
4. Turn on `bandwidth` and `flux` when you need timbre-spread and onset columns, or switch `output` to `json` when you want the resolved sample rate and frame settings alongside the matrix.

Limits and edge cases: pasted/loaded audio is capped at 24 MiB, analysis is capped at 4,000,000 mono samples and 200,000 output rows, and Opus/AC-3/DTS-style codecs are rejected with a clear error. Very short clips need either a shorter `frame_ms` or centered frames. Digital silence stays finite (`-200 dBFS`) instead of producing `NaN`.

## FAQ

<details>
<summary>How close are these columns to common audio-analysis libraries?</summary>

The definitions follow the usual MIR formulas: RMS over the raw frame, magnitude-weighted spectral centroid, zero-crossing rate, spectral rolloff by cumulative magnitude, and spectral flatness as geometric mean over arithmetic mean. Centered frames, Hann windows, rolloff percentage, and resampling are exposed so you can line up the output with typical notebook pipelines.

</details>

<details>
<summary>Should I export CSV, TSV, or JSON?</summary>

Use CSV for spreadsheets, pandas, R, and most BI tools. Use TSV when commas in downstream tooling are inconvenient. Use JSON when you also need metadata such as the original sample rate, resolved analysis rate, frame length, hop length, FFT size, selected features, and truncation flags.

</details>

<details>
<summary>Why is there a resample option?</summary>

Features depend on sample rate and frame size. Setting `resample_hz` to a fixed value such as 16000 or 22050 makes files recorded at different rates produce comparable row counts and frequency bins. Leave it at `0` when you want to preserve the file's native rate.

</details>

<details>
<summary>What do the optional bandwidth and flux columns add?</summary>

Bandwidth measures how spread out the spectrum is around the centroid, which helps separate narrow tonal sounds from broadband ones. Flux measures positive frame-to-frame spectral change, so it is useful for onset detection and spotting sudden timbre changes.

</details>

## Related tools

- [Extract MFCC Features from Audio](https://gizza.ai/tools/mfcc-extractor/): Extract MFCC features from audio as CSV, TSV, or JSON. Tune speech defaults, librosa-style settings, deltas, and sample-rate options locally.
- [Generate a Mel Spectrogram PNG](https://gizza.ai/tools/mel-spectrogram-generator/): Render a local audio file as a PNG mel spectrogram with ML-style FFT, hop, mel-band, dB, colormap, and image-size controls.
- [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.
- [Convert AIFF to WAV](https://gizza.ai/tools/aiff-to-wav/): Free AIFF to WAV converter that runs in your browser. Choose the PCM bit depth, sample rate and channel layout — at a matching depth the samples are identical.
- [Convert Audio Bit Depth](https://gizza.ai/tools/audio-bit-depth-converter/): Convert audio between 8, 16, 24-bit and 32-bit float PCM with proper dithering on down-conversion. Runs in your browser, nothing is uploaded, free.
