By Tim King · Updated
Audio to CSV or JSON
Export Raw Waveform Samples as a Time-Indexed CSV or JSON for Analysis
OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.
How the Audio To CSV/JSON works
Convert audio to CSV or JSON without uploading it. Get at the numbers inside an audio file. Select a region, choose CSV or JSON, and export a table of time and amplitude values that opens in a spreadsheet, pandas, R, MATLAB or a plotting library. The file is decoded in your browser and the text is written locally.
Audio to CSV or JSON: the numbers behind a waveform
A waveform on screen is a picture of a list of numbers. A digital recording stores one value per sample per channel, and the sample rate says how many of those values there are each second. CD audio is 44.1 kHz; video and broadcast usually use 48 kHz. This page writes those values out as text, with a time column beside each one, so the signal can be plotted, measured or fed to other software. It works from any format your browser can play, and it needs no Python.
What the columns contain
The first column is time in seconds from the start of the original file, to six decimal places.
A selection beginning at 10.5 seconds therefore begins at 10.500000. Then comes one column per
channel: value for mono, left and right for stereo, and ch3 onwards for anything wider.
Choosing Mixed to mono averages the channels into a single value column. The values run from -1
to 1, the range the browser uses for decoded audio.
Choosing a sample step
At 44.1 kHz one minute is 2,646,000 rows per channel. A stereo export at the default five decimal places is about 76 MB by the tool's own estimate, more than a spreadsheet will comfortably open. The Keep every Nth sample control skips rows. A step of 100 leaves 441 rows per second, plenty for an envelope or a level trace. A step of 1 keeps everything, the only setting that can reproduce the signal.
Skipping samples does not filter first. A step of 100 at 44.1 kHz behaves like a 441 Hz recording, so anything above about 220 Hz folds back into the data as false tones. A stepped export suits a level over time and is wrong for a spectrum. For frequency work, keep every sample and shorten the clip with the range handles.
Precision and bit depth
Decimal places sets how many digits each value keeps. Five places resolves a 16-bit sample: a 16-bit value is a multiple of 1/32768, and five decimals are accurate to 0.000005, under half that step. Multiply by 32768 and round to recover the integers. Use eight places for a 24-bit source. Beyond about seven or eight, the extra digits add file size without information, because the browser's samples are 32-bit floats. Use two or three places for a quick plot.
Where people use this
Researchers analyse bird, whale and machinery recordings as arrays of samples, and machine learning pipelines often start from raw waveform arrays. Teachers use exports to show clipping and aliasing. In each case the CSV is the starting point, and the analysis happens in a spreadsheet or library.
The JSON layout
The JSON export is one object: sampleRate, step, start (the clip's start in seconds), a
channels array of column names, and samples, where each entry is an inner array of the time
followed by the channel values. It parses with JSON.parse. In pandas, use
pd.DataFrame(data['samples'], columns=['time'] + data['channels']). The sample rate is recorded
only in the JSON, so keep it with any CSV you export.
Loading the export
In Python, pd.read_csv('file-samples.csv') gives a time column and a value or left and
right pair. R's read.csv does the same. To turn the numbers back into sound, write them with
scipy.io.wavfile.write at the original sample rate. A CSV does not record that rate, so take it
from the source file. The stats panel's Rows line shows rows per second, which equals the sample
rate only when the step is 1.
Tips and pitfalls
- Clipping shows as flat tops. A run of values at or very near 1.00000 or -1.00000 usually means the source was clipped.
- Mono mixing cancels out-of-phase audio. Anything identical with the opposite sign in left and right disappears in the average. Check the stereo columns first.
- Excel stops at 1,048,576 rows. Shorten the selection or raise the step until the Rows figure fits.
- Lossy formats are reconstructions. An MP3 or AAC export holds what the codec decodes, not the original recording. Exact measurements belong on a WAV or FLAC source.
How to read the stats panel
The Clip line gives the selected start, end and length. The Rows line gives the row count and rows per second after the step. Columns shows whether there is one value column or one per channel. The file size estimate uses the row count, the column count and the decimal places. Above about 50 MB the Format line warns that the file is large. As a check, rows times step is roughly the clip's length times the sample rate.
For why sample rate and bit depth matter, read converting audio to WAV, and which settings to pick. To cut a recording before export, use the audio trimmer, or the audio to WAV converter for a WAV file rather than numbers.
FAQ
What range are the values in?
From -1.0 to 1.0, the browser's floating-point representation. A 16-bit integer sample of 32767 appears as 0.99997. Multiply by 32768 and round to recover the integer values if a library expects them.
How do I keep the file small enough for Excel?
Excel stops at about a million rows. Use the range handles to select a short section, or set the sample step so the row count in the stats panel drops below that — a step of 50 on a 44.1 kHz file gives 882 rows per second, which plots perfectly well.
Can I export an MP3 or M4A, not just WAV?
Yes. Anything your browser can decode works — MP3, M4A, AAC, FLAC, OGG, Opus and WAV — because the page reads the decoded samples rather than the file's bytes. The values you get are what the codec reconstructs.
Is the time column relative to the clip or the file?
The original file. If you select from 10.5 seconds to 12 seconds, the first row's time is 10.500000, which makes it easy to line the export up against the full recording or a transcript.
See also: all Audio & Video tools, Units, Images, Documents, Data & Code.
Related tools
Audio To WAV
Convert MP3, M4A, FLAC or OGG to 16- or 24-bit WAV.
Audio To Base64
Turn a short audio clip into a base64 data URI.
Bit Depth Converter
Convert 24-bit to 16-bit WAV with proper dither.
FPS Converter
Convert a video to a different frame rate, keeping its speed.
Image Sequence To Video
Join numbered still frames into a video at any frame rate.