09 April 2013

bringing the beats

shot of the horribly messy
prototype hardware
Getting audio working on Lightwalker has been a huge pain. I played around with a few electret microphones (like this guy from sparkfun) and had some bad luck with getting it to do what I wanted. In fact, I couldn't get it to do anything worthwhile. I even went as far as switching to using my android phone as the microphone and sending volume commands to my arduino over bluetooth. Doing so requires you to calculate root mean square and count zero crossings and all sorts of audio processing that I haven't done before. Was really cool to play with and tweak. But, in the end, doing the calculations in software and sending over bluetooth turned out to be way too slow.

I ended up landing on using a spectrum shield from sparkun in conjunction with their electret micrphone breakout board. Thought the whole thing was shot when I got it. And then I realized their documentation is incorrect and you have to run the mic at 3.3v instead of 5v. Has been great since I switched it. I might end up switching to just using an MSGEQ7 instead of the entire shield, but this is fine for now.

Another challenge I ran into was trying to figure out how to make it deal with the quiet of deep playa and being on the edge of a major sound camp. Once again, moving averages to the rescue! By keeping a moving average, I can compare the current volume to the average and adjust what the peak is as I go. So, moving from a quiet environment to a loud one or vice-versa will allow the lights to react visually well in both settings.

Check out the video. The lights and music are a little more synchronized in real life, but you get a good idea.