PiVideoMusic

Still shot
Silent clip of the PVM in action. Youtube linked below.

Years and years ago, I heard about the AtariVideoMusic. A short lived music visualization device created by Atari in the late 70’s. It would hook up to your home hi-fi and living room TV and show off the music. Techmoan did a good introduction to it here, but imagine a very primitive version of MilkDrop.

Anyway, since before the time Techmoan did his review, I have been thinking about creating my own, modern-retro take on the idea. Music visualizers seem to have dropped off the face of the earth in the last few years, but I’ve always loved them.

Anyway, long story short, a couple of years ago I started making my own. I realized that the Raspberry Pi was the perfect tool for the job. It could easily do all the music visualization I wanted it to, and be built into the stereo component style box with an integrated, tiny, CRT that I envisioned at the time. Fate would have it that my old academic advisor had a tiny portable color television that he gave to me, gratis, and in the course of developing the code, I decided that the TV itself was perfect, so I just put the Raspberry Pi out of sight behind the TV and called it a day.

Video Tour

Software

The software is all written in python, and can be found here.

There are two files, RaspberryVideoMusicSupervisor.py and RaspberryVideoMusic.py. The former simply makes sure the latter is running as a process. It allows me to automatically recover from the occasional crash and I have set up my Pi to simply launch that script on boot.

RaspberryVideoMusic.py is the main script. It relies on Pygame and Pyaudio. The basic loop is simple. Pyaudio captures audio frames and raises a flag when there’s new data.

There are some basic data ‘services’ available at all times, updated when new data is available. These include things like the audio frame, an FFT of the audio, and a detected signal envelope.

The main loop updates the Pygame display when new data is available. Every few seconds it randomly selects a different foreground and background visualization as well as randomly selected color schemes for each.

Hardware

The hardware is extremely simple. The display is a portable color CRT TV with a composite input. The audio input is a cheap USB sound card. The only trick is that the Raspberry Pi composite output tends to inject audible display noise into the audio. I fixed that by adding a USB isolator between the Pi and the USB sound card.

Additionally, because the sound card input is a mono mic input, it shorts the left and right channels together, creating a mono signal. That’s fine for the visualizer (it could pretty easily be hacked to handle stereo input), but it means that there should be a headphone amp between your signal source and the mic input to prevent the Pi from distorting your sound and making it mono.