Browser-based waveform art · audio → PNG, SVG and peaks JSON

Audio Waveform Generator

Draw the shape of a sound as an image: bars or a filled wave, in one colour or a gradient, on a transparent or coloured background, with an optional played-so-far overlay. Save a PNG or SVG, or export the peak values for a web audio player.

Audio

Up to 20 minutes. Video files work too; their soundtrack is drawn.

Drop an audio file here or click to choose

.mp3, .wav, .m4a, .ogg, .flac

Shape

Colour

Gradient runs

Progress overlay

Image

The waveform appears here.

Choose an audio file to draw it.

Peaks JSON for web players

Format

A flat array of the largest absolute value at each point, rounded to 3 decimals, with the minimum and maximum arrays alongside.

Audio Waveform Generator

Operator: Abdulla Al Fahad. How tools are built and checked

In a 1200 pixel wide banner with 16 px padding, bars 6 px wide and 3 px apart, exactly 130 bars fit, so the whole track is reduced to 130 loudness values. This page does that reduction, draws the bars (or a filled wave or an outline) with a gradient, a transparent background and, if you like, a coloured played part, and gives you the picture as PNG or SVG together with the same peaks as JSON for a web player. Audiogram Maker on this site animates a spectrum into a video; this makes a still image.

Key features

  • Bars centred, bars growing from the bottom, a filled wave and an outline
  • Bar width from 1 to 30 px, gap from 0 to 20 px, rounded ends, padding and a normalise switch that stretches the loudest peak to full height
  • A solid colour or a two-colour gradient running left to right or top to bottom, and a transparent or coloured background
  • A played-so-far overlay that colours the first part and greys the rest, with an optional playhead line

How peaks become bars, outlines and JSON

The input is an audio or video file the browser can decode, up to 20 minutes. All channels are drawn together: each slice shows the highest and lowest sample found in any channel. The image can be 64 to 4096 pixels on a side, with presets of 1200 by 300, 800 by 120, 1920 by 1080 and 1080 by 1080. PNG is written at the chosen size or at double size when that stays within 8192 pixels a side and 40 million pixels. SVG is vector, with the gradient and the played-part clip written out as elements. Peaks JSON has 50 to 4000 points in one of two layouts.

How it works

When the file is loaded, it is reduced once to 8192 pairs of lowest and highest sample, so every size or style change after that only reduces those pairs further and sliders respond instantly even for a 20-minute track. For bars the count is floor((width minus twice the padding plus the gap) divided by (bar width plus gap)), and each bar is the larger of its two peaks scaled to the inner height, with a small minimum so silence still shows a line. The outline and filled styles build one polygon with a point every 2 px. The canvas and the SVG are drawn from the same list of shapes, so the PNG and the SVG match; the played-part overlay draws the shapes once in the unplayed colour and again, clipped to the played fraction of the width, in the main colour or gradient.

Typical uses

  • Drawing a 3-minute track as a 1200 by 300 gradient bar waveform with the first 40% coloured as played, as an episode graphic
  • Exporting 800 peaks for a custom web player so that it draws instantly instead of decoding the whole file on page load
  • Making a transparent 800 by 120 outline waveform for a dark and a light page from one SVG
  • Saving a 1080 by 1080 waveform on a coloured background as the cover image for a 6-minute voice memo

Building one

  1. Drop an audio file. A short progress note shows while it is decoded.
  2. Choose a style, a size, bar width, gap and padding, then the colours, the background and, if you want it, the progress overlay.
  3. Download the PNG or SVG, and set the number of points for the peaks JSON.

Example

A 4-second tone that swells to 0.6 of full scale and fades again, drawn 400 by 120 px with bars 4 px wide and 2 px apart, 8 px padding, and exported as 8 peak points

Style: bars, centred; gradient green to blue; first 40% coloured as played
Peaks JSON: 8 points, once as floats and once in the audiowaveform layout

What you get

Image: 64 bars fit across the 400 px, and the SVG carries the gradient and the played-part clip
Floats layout: peaks 0.15, 0.3, 0.45, 0.6, 0.6, 0.45, 0.3, 0.15 (one value per eighth of the tone)
audiowaveform layout: min and max pairs -19 19, -38 38, -57 57, -76 76 and back down, with samples_per_pixel 4000 (the number of audio samples each point covers: 32,000 samples recorded at 8,000 Hz, shared over 8 points)

Things to check before you rely on it

With Stretch the loudest peak switched on, a quiet recording is drawn as tall as a loud one. Turn it off if the image should show real level differences between files.

Colours must be six-digit hex codes. A typo disables the picture and shows a message instead of drawing a wrong colour.

  • A thin line, 1 to 2 px bars with a 1 px gap, looks like a classic audio editor trace; wide rounded bars with a gap look like a feed waveform.
  • Turn on Lift quiet parts for speech: a square-root curve makes quiet words visible while the loud peaks stay at full height.

Common errors and how to fix them

A recording is rejected as too long.
The limit is 20 minutes. Cut the part you need first and load that.

Best practices

  • Export the SVG when the picture will be shown at different sizes, and the PNG when a site only accepts bitmaps.

The two JSON layouts

The floats layout has one number per point, the highest absolute value in that slice, from 0 to 1 and rounded to three decimals, with the minimum and maximum arrays alongside for players that draw both sides. The audiowaveform layout follows version 2 of the BBC tool's data format: minimum and maximum interleaved as integers from -128 to 127, with the samples-per-pixel value worked out from the file.

Why the picture looks the same on every size

Because the peaks are computed once, a change of size only picks fewer or more of the same 8192 values, and a bar's height is its slice's real peak. Drawing twice as many bars on a 2400 pixel banner shows the same loud and quiet regions in finer detail, rather than a different picture.

Frequently asked questions

Is the waveform of a stereo file one channel or both?

Both together: each slice uses the highest and lowest sample found in either channel.

Why does a bar never disappear in silence?

Bars have a minimum height of 2 px (or the bar width, if that is smaller), so silent stretches still draw a thin line and the shape stays continuous.

Can the SVG keep a transparent background?

Yes. With the background switched to transparent, no background rectangle is written, and the PNG keeps its alpha channel.

What are the points in the peaks JSON?

Equal slices of the file. With 800 points, each is 1/800 of the track's length, whatever the image size.