"Click"-noise on note start

Exactly.
Looking at your code, you tried to put a simple LPF-like smoothing, which theoretically would work. But the problem is, even if the PWM carrier ramps up to full volume, the arduino output itself is still jumping directly to 5v.

I had the same problem with my synth. The problem could be solved by having the output centered on the middle of the output range, rather than just adding waveforms to 0. Add a capacitor in series to nix the DC offset, and the middle PWM value will become the new "0" point.
This was actually a problem for me, because no analog LPF's can filter out all of the carrier wave. I ended up getting a nice SPI DAC, since I use my synth for my electronic music-making, and the PWM wave, albeit inaudible, messed up recordings.