Alternative to Arduino tone() method
There's the Melody example on the Arduino site that just uses digitalWrite to quickly toggle the I/O pins:

void playTone(int tone, int duration) {
  for (long i = 0; i &lt; duration * 1000L; i += tone * 2) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(tone);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(tone);
  }
}


The main disadvantage to this over other methods such as using a timer output is that your code will be stalled while the tone is being played, and if you have background interrupt activity occuring you may end up with a few anomalies in the tone.