How to calculate the needed psu for my project.

Feffe76:
The relays are Songle SRD-05VDC-SL-C.

The only data on those relays I can find says "Coil power: 0.36W, 0.45W". So the coil current @ 5v should be no more than 73mA, and 8 of them would take less than 600mA when all on. The power dissipation in the 7805 assuming a 12v supply will be around 4W if it is only feeding the relays. This is well within the capability of a 7805 in a TO220 case if you give it a reasonable heatsink.

I know from experience that when a regulator goes into thermal shutdown, ripple on the input is passed to the output, so this could explain the humming that you hear. The other possibility is that the power supply is not able to supply the 600mA current without producing a very large ripple. However if the power supply is rated at 1A then that should not be the case. It might be worth measuring the output voltage of the power supply when all 8 relays are on.