(This screencapture is an SDR preview)
Today's displays can show both very dark and very bright levels, such as specular highlights. Similarly, the human auditory and visual systems can handle huge dynamic ranges.
We can exploit this coincidence by mapping sound levels to brightness levels.
The idea arose alongside an Ambisonics project.
Let’s get started!
The visualizer uses a naive pre-generated binary format to carry information to the browser. Two files contain peak and mean audio values. The data is a subset of the original audio data, packed as interleaved float32 values.
- Python (see below)
- ffmpeg (required by the waveform render script)
- Node.js / npm (for running a local dev server)
- A WebGPU-capable browser (Chrome works best)
$ pyenv install 3.13.5$ python -m venv venv$ source venv/bin/activate$ pip install -U pip$ pip install -r requirements.txt
- Use the test audio or put your own
*.cafor*.wavfile with up to 16 channels intomedia/ - Run
$ python tools/render-waveform-binaries.py media/input.caf --output-dir=binaries
WebGPU requires a secure context — however, browsers treat http://localhost & http://127.0.0.1 as secure contexts, so a local HTTP server is fine.
$ npm install http-server -g$ npx http-server --cors -p 8888- Open
127.0.0.1:8888
That's it. :-)
--
This project is licensed under the MIT License.
See the LICENSE file for details.