Vidya Verma
Buck Bidwell
Dieter Dirkmann
Valentina Vega
Katya Kosmova
Willow Wellbeing
Wendy Whitmore
Seamus Sweeney
Marcus Mayfield
Freddy Fenderbender
Chris Cosell
Fleur Fontaine

Pick a voice, press play, and watch the sound. As each clip plays, its frequencies are read every frame and drawn as bars on a canvas, mirrored above and below a center line. The louder a range of the voice is, the taller and brighter its bar. It started as an old proof of concept that drew the same thing with D3 and SVG. I rebuilt it in React and TypeScript and moved the drawing to canvas, which is lighter and faster for something that redraws every frame. Along the way it picked up a reusable audio hook with lock screen controls, and closed captions that follow along in a speech bubble.
One audio element, two outputs. Routing an audio element into Web Audio takes over its output. The source has to connect to the analyser for the numbers and to the speakers for the sound, or the visualizer moves and nobody hears anything.
One source per element, ever. createMediaElementSource throws if it's called twice on the same element, and React's development mode runs effects twice. The audio context and the source live in refs, so they're created once and reused.
Audio starts asleep. Browsers create an AudioContext suspended until the user interacts with the page. It's resumed on play, and again when the tab comes back into view, since mobile browsers suspend it in the background.
Cross-origin audio is silent to the analyser. The clips live on Sanity's CDN, a different origin from the site. Without crossOrigin="anonymous" on the audio element, the browser still plays the sound but hands the analyser nothing but zeros.
Frequency data is just numbers. Every frame, getByteFrequencyData fills an array with one value from 0 to 255 per frequency range. Each value becomes a bar, with its height and brightness both scaled to how loud that range is.
Voices live in the low end. Most of the array is high frequencies a speaking voice barely touches, so those bars just sat flat. Drawing only the lower slice of the array fills the width with the part of the sound that actually moves.
Canvas over SVG for this. SVG keeps every bar as an element on the page, and D3 has to update each one every frame. Canvas just repaints pixels, so redrawing more than a hundred bars a frame stays cheap.
Lock screen controls. The audio hook sets Media Session metadata (the speaker's name, title and a cropped Sanity image), so the clip shows up on a phone's lock screen and in headphone controls, with play and pause wired up.
Captions in a speech bubble. The VTT track loads but stays hidden. A cuechange listener copies the current line into state, and the bubble shows it in the site's own style instead of the browser's built-in captions.
Point it at a microphone instead of a clip, and it's a voice you can see. Kids could sing into it and watch their voice jump, or try to match the shape of a character's line, like a karaoke game for talking. A stadium could put it on the big screen as a noise meter, with the crowd trying to max it out. Any audio player can wear it: a podcast, a radio station or an audiobook with a picture that breathes along with whoever's talking. Paired with the captions, it's a way to see a voice as well as read it.