why 500hz? I haven't used the IDE, but the chip itself can do 62.5KHz with 8 bits of precision.
Its just that way with the arduino. If you use the Arduino analogWrite() function the PWM is at 500Hz. This is not a question of using the IDE or an external Editor, its in the libraries.
(Could be changed, but thats off topic)
Oh, and that circuit limits by cutting volume down when peaks are detected. It works in a completely different way to a couple of diodes. If you supply a constant current to the led, you get constant attenuation to all parts of a signal.
Diode-Limiters are usually sold under the name FuzzBox, MegaDistortion at shops for guitar gear.
Its true that using a combination of Led/LDR for volume-control is common practice (for instance the old-school "Tremolo" guitar-effect works that way), but just not adviseable with the PWM-noise coming from the Arduino. I can't recommend that for a good quality audio solution.