Distorted Sound from Keyboard Project in The Arduino Starter Kit

Hi, I am currently working on the keyboard project (#7) in the official arduino starter kit. However, with 3 out of the 4 keys the sound turns on and off quickly when I hold the button (sound is not constant). I changed all resistors and wires but I am still getting the same effect. Then I saw the video by Massimo Banzi doing the same project and he is also getting the same effect when pressing the higher frequency button. Here is the link to the video: http://www.youtube.com/watch?v=BQxAvhNnMeo (skip to 6:30 to just hear sounds). Why is this? Is it fixable? I attached my code just in case although I checked it several times. Thanks.

_7_Keyboard.ino (498 Bytes)

Well I fixed my problem but I am not sure why this fixes it. I unplugged the arduino from the computer and powered it with a 9V battery and problem solved. I then unplugged the battery and powered the arduino via USB again and I got the same issue. Why does power via USB cause this?

USB only provides 500mA, 9V battery thru onboard regulator can provide up to 800mA. Maybe the design needs more current?

Or, maybe the Serial.print statements interfere with smooth output. Try turning it off connected to the PC.