The Arduboy lib has two sound objects, one operating on pin 5 and the other on pin 13. Does that really work? One can send a simple square wave on either and the single buzzer beeps that tone. And if both pins send their own frequency, some kind of mean wave will operate on the piezo element, creating a sound with both frequencies audible?
Tone can specify that it's to be played at either normal or a higher volume. High volume is accomplished by taking advantage of the speaker being wired across two pins and toggling each pin opposite to the other, which will generate twice the normal voltage across the speaker. For normal volume, one pin is toggled while the other is held low.
Piezo Speaker
Two pins, A2 and A3 directly drive a piezoelectric element inside of a small black plastic housing. Caution there is no circuit protection these pins: Theoretically there could be some problems with driving both pins as outputs, we suggest configuring one pin to input. In practice this has not caused any issues to date but please comment if you have any issues!
They are constructed more like a capacitor with no DC resistance, just an AC impedance. If you apply a voltage across a discharged capacitor you'll get a high current demand and you are stressing the arduino’s output pin. That's why a resistor is useful (to stay below the 40mA). But because the camel's back is robust (@MarkT ™) , it's usually not a problem
I just avoid stressing the component above its "absolute maximum ratings" in the datasheet, leads to predictable outcome and no worries.
Maybe the chip can take it - but to prove that means characterizing it which is a
time-consuming and tedious process which has to be repeated everytime new
silicon is released - best to leave that to the manufacturer unless its economically
worth it to you. One resistor is easy, cheap, and might save you from other issues
like someone replacing the piezo with an 8 ohm speaker!