One of [Dooievriend]’s friends recently pressed him into service to write software for a 3d spectrum analyzer/VU that he made. The VU is a fairly complex build: it’s made up of 1280 LEDs in a 16x16x5 matrix controlled by a PIC32 clocked at 80MHz. [Dooievriend] wrote some firmware for the PIC that uses a variation on a discrete Fourier transform to create a 3D VU effect.
When [Dooievriend] set out to design the audio analyzing portion of the firmware, his mind jumped to the discrete Fourier transform. This transform calculates the amplitude in a series of frequency bins in the audio—seemingly perfect for a VU. However, after some more research, [Dooievriend] decided to implement a constant Q transform. This transform is very similar to a Fourier transform, but it takes into account the logarithmic way that the human ear interprets sound.
[Dooievriend] started implementing the constant Q transform using an interrupt-based sampler, but he quickly ran into issues with slow floating-point math on his PIC32 (which doesn’t have a hardware floating-point unit). Thankfully he rewrote his code using fixed-point math, and the transform runs nearly real-time. Check out the video after the break to see the VU in action, and a second video that gives some details on the hardware build.