Varying Buzzer Sound Intensity

Is it possible? If yes, how? I tried using this kind of buzzer. Red wire is connected to analog pin. I used the code given below.

#include <Wire.h)>
void setup()  { 
} 

void loop()  { 
  fadeValue = 255;
  while(fadeValue >= 0)
    analogWrite(A0, fadeValue);          
    delay(1000);            
    fadeValue = fadeValue/5;                
  } 
}

I hear the same intensity of sound every second for 5 seconds.

    analogWrite(A0, fadeValue);

A0 is not a PWM pin.

Normal Arduino boards do not have an analog output.

There is a library that can set a volume for a tone. It does that by changing the PWM signal. It is not a 'real' volume, but it can be useful.
http://playground.arduino.cc/Code/ToneAC

I somehow don't get the toneAC library.

Can you tell me what pin should I use for output?

Sorry for the very late reply.

Can you tell me what pin should I use for output?

Any PWM pin (usually noted with a ~ on the board itself).

I have both input and output values for other pins that is related to PWM. They will not be affected, will they?

ToneAC is something special, it used TIMER1, and it used both the outputs of TIMER1 to double the maximum volume. The piezo tweeter should be connected to those two pins. You can't use PWM output that uses TIMER1.
That are a lot disavantages, you have to consider that when making a project with it.

To answer your question, you have to tell us more. Which Arduino board ? Why do you want to change volume with a beeper ? Do you want only 2 volumes, or maybe in about 10 steps ? What is your sketch ? How are the other pins connected ?

I am using Arduino Uno board. I want to change the volume of the buzzer because the sound it produce is really high, it does not match our project.

I need only 1 volume, constant. Other pins are connected as inputs, simply inputs. Pins 6-9 are inputs for a push button. Pin 10 is for logic input from external circuit. Pins 12, 11, 5, 4, 3, 2 is for LCD. The rest are available pins.

You can use a resistor in series with the piezo. For example 100 ohm or 1000 ohm.

The ToneAC is too complicated for this.

That would help lower the sound of the buzzer? I've read the code given in the link above, and I thought it was the frequency of the buzzer that is changing. Or I get it wrong?

I don't understand your question.

To lower the volume, use a series resistor.
I assume you use the normal Arduino 'tone' library.

The ToneAC uses a trick with the PWM signal, that result in something that sounds like a lower volume. But ToneAC is too complex for this.