Sunday, May 31, 2015

The Color of Umphrey's

If you've ever seen an Umphrey's McGee concert, you might notice that the light show is something else.  Jefferson Waful (the lighting guy) uses bright, complementary colors choreographed to the music.



Generally, there are certain parts of the songs that always have their own lighting.  For example, for the short satanic vocals in Resolution, the lights will always switch to dark red, then back to blue or green when they're over.

I wrote a program to scan Umphrey's videos and pick out the 1-3 most prominent colors.  Another script draws these data left from right, where each pixel is half a second of rock and roll.  The resulting diagram is a visual thumbprint of an Umphrey's song.  Here are two samples from All Good 2009:

40's Theme

The Floor

I'm currently scanning the rest of the All Good concert.  I plan to arrange a show poster with a thumbprint from each song.

The scanner uses JavaCV to interpret the video data.  I created a histogram of the colors in each frame.  I calculate the HSV coordinates for each pixel, and I tally the saturation, value and pixel count by the pixels' hues.  I only count pixels that are above a minimum value.  From the histogram, I pick out the most prominent color by finding the hues with the highest pixel counts.  I use the average recorded value and max out the saturation.

Then I use Python Imaging Library to plot the data in an image file.

Right now I'm really only plotting some parts of the true colors.  I maximize saturation, making the diagram as colorful as possible.  However, that removes white lights (as the color white has zero saturation).  So white lights can turn out yellow or brown on this plot  I'm still experimenting with the algorithm to see if I can capture white/grey lighting as well.

I'm pretty excited about how this is turning out.  I think I will place the colors as highlights on top of a black and white photo of the show.  Stay tuned for more updates as I arrange the poster.  If you have any requests for shows, please let me know.

Thursday, May 7, 2015

The Graphic Equalizer Display

The Graphic Equalizer Display is a device that shows the loudness of the music you're playing, broken down by bass, midtones and treble.  It uses a microphone, so any ambient sounds or music will be picked up.  Play the video below to see it in action.



Long ago I picked up a 16x32 LED display from Adafruit.  This thing was amazing, but I didn't know what I would do with it.  When I found this graphic equalizer chip on Sparkfun, I decided to put the two together.  The display uses a microphone, so any sounds or music can be picked up.  Total cost is about $100, but I can put together a bill of materials if there's interest.

This time I wanted to set up a permanent circuit; jumper wires and breadboards were unruly and would not be appropriate for the design I was aiming for.  I wanted everything to be self-contained, so the device could be mounted on my wall or sit atop a speaker.


Above is my prototype setup, connecting the display directly to the Arduino and using a breadboard to prove my circuit.  On the bottom of the breadboard you can see the MSGEQ7 chip straddling the divider and an electret microphone breakout.  On the top is a potentiometer to control the brightness, and a voltage regulator because I only had 9V adaptors.  I had to use a separate power rail between the display and the audio, because one was interfering with the other; the display uses the external regulator while the audio uses the Arduino's internal regulator.

Once the code was working, the result was pretty magical.  My code can be found on a bitbucket repository.



Above and below: circuit diagrams for the prototype shield.  The shield sits atop the arduino and allows you to plug in the display ribbon cable, the voltage regulator, the microphone, the potentiometer and the equalizer chip.

(If you're an EE and you're actually looking at the circuits, you might notice some resistors and capacitors connected in series.  I didn't have all of the right capacitors or resistors on hand, so I had to make due.)





  

Above and below: here is the prototype shield after about 12 hours of soldering.  This is the part I'm most proud of.  I thought everything came together well.

 


To package the thing, I used the plastic box from my first Arduino starter kit.  I think these things can still be found at RadioShack.  I crammed all of the electronics in the box and screwed the screen to one side.

The potentiometer above met its end when I tried to krazy glue it to the box.  Now it's just a resistor.  The MEMS microphone pictured didn't work out for this project; it couldn't pick up lower ranges, so I went with the electret.  The regulator is attached to an aluminium heatsink from RadioShack.


I dremeled openings for USB and VIN, made some room for the ribbon cable, and made openings for the potentiometer and the regulator.  I used some risers to screw in the Arduino.  This was my first project that wouldn't rattle around if you shook it.  The risers were pretty high, making for a tight fit.


Placing the shield on top of the Arduino


Screwing the case to the display


Attaching the ribbon cable


Front view


The heatsink is taped to the top.  It looks stupid but I didn't have a better place for it.


Here you can barely make out the blue pot on the bottom right for brightness control.

All in all this project took about 24 hours of work spread out over two or three weeks.  It was by far the most complex and rewarding I've done so far.  Many parts were frustrating, but the result is great.


Next up, I might include this with a bluetooth speaker.

I got a lot of help from J Skoba's use of the MSGEQ7 and Adafruit's instructions for their 16x32 LED display.