To generate an audio waveform as SVG, decode a bounded local audio file, calculate a minimum/maximum peak envelope, and export the result as a deterministic SVG. This approach creates a static, scalable time-domain image whose dimensions and colors you control, while keeping both the source audio and generated graphic in the current browser tab. The Audio Waveform Generator follows this workflow: it reads one browser-decodable file, divides the decoded frames into equal index ranges, records the lowest and highest finite samples in each range, and draws one vertical line per range. You can preview the result, inspect the exact SVG markup, and download the same SVG string as an editable file. This is a strong choice when the deliverable is a waveform graphic for a layout, video, article, or design project rather than a frequency analysis or loudness measurement. It supports exact SVG widths from 320 to 1,600 pixels and heights from 120 to 600 pixels, uses browser-supplied six-digit hexadecimal colors, and bounds the number of peak columns to keep processing and output manageable. No audio or graphic is uploaded to Lizely, and the original recording is not rewritten.

what is the best way to generate audio waveform
Generate an Audio Waveform as SVG

Why use a local SVG peak waveform

For a static waveform graphic, a local SVG workflow preserves the source, provides repeatable geometry, and leaves an editable file rather than a flattened screenshot. The Audio Waveform Generator groups decoded samples into contiguous buckets and retains both the minimum and maximum in each one. This min/max envelope preserves short positive and negative peaks more honestly than taking one arbitrary sample from every bucket, while the bounded column count keeps the SVG manageable.

Processing happens locally in the current browser tab. The original audio is never rewritten, and the downloaded graphic is a text-based SVG rather than a raster image. That combination suits a web article, presentation, design comp, or editing timeline where the waveform should remain sharp at different display sizes.

Match the visual to the question you need answered

A peak waveform shows amplitude over time; it is not interchangeable with frequency or loudness analysis. Match the output to its intended purpose before choosing a generation method.

OutputWhat it representsBest fit
SVG peak waveformMinimum and maximum sample amplitudes within each time bucketA static, editable, and scalable waveform graphic
SpectrogramFrequency content across timeSpectral analysis, which this generator does not provide
Calibrated loudness meterLoudness assessed under defined measurement conditionsLoudness analysis, not represented by peak height alone

Check the source and SVG limits before processing

The selected file must be browser-decodable and must pass every decoded-data limit. An extension or MIME label cannot guarantee that the current browser and operating system support its real codec.

CheckAccepted valuePractical effect
Source formatMP3, WAV, M4A, AAC, Ogg, WebM, or FLACActual decoding still depends on browser and operating-system codec support
Compressed file sizeAt most 50 MiBA larger file is rejected
Decoded durationNo more than five minutesA longer decode is rejected
Decoded channelsOne through eightFiles outside the range are rejected
Decoded sample rate8,000 through 192,000 HzRates outside the range are rejected
Decoded channel samplesNo more than 30 millionThe whole file is rejected rather than truncated
SVG width320 through 1,600 pixelsControls the horizontal size and peak-column ceiling
SVG height120 through 600 pixelsControls the vertical size and peak scale
ColorsSix-digit hexadecimal valuesBackground and waveform colors are embedded as validated values

Unsupported, corrupt, empty, or disguised files return an error. The channel-sample limit matters because a small compressed recording can expand into a much larger floating-point channel array. Over-limit audio is rejected as a whole; the generator does not silently create a waveform from only the beginning.

Generate the waveform in four concrete steps

  1. Choose one local audio file. Select a supported MP3, WAV, M4A, AAC, Ogg, WebM, or FLAC file that the current browser can decode. Confirm that it satisfies the compressed-size, duration, channel, sample-rate, and channel-sample limits before continuing.
  2. Set the SVG dimensions and colors. Enter a width from 320 through 1,600 pixels and a height from 120 through 600 pixels. Choose the background and waveform colors with the six-digit hexadecimal controls.
  3. Generate the local peak envelope. The current tab decodes the selected audio and groups its frames into bounded min/max buckets. The source file remains unchanged, and neither the audio nor the generated graphic is uploaded.
  4. Check the counts and inspect the result. Review the reported decoded frame count and peak-column count, then examine either the preview or the expanded SVG text. When the output matches your requirements, download the exact SVG string.

Stale-result protection is built into the workflow. Replacing the file, changing an option, generating again, or leaving the page revokes the obsolete object URL, so an older image cannot appear to represent the new inputs.

Read the peak envelope and column geometry

The decoded frames come from the browser's Web Audio AudioBuffer. The peak-column count is the smaller of three values: the requested image width, 1,000, and the decoded frame count. A short clip therefore does not invent more independent measurements than it contains, while a long recording stays within a bounded processing and SVG budget.

All decoded frames are divided into contiguous integer-index buckets. The first bucket begins at frame zero, the last reaches the final decoded frame, and accepted frames are not omitted between adjacent ranges. For each bucket, the generator finds the minimum and maximum finite sample across every decoded channel, clamps defensive out-of-range values to -1 through 1, and draws one vertical line from the bucket maximum to its minimum.

The geometry is deterministic. The vertical center sits at half the requested height, while full-scale positive or negative samples extend to 45 percent of the height above or below that center, leaving a five-percent margin at the top and bottom. Columns are evenly centered across the requested width.

Multichannel audio is represented as one combined peak overview. A bucket's minimum may come from one channel while its maximum comes from another. The result does not create separate left and right lanes, preserve channel identity visually, or average the channels into a new signal.

Inspect and download the exact SVG

The page exposes the exact generated SVG text in an expandable inspector, and the download uses that identical string. The markup contains one background rectangle and a group of peak lines, with fixed pixel dimensions and a matching viewBox. Numbers and colors are validated before being written into the SVG rather than copied from a filename or embedded source metadata.

The downloaded file is editable SVG, not PNG, JPEG, video, or audio. You can open it in an SVG-aware editor, inspect its lines, or place it in a project that accepts SVG. It remains sharp when displayed at another size, although extremely large print or editing workflows may still require different stroke widths or more detailed source data.

Put the waveform into the next project stage

A static SVG is useful when a layout needs a crisp waveform without embedded audio. Keep the original SVG instead of using a screenshot so the graphic can scale and remain editable. If the next stage is After Effects, follow the project-specific instructions for pulling a custom audio waveform SVG into After Effects.

Check the destination application's SVG support before importing. If another format is required, use an appropriate downstream export step rather than expecting this download to produce PNG, JPEG, video, or a modified audio file.

Keep the visualization's meaning clear

Time runs from left to right, but each vertical line represents a range of sample amplitude rather than frequency. The generator does not calculate frequency content, beats, notes, calibrated loudness, speech, transients, or musical structure. It is therefore not a spectrogram or a diagnostic analyzer.

A peak waveform is not a calibrated loudness meter. Two recordings can display similar peaks while sounding very different because perceived loudness also depends on duration, frequency balance, dynamics, and playback conditions. Do not use the picture to diagnose hearing, equipment, clipping history, phase, or mastering compliance.

For a reproducible static waveform, choose a valid local source, set the exact dimensions and colors, generate the min/max peak envelope, check the frame and column counts, inspect the SVG source, and download the identical file. If you need separate left and right waveforms, use an audio editor that exposes each channel as its own track.

For a deeper look, see What Result to Expect When Generating an Audio Waveform?.