---
title: "How to add an audio waveform with Claude (tested prompt and script)"
description: "A glowing cyan waveform scrolls left across a dark strip under the bottle, spiking on each drum hit and flattening in the gaps between them. Install one skill and ask Claude Code, or run the Python script we tested yourself."
url: https://www.recharm.com/effects/audio-waveform
---

# How to add an audio waveform with Claude

A glowing cyan waveform scrolls left across a dark strip under the bottle, spiking on each drum hit and flattening in the gaps between them.

Made by the script on this page, from our own test clip.

## Get this effect

1. ### Switch to Code in your [Claude Desktop App](https://claude.com/download)

2. ### Install the skill (once)

   ```
   Install the Recharm video effects skill: download https://recharm-growth-staging.s3.us-east-2.amazonaws.com/website/downloads/recharm-video-effects.zip and unzip it into ~/.claude/skills
   ```

3. ### Ask for the effect

   ```
   Add an audio waveform to input.mp4
   Second the waveform fades in: 0.5
   Seconds of sound shown across the frame: 1.5
   ```

## Several videos, several effects, one ask

Put your clips in the folder, mention them with @, and ask for everything at once. Claude runs one tested script after another on each clip, then joins them.

Add an audio waveform to **@clip1.mp4**, put a sale badge on **@clip2.mp4**, give **@clip3.mp4** a VHS look, then join all three with crossfades.

## Settings you can change

Ask Claude to change any of these, or edit them at the top of the script.

| Setting   | Default          | What it does                                                                              |
| --------- | ---------------- | ----------------------------------------------------------------------------------------- |
| `START`   | `0.5`            | Second the waveform fades in.                                                             |
| `WINDOW`  | `1.5`            | Seconds of sound shown across the frame. Shorter scrolls faster and shows each hit wider. |
| `Y, BAND` | `0.86, 0.14`     | Where the strip sits (0-1 down the frame) and its height as a share of the frame.         |
| `COLOR`   | `(40, 240, 255)` | Line color.                                                                               |
| `GLOW`    | `6`              | Blur radius of the glow around the line, in pixels.                                       |
| `SHADE`   | `110`            | Opacity (0-255) of the dark strip behind the line. 0 removes it.                          |

## Without the skill

Don’t want to install the skill? Paste this prompt into Claude Code and Claude writes the script itself.

```
Add an audio waveform to input.mp4 (540x960, 30fps, with a drum track). From 0.5 seconds, fading in over 0.3 seconds, show a dark strip across the full width, 14% of the frame height tall and centered 86% down the frame: black at 110/255 opacity. On it draw the soundtrack's waveform as a scrolling envelope: the strip shows the last 1.5 seconds of sound with the newest sound at the right edge, so it scrolls left. For each pixel column take the peak absolute sample in that slice of time, divide by the loudest sample in the clip, take the square root, and draw a line that far above and the same distance below the strip's center, reaching up to 45% of the strip height each way. Draw both lines 3 pixels wide in cyan (40, 240, 255), fill between them with the same cyan at 70/255 opacity, and add a glow: a copy of the lines blurred with a 6 pixel Gaussian under them. During silence it is a flat cyan line along the center. Nothing is drawn before 0.5 seconds. Use Python with numpy and Pillow to read the audio and draw it and ffmpeg to put it on the video (don't use ffmpeg's drawtext filter), keep the audio, and save it as output.mp4.
```

## Run it without Claude

This is the exact script we tested. Save it as `audio-waveform.py` and run:

```
python3 audio-waveform.py input.mp4 output.mp4
```

```
#!/usr/bin/env python3
"""Audio waveform: a glowing cyan line traces the soundtrack across a dark strip near the bottom, scrolling left.

Usage: python3 audio-waveform.py input.mp4 output.mp4  (the input needs an audio track)
Needs ffmpeg, Pillow and numpy (pip install pillow numpy).
"""
import json
import math
import subprocess
import sys

import numpy as np
from PIL import Image, ImageDraw, ImageFilter

START = 0.5               # second the waveform fades in
FADE = 0.3                # seconds the fade-in takes
WINDOW = 1.5              # seconds of sound shown across the frame; the newest sound is at the right edge
Y = 0.86                  # strip center (0-1 down the frame)
BAND = 0.14               # strip height as a share of the frame height
COLOR = (40, 240, 255)    # line color
LINE = 3                  # line width in pixels
GLOW = 6                  # blur radius of the glow around the line
SHADE = 110               # opacity (0-255) of the dark strip behind the line
RATE = 48000              # audio samples per second read from the input

def audio(path):
    """The soundtrack as mono floats from -1 to 1."""
    raw = subprocess.check_output(["ffmpeg", "-v", "error", "-i", path, "-f", "s16le", "-ac", "1", "-ar", str(RATE), "-"])
    return np.frombuffer(raw, np.int16).astype(np.float32) / 32768

def envelope(t):
    """Peak loudness (0-1) for each pixel column, over the WINDOW seconds of sound ending at t."""
    edges = np.linspace((t - WINDOW) * RATE, t * RATE, w + 1).astype(int)
    peaks = np.zeros(w)
    for x in range(w):
        a, b = max(edges[x], 0), min(edges[x + 1], len(sound))
        if b > a:
            peaks[x] = np.abs(sound[a:b]).max()
    return np.sqrt(peaks / peak)   # square root lifts quiet sounds so they still show

def strip(t):
    """The dark strip with the waveform drawn as a mirrored line above and below its center."""
    sh = round(h * BAND)
    mid, reach = sh / 2, sh * 0.45
    env = envelope(t)
    top = [(x, mid - e * reach) for x, e in enumerate(env)]
    bottom = [(x, mid + e * reach) for x, e in enumerate(env)]
    line = Image.new("RGBA", (w, sh))
    draw = ImageDraw.Draw(line)
    draw.polygon(top + bottom[::-1], fill=COLOR + (70,))
    draw.line(top, fill=COLOR + (255,), width=LINE, joint="curve")
    draw.line(bottom, fill=COLOR + (255,), width=LINE, joint="curve")
    img = Image.new("RGBA", (w, sh), (0, 0, 0, SHADE))
    img.alpha_composite(line.filter(ImageFilter.GaussianBlur(GLOW)))
    img.alpha_composite(line)
    return img

def overlay(t):
    img = Image.new("RGBA", (w, h))
    fade = min(max((t - START) / FADE, 0), 1)
    if fade > 0:
        s = strip(t)
        s.putalpha(s.getchannel("A").point(lambda a: round(a * fade)))
        img.alpha_composite(s, (0, round(h * Y - s.height / 2)))
    return img

def probe(path):
    info = json.loads(subprocess.check_output(["ffprobe", "-v", "error", "-select_streams", "v:0", "-show_entries",
                                               "stream=width,height,r_frame_rate:format=duration", "-of", "json", path]))
    s = info["streams"][0]
    num, den = s["r_frame_rate"].split("/")
    return s["width"], s["height"], s["r_frame_rate"], float(num) / float(den), float(info["format"]["duration"])

def render(src, out):
    """Draw overlay(t) on every frame of src and save to out, keeping the audio."""
    ff = subprocess.Popen(["ffmpeg", "-y", "-v", "error", "-i", src,
                           "-f", "rawvideo", "-pix_fmt", "rgba", "-s", f"{w}x{h}", "-r", rate, "-i", "-",
                           "-filter_complex", "[0:v][1:v]overlay=shortest=1,format=yuv420p[v]",
                           "-map", "[v]", "-map", "0:a?", "-c:v", "libx264", "-crf", "18", "-c:a", "copy", out],
                          stdin=subprocess.PIPE)
    for i in range(math.ceil(duration * fps)):
        ff.stdin.write(overlay(i / fps).tobytes())
    ff.stdin.close()
    if ff.wait():
        sys.exit("ffmpeg failed")

src, out = sys.argv[1:3]
w, h, rate, fps, duration = probe(src)
sound = audio(src)
peak = max(float(np.abs(sound).max()), 1e-6)
render(src, out)
```

## More music-synced visuals

- [AI voice orb **AI voice orb**](https://www.recharm.com/effects/ai-voice-orb)
- [Audio-reactive blob **Audio-reactive blob**](https://www.recharm.com/effects/audio-reactive-blob)
- [Audio-reactive particles **Audio-reactive particles**](https://www.recharm.com/effects/audio-reactive-particles)
- [Audio-reactive text **Audio-reactive text**](https://www.recharm.com/effects/audio-reactive-text)
- [Audiogram **Audiogram**](https://www.recharm.com/effects/audiogram)

## Find 3x _winning ads_

Recharm cuts your ad footage into tagged, searchable clips: hooks, testimonials, product shots. Find the shots that win, add the effect with Claude, and ship 3x more ad edits.

[Start 14-day free trial](https://www.recharm.com/get-started)
