vidmake v0.2.1
Download

Docs/LayersPage 21 / 45

Waveform

Audio visualization with the waveform layer — spectrum bars, centered mirror bars and a line oscilloscope, synced to an audio or video file, with bar count, gap, corner radius and sizing.

View .md Ask Claude Ask ChatGPT

A waveform layer draws the sound of an audio or video file as it plays: a spectrum of bars, the same bars mirrored around the middle, or an oscilloscope line. It is the equivalent of Remotion's visualizeAudio, for podcasts, music posts and audiograms.

json
{ "id": "viz", "type": "waveform", "src": "music.mp3", "mode": "mirror", "width": 900, "height": 160,  "bars": 40, "gap": 0.4, "cornerRadius": "50%", "fill": "#161412" }
00:00.0 · f 000
The three waveform modes on the same track: bars, mirror and lineDownload
waveform-modes.jsonjson
{  "fonts": [{ "family": "JetBrains Mono", "path": "fonts/JetBrainsMono.ttf" }],  "compositions": [{    "id": "modes", "description": "The three waveform modes on the same track: bars, mirror and line",    "width": 1280, "height": 720, "fps": 30, "duration": "6s", "background": "#f4f1ea",    "layers": [      { "id": "music", "type": "audio", "src": "assets/music.mp3", "duration": "6s", "fadeOut": "0.5s" },      { "id": "bars", "type": "waveform", "src": "assets/music.mp3", "y": "22%", "width": 1000, "height": 150,        "bars": 40, "gap": 0.4, "cornerRadius": 2, "fill": "#161412" },      { "id": "mirror", "type": "waveform", "src": "assets/music.mp3", "mode": "mirror", "y": "50%", "width": 1000,        "height": 150, "bars": 40, "gap": 0.4, "cornerRadius": "50%", "fill": "#4a4640" },      { "id": "line", "type": "waveform", "src": "assets/music.mp3", "mode": "line", "y": "78%", "width": 1000,        "height": 150, "stroke": "#c92a26", "strokeWidth": 3 },      { "id": "label", "type": "text", "anchor": "left", "x": 40, "y": "=pick(i, [158, 360, 562])", "repeat": 3,        "font": "JetBrains Mono", "fontSize": 16, "letterSpacing": 2, "uppercase": true, "fill": "#8a857a",        "text": "${pick(i, ['bars', 'mirror', 'line'])}" }    ]  }]}
fielddefaultnotes
srcrequiredAn audio file, or a video file (its soundtrack is used).
modebarsbars, mirror or line.
bars48Number of bars, 1..512 (bars and mirror modes).
gap0.3Fraction of each bar's slot left empty, 0..1. A plain number.
cornerRadius0Rounds each bar; a percentage is of the bar width, so "50%" gives capsules.
fillwhiteBar color or gradient. Takes precedence over stroke in every mode.
stroke, strokeWidthSet stroke (and no fill) to color the line mode; strokeWidth (default 2, at least 1) is its thickness.
trimStart0Where in the file to start, as a time.
width, height80% of the parent × 200The area the bars or line fill.

#Modes

bars is a spectrum analyzer. The bars cover 40 Hz to 8 kHz on a logarithmic scale (bass on the left, treble on the right), each bar's height is that band's level from −60 dB (empty) to 0 dB (full height), and bars grow up from the bottom of the box. Every bar keeps a small minimum height, so silent moments still show a row of dots.

mirror is the same spectrum with each bar centered vertically, growing up and down at once: the classic podcast look.

line is an oscilloscope: about 46 ms of the actual waveform drawn across the width, centered on the current moment, with 0 at the vertical middle and full scale at the top and bottom of the box.

The spectrum is measured over a short window (about 93 ms) centered on the current frame, so the bars react in step with what you hear without any smoothing. Pure tones (like the synthetic track in the demo) light up a single band; real music and speech spread across many.

#Timing and sync

The layer's own time is the playback position in the file: at the layer's first frame it shows the file at trimStart. To stay in sync with what is heard, give the waveform the same start and trimStart as the audio or video layer that plays the sound:

json
{ "id": "voice", "type": "audio", "src": "episode.mp3", "trimStart": "1:05" },{ "id": "viz", "type": "waveform", "src": "episode.mp3", "trimStart": "1:05", "mode": "mirror", "y": "70%" }

Without a duration the layer lasts as long as the rest of the file. A waveform is not a sound source: it only reads the file. Add an audio layer to hear it. It also ignores that layer's volume and fades and shows the file at full level; to make visuals follow the mix (fades included), use the audio-reactive variables amp and bass instead.

#Styling

  • Gradients are relative to the whole layer box, so a vertical gradient ("angle": 0) colors short bars differently from tall ones, and a horizontal one colors bass and treble differently.
  • Bar shape comes from bars, gap and the box width: each bar is width ÷ bars wide minus the gap. Fewer, wider bars with "cornerRadius": "50%" read well at small sizes.
  • Line weight is strokeWidth in line mode. Animate scaleY (for example "=min(1, 1.8 * amp)") to make the scope breathe with the mix, as the audio demo does.
  • Every common field applies: opacity, glow, blendMode: "screen" over video, masks.

#Patterns

Audiogram (square post with a mirrored spectrum under a title):

json
{ "id": "viz", "type": "waveform", "src": "episode.mp3", "mode": "mirror", "y": "72%", "width": "86%",  "height": 180, "bars": 36, "gap": 0.45, "cornerRadius": "50%",  "fill": { "type": "linear", "angle": 90, "stops": ["#161412", "#c92a26"] } }

Full-width equalizer at the bottom of the frame: anchor it to the bottom edge with "anchor": "bottom", "y": "100%", "width": "100%".