Using audio as an input

So, I am super new to electronics, arduinos and this sorta stuff. But essentially what I am looking to do is plug an aux cable into my sound board and then cut the end off of the opposite end and use the audio output as input for my arduino. With the audio input I am looking to control RGB LED strips. Basically what I need help with is, how would I capture the audio as an input to use as a numerical value and then how I would use that value to control an LED.

Need much more detail:-

With the audio input I am looking to control RGB LED strips.

Addressable strips or non addressable?

how would I capture the audio as an input

You get the current voltage level of an audio input by using:-

input = analogRead(anPin);

But what do you want to indicate on the LEDs? Frequency components? Volume? Beat?

You connect an audio input to an Arduino like this:-

Audio Bias.jpg

Audio Bias.jpg

how would I capture the audio as an input to use as a numerical value

An Aux/Line-level (or loud headphone level) is around 1V and that's about right for the Arduino's 0-5V ADC input. However, the Arduino can't read the negative half of the AC audio signal, and in fact the Arduino can be damaged by negative voltages. The standard solution is to [u]bias the input[/u] at 2.5V with two equal-value resistors and a capacitor. The two resistors form a voltage divider and the series capacitor isolates the bias from the audio circuit while letting the audio through. (You can leave-out the the 47nF cap.)

You can run the [u]Analog Read Serial Example[/u] to see what kind of numbers you get. With the 2.5V bias, silence should read about 512 and audio signals will read above & below that.

And, you'll generally want to subtract-out the bias and either ignore the negative values, or use the absolute value.

The readings will "look random". If you want to learn how digital audio works and why the readings appear random, [u]Audacity Website[/u] has a nice introduction. If you just want to read the "loudness", you can read in a "tight loop" (take out the delays), ignore the sample rate, and find the peak every 50-100 milliseconds.

and then how I would use that value to control an LED.

Depending on the LED strip, you generally need a transistor or MOSFET for each color.

As far as the software, that's really up to your imagination. The simplest effect turns a light on when you're above a preset threshold. (But because of the nature of the audio waveform, you'll have to "hold" the LED on, 'till the next reading/peak etc.) Or, you can make the light blink-on when the signal is above average.

I save a reading once per second in a "circular buffer" 20 element array that holds the past 20-seconds of information. Then I can use the peak or average from that array as a threshold or reference, depending on the effect. By saving a moving average, I can make it adjust automatically to loud songs, quiet songs, or volume control changes, and I don't need a sensitivity control.

If you want to use the frequency content, there are FFT or FHT libraries.

The effects I've made just use "loudness". I have chasing/sequencing effects, a VU meter effect, an effect that pops-up a random pattern on the beat/loudness, and a few others. My effects vary randomly with random variations of each effect.

Yes, sampling an audio signal and performing FFT to create a display on an LED strip is possible, and the techniques described above are important (biasing the input voltage upward, blocking the DC voltage, etc.). I created a relatively simple circuit for my Lumazoid board that does all this. It also has sensitivity control so that it can accommodate a wide range of input signal strengths without amplification. This is accomplished by adjusting the analog reference and the top end of the input bias circuit with a voltage divider pot.

The hardware design and software are all open source.

Lumazoid web site