A Unity example showing how to bake a waveform of an audio clip into a texture and use it in a shader.
Why should I bake a waveform into a texture?
- Pros: You can render a waveform with almost zero cost on the CPU side. It never waste heap/GC memory.
- Cons: You have to bake a waveform at build time. It's not very useful for interactive contents.
In other words, this technique is only useful when you're creating something not interactive, and you prefer torturing GPU rather than sacrificing the precious CPU time and memory.
The test song "A Himitsu - Easier to Fade (feat. Madi Larson)" was created by Argofox. It's shared under a Creative Commons Attribution License. See author's Soundcloud page for further details.