If you just want to use it like a normal VU meter, or if you just want to control the brightness of the LEDs based on the amplitude, you can use a circuit like this:

This can only be used if the audio input signal is less than 5V peak-to-peak (2.5V peak), otherwise you may kill the Arduino. Most normal audio sources like a computer or a smartphone are safe, but you have to be careful when using the output of a headphone amplifier or a professional audio mixer, for example. The last thing you want to do is connecting it directly to the speaker output of an amplifier. If you want to protect the Arduino, you could use a clamping diode to ground, and a 5.1V zener.
The first thing you have to do, before connecting an audio source, is uploading the AnalogReadSerial example, and setting the potentiometer so that it reads 512.
This is the code I use to drive 8 LEDs connected to a shift register like a VU meter. It can be easily adapted to use it with your LED strips.
#include <math.h> // for log10() function
const float Vref = 0.775; /* https://en.wikipedia.org/wiki/Decibel#Voltage standard: 0.775V = sqrt(600Ω · 1mW) = 0dBm = 0dBu (reference for professional gear)
* Most professional gear uses +4dBu = 1.228V (professional line level)
* The consumer audio reference is 0dBV = 1V
* Most consumer gear uses -10dBV = 0.316V (consumer line level)
*/
const int thresholds[8] = { -20, -15, -10, -7, -5, -3, 0, 3 }; // what LED should turn on at what amplitude
const float decay = 0.5; // dB per refresh (higher = more responsive, lower = smoother)
const int latchPin = 8; //Pin connected to ST_CP of 74HC595
const int clockPin = 13; //Pin connected to SH_CP of 74HC595
const int dataPin = 11; //Pin connected to DS of 74HC595
const float Valref = 1023.0 * Vref / 5.0; // an analog value of 1023 is equivalent with 5V, so convert the reference voltage to an analog value.
void setup() {
Serial.begin(115200);
pinMode(latchPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(dataPin, OUTPUT);
}
float dBOld = 4; // if you set it to anything > thresholds[7], you get a nice startup animation :)
void loop() {
uint32_t AmplitudeValue = 0;
for (int i = 0; i < 128; i++) { // average of 128 readings
int centered = analogRead(A0) - 512; // don't use other functions or operators inside of abs()
AmplitudeValue = AmplitudeValue + abs(centered); // sound is AC, and an amplitude of 0 gives an analog value of 512
}
AmplitudeValue /= 128;
float dB = AmplitudeValue > 0 ? 20 * log10(AmplitudeValue / Valref) : -999; // convert to logarithmic scale (logarithms are only defined for strictly positive numbers) https://en.wikipedia.org/wiki/Decibel#Field_quantities_and_root-power_quantities
dB = dB < (dBOld - decay) ? dBOld - decay : dB; // meter falls down smoothly
dBOld = dB;
Serial.print(AmplitudeValue);
Serial.print('\t');
Serial.print(dB);
Serial.println(" dB");
byte shiftVal = dBToVU(dB);
digitalWrite(latchPin, LOW);
shiftOut(dataPin, clockPin, MSBFIRST, shiftVal); // write to shift register
digitalWrite(latchPin, HIGH);
}
byte dBToVU(float value) {
byte result = 0;
for (int i = 0; i < 8; i++) {
if (value > thresholds[i]) {
result |= 1 << i;
}
}
return result;
}
What the code does is basically calculating the average voltage (VRMS) then converting it to dBm (or dBV, depending on the setting) and then limiting the decay. You could probably add a more advanced peak detector if you wanted to, but it does a pretty good job displaying the level.
In blue, you can see the V
RMS, and the output in orange.
If you want a real spectrum analyzer, like this, you'll need a chip like the MSGEQ7 mentioned by Grumpy_Mike, or you could use the same circuit as above, and do all processing on the Arduino. In the case of audio, a Constant-Q Transform would be more appropriate than an ordinary FFT, since our hearing is logarithmic (a FFT would work as well, but you'd need more frequency bins to get the same result).
The latter option is much easier and cheaper on the hardware side of things, but the software part is quite hard and involves some difficult mathematics.
Pieter