To create an awesome audio visualizer, using a spectrum analyzer( C.A.V.A: Console-based Audio Visualizer for ALSA ), all you need is a Raspberry Pi 3 and a RGB LED cube - VoxCube!
CAVA was created by Karl Stavestrand and it is a great tool to create an audio visualizer in the console.
We were able to make some modifications and rather than disaplay the output to the console we were able to display it onto a VoxCube.
CAVA is very customizable and easy to install.
Karl has very easy to follow instructions on the Github page
CAVA uses a loopback audio interface to analyze the audio. You will need to direct the audio to both the loopback and audio interface if you want to hear it while it is being analyzed.
We create a scripted and used mpg123 to do this;
pi@raspberrypi ~ $ mpg123 -a hw:ALSA,0,0 music_file.mp3
The cube used is a VoxCube which is an 8x8x8 RGB LED cube.
VoxCube has an on board ATmega1284 which controls each LED. The Raspberry Pi commincates to the ATmega via bitbanging which tells the cube what LEDs and at what colour they should be lit.