This week, as I was a little bored and I though that my right screen wall dull.. So I decided to make a little music/sound visualizer with Unity using the Compute Shaders. I like the result a lot so I'm sharing it. You can download it below.
How does it works ?
It's failry simple. Using the sound from the computer (so for example when I'm playing music with "Windows Groove" or watching a video on Youtube), the visualizer reads the spectrum data and generate a VU Meter. It then sends it to the GPU along with some other controls. The GPU moves thousands of particles accordingly and renders it. I finally add some post effects like the G L O W.
To be more precise, it is using "Stereo Mix" as a microphone, so you need it to be setup in order to work.
Color, Gradient or Video !
To visualize your sound you can use a simple color (RGB), a gradient (speed can be depending on the beat), or a video (that you can set). For setting a video just paste the URL in the text field in the bottom right corner of the screen*.
I figured out that if you let it play for too long it could eat your RAM and make your computer crash (I was already using 50% of the RAM before I started it, after 5 hours it was using 99% of the RAM and the computer gave me a nice blue screen). Obviously epilepsy warning too.
- SPACE to start listening.
- F1 to show/hide controls.
- VU Scale is the scale of the VU meter (center is 0).
- Z Offset is the distance of the particles from the camera (default is center).
- Circle Size is the condensation of the particles (left is very condensed).
- Time Scale is the rotation speed (right is 0).
- Glow Threshold is the glowing threshold (center is 0, left is negative).
- Glow VU Scale is the scale of the glow depending on the UV meter (left is 0).
- Video Scale is the scale of the video.
- Offset X and Offset Y are the offset coordinates of the video.
- Video/Color Blend is the blending between using color/gradient and using video (left is only video, right is only color/gradient).
- Color/Gradient Blend is the blending between using only a single color and using only the gradient (left is only color, right is only gradient).
- Gradient value gets a specific color on the gradient (from left to right : red, yellow, green, blue, purple, red).
- Gradient Speed is the speed of the color changing.
- Gradient VU Speed is the speed of the color changing depending on the VU Meter.
- Color Red/Green/Blue sliders are for the single color.
- The number only text field is for setting the number of particles (minimum is 100, default is 10'000).
- The text field under it is the video URL*.
* : it needs to end in ".mp4", ".webm", etc. in order to work. GIFs and youtube links aren't supported. If you want to use a local file just put "file://" before the url e.g. "file://C:/myfile.mp4".