Turn tone output to AC sq wave instead of DC

How does one change 0~+3V to say, -1.5~+1.5V?

I want to drive a speaker, preferably amplified by simple transistors.

Try feeding the AC 0~+3V through a 100µF capacitor then to your speaker.

O.P. ---- Could you please explain the meaning behind 'instead of DC'? --- in the thread title "Turn tone output to AC sq wave instead of DC".

You can send a 0-3v square directly to your speaker and it will work fine .
When not sending it ,it’s sensible to sure the voltage is set at 0v to save power/ heating up the speaker .
As said you can remove the DC component by using a series capacitor , if electrolytic keep the + to the DC end .

You can use two outputs, make them the complement of each other when generating the tone. So when one is high the other is low. There are some tone libraries that do this for you.

See this post:- toneAC - Twice the volume, higher quality and frequency Arduino tone library - Project Guidance - Arduino Forum

hammy:
You can send a 0-3v square directly to your speaker and it will work fine .

Typically that jams the loudspeaker cone against the end-stop, so its not fine.

It works tho , try it

I know it works but you will only get half the possible cone movement. So it doesn’t work so well.