I think it can be a few things and sometimes foam doesn't help or cure it completely. Like I lined my Alt with neoprene foam above and below the pcb and it did absolutely nothing

For me I think it comes from the springs in my heavy switches. Because if I remove a switch I can get the same pinging sound from the switch squeezed between my fingers, it's just softer without the aluminium to reverberate through.
So definitely try lining the case with foam (sorbothane is best but wowee it's expensive) but it might not totally fix it, in which case lubing the springs can help dampen it. It's a tricky problem to solve sometimes though.