Music/Light Show Box, Feasibility Questions

Hi! My friend and I have started developing an Arduino project idea, and are having a little trouble fleshing out the details of how it will work. We are going to create a box with the inside faces coated in mirrors, and when someone looks inside while listening to the music that the box is playing through headphones, he will see a light show that corresponds to the music being played by mapping the range of sound frequencies to the range of light wavelengths. We could not find anything online much like what we were doing (most Arduino music light shows just sense major beats in a song), so we would really appreciate some input from some people more experienced than we are.

So a couple questions and problems arise when considering the idea. We want the lights to represent the full variety of different notes and beats happening every second in the song (not just have them all doing the same thing, or it being a chaos of changing colors), so at first we were thinking of separating a track into each of its instruments, and then having each of the five inner faces have a configuration of LEDs that is assigned to a particular instrument. However, we've discovered that such separation of songs into instrument tracks is quite difficult, so we considered just assigning a frequency range to each face, so that one would basically just be doing the greens, one the blues, etc. But this still leaves the question of how sensors will be able to "hear" multiple simultaneous frequencies or beats, so that it can send the different data to its respective places. Does anyone have an idea of how this can be done? It definitely doesn't seem impossible, we just aren't familiar with all the tools and techniques available to us. Thank you in advance; we appreciate it!

Detecting multiple frequencies at one can be done with something called the Fast Fourier Transform (FFT) and its cousin the Fast Harley Transform (FHT). ArduinoFHT - Open Music Labs Wiki The basic Arduino Uno can do a reasonable FFT on audio, but you also need to make a special circuit on the input side. If you really want to do this well you might look into one of the faster Arduino varients like the Due.

The issue you will run into is that most songs have a lot of every frequency as most instruments produce a lot of harmonics we don't consciously hear. You could likely make something that resembles the visualizer in your favorite audio player, but not much more and you certainly would have a hard time separating parts.

If you will have a limited selection of songs, I would make the Arduino trigger the sound playback via something like this WAV Trigger - WIG-13660 - SparkFun Electronics and have a pre-programmed light show that you would make on your PC in advance. A carefully designed light show would likely look much better than anything that is algorithmically generated.

Okay, that's very helpful, thank you! Would the harmonics be an insurmountable problem if we just created a simple song ourselves, so that we could already have it separated by instrument as we record it? We're entering this project in a competition in two months, and we feel like hard-coding a light show would basically be circumventing the part of the project that's supposed to be "impressive".

That's fair. The effect of harmonics and random noise will vary by the exact song you use. If you make your own music you could likely find something that would give you a clear correspondence between the FFT result and the audio you are hearing. You may have particularly good results with synthesizers and other electronic sounds where you can control the harmonics of the instrument. I would start by looking at the spectrogram of various songs. If you can easily see something interesting on the spectrogram then you stand a chance of interpreting the music into light.

If you're making your own song, why not make your own light show? The connection between the song and the light can be done outside the arduino in an algorithm of some sort or hand coded...

You might want to investigate the MSGEQ7 seven band graphic equalizer. It won't give the precision of an FFT but for your purposes it might be cheap both computationally and finanically. I used one with a cheap microphone and an LM386 amplifier to drive different color LEDs through an Arduino.

There are exellent on-line tutorials to show you how to use this device. A very good one is http://tronixstuff.com/2013/01/31/tutorial-arduino-and-the-msgeq7-spectrum-analyzer/ but there are others.

Two issues I had using this device:

  1. There seems to be some residual noise in each of the bands. I thought this might be due to the microphone but even wiring the MSGEQ7 directly to a music source did not eliminate it. I used software thresholds to silence this noise so that the LEDs would not turn on during periods of silence.
  2. Ideally, I would like the microphone to respond to a wide range of input levels adaptively. By this I mean if the room is very quiet, I'd like relatively quiet sounds to trigger a big response. In a noisy room, I'd like these quiet sounds to trigger little or no response. My attempts at a simple automatic gain process weren't very successful.

Okay, thank you so much! That's definitely the type of thing I need.