Questions about this piezo... er... magnetic buzzer

Magician:
...so they would beep single tone when power is applied.

My doesn't do that. It doesn't turn sound into electricity; it only turns electricity into sound. I have a link to the datasheet in the first post.

DVDdoug:
The output "drops-off" at higher (or lower) frequencies

What does that mean? My piezo buzzer is rated for 2048Hz; that means that it is the loudest at that frequency, according to my tests. The datasheet has some chart for dB at certain frequencies, but it is hard to understand.

DVDdoug:
No, but you can use it to repel teenagers.

How did you make the "repel teenagers" a link? That 17kHz sound is very annoying to me; I don't think it's healthy to listen to it, either. I should try hear that sound every year, until the age I can't hear it anymore. Some people claim that mosquitos hate the 17kHz sound, as humans hate the screeching sound sometimes made by scratching fingernails on a bad blackboard.

I also made some [old] code for selecting a frequency with a potentiometer, then playing it on the piezo when a button is pressed:

const int piezo = 9;
const int button = 2;
const int led = 13;
const int pot = 0;
int toggle = 0;
int potval = 0;
int srl = 0;

const int numReadings = 50;

int readings[numReadings];      // the readings from the analog input
int index = 0;                  // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

int inputPin = A0;

void setup(){
  pinMode(piezo, OUTPUT);
  pinMode(button, INPUT);
  pinMode(led, OUTPUT);
  Serial.begin(9600);
  for (int thisReading = 0; thisReading < numReadings; thisReading++)
    readings[thisReading] = 0;   
}
void loop(){
  toggle = digitalRead(button);
  // subtract the last reading:
  total= total - readings[index];         
  // read from the sensor:  
  readings[index] = analogRead(inputPin); 
  // add the reading to the total:
  total= total + readings[index];       
  // advance to the next position in the array:  
  index = index + 1;                    

  // if we're at the end of the array...
  if (index >= numReadings)              
    // ...wrap around to the beginning: 
    index = 0;                           

  // calculate the average:
  average = total / numReadings;
  potval = map(average, 0, 1023, 32, 5000);
  if(toggle == LOW){
    tone(piezo, potval);
    digitalWrite(led, HIGH);
  }
  else{
    noTone(piezo);
    digitalWrite(led, LOW);
  }
  srl = potval;

  Serial.print("Piezo = ");
  Serial.print(srl);
  Serial.print("\t Pot. Value = ");
  Serial.print(analogRead(pot));
  Serial.print("\n");
}

For some reason, every time I press the button, Pot. Value (analogRead(A0)) starts to jitter very much in the Serial Monitor printout, and the buzzer plays a very jittery tone. To smoothing was desperate attempt to stop that, but it did no good. That is only when I press the button; otherwise, the values are reasonably smooth.