Ok, let me see if I understand this.
The tone() function outputs a 50% duty cycle square wave at the required frequency. I can connect this directly through a resistor to a speaker and get the tone to play. The wave toggles between 5V and 0V, so the 'ground' is 2.5V.
The midpoint of the voltage divider is what's amplified by the op-amp. I want to drop this down so I get an output voltage from the op-amp that induces a current through the speaker which won't cause the speaker to exceed its power rating. So, I want the voltage at the divider to be Vout / 20, where Vout = sqrt(0.25W / 8Ohms).
The low pass filter filters out the higher harmonics of the square wave, (ideally) leaving a clean sinusoidal signal at the frequency at the square wave. Is this just to produce a better quality output by getting rid of unwanted harmonics or is it integral to the operation of the circuit?
I'm assuming the input to the op-amp would still oscillate between 0V and Vout/20?
As the op-amp isn't ideal, there is a slight voltage difference across the input terminals which is amplified. This needs to be removed, hence the series capacitor in the output. Will it also cause the signal to oscillate between -Vout/2 and +Vout/2 (instead of 0 and Vout), hence protecting the speaker?