Vu meter help

Hey Im trying to make somewhat of a VU meter. This code is ok but I would like to have a feeling of it responding to the intensity of the sound instead of just always cycling through the full array of LEDs. I am not a very experienced programmer so any help or amendments to this code would be much appreciated.

Cheers

int timer = 50;                   // The higher the number, theslower the timing.
int pins[] = {2, 3, 4, 5}; // an array of pin numbers
int num_pins = 4;                  // the number of pins (i.e. the length of the array)
int inPin = 12;
int val = 0;
void setup()
{

 Serial.begin(9600);
 pinMode (inPin, INPUT);  //sets the digital pin 10 to input
 digitalWrite (inPin, HIGH);

 int i;
 for (i = 0; i < num_pins; i++)   // the array elements are numbered from 0 to num_pins - 1
 pinMode(pins[i], OUTPUT);      // set each pin as an output

}

void loop()
{
 val = digitalRead(inPin);
 Serial.print(val);

 int i;


 if(val == LOW)  {
   for (i = 0; i < num_pins; i++) { // loop through each pin...
   digitalWrite(pins[i], HIGH);   // turning it on,
   delay(timer);                  // pausing,
   //digitalWrite(pins[i], LOW);    // and turning it off.

 }
}

 if(val == HIGH) {
   for (i = num_pins - 1; i >= 0; i--) {
  // digitalWrite(pins[i], HIGH);
   digitalWrite(pins[i], LOW);
      delay(timer);
    }
  }
}

A few points:

A VU meter is designed to display the amplitude of a audio (or other) analog signal. You are reading in a digital input pin which can only have a high or low value, so it's not clear what your program is actually doing. Assuming you have a audio signal you want to read you should be using a analogRead(pin) command.

Also to perform an analog input of a audio signal there will be external components needed to convert the AC audio voltage to a variable 0-5vdc signal that the processor can read.

Lefty