Driving a speaker with an Arduino pin...

The simple ckts described are good for "buzzing", not for audio quality. If you
want the latter, the minimum cktry will be an LM386 amplifier [not the best sound
quality], being fed from an Arduino PWM channel through a 2-stage low-pass filter
with maybe 10-Khz 6db cutoff.

And then you use high-freq PWM, at least 100 Khz and 7-bit resolution, and modulate
its duty-cycle using your audio waveform. Then, it might sound like something other
than buzzing.