Controlling Speaker Output with Transistors
you shouldn't output a digital signal from the arduino. 
Instead connect it to one of the pwm pins and use analogwrite to 127 when you want to play a sound and use the setPwmFrequency method to adjust the frequency you want to play on the speaker. 

Actually outputing an ac signal will probably fix your loudness issue as well. 

A capacitor between the speaker and the transistors is a good idea. and you should also put a resistor on Q1 so that you leave the transistor in a saturated state which will keep it from getting hot and burning out. the 1k resistors on the base is a good value.