system
Given the following post, respond as if you're commenting on Reddit:
human
Why do I hear ringing/buzzing from certain electronic devices and appliances?
gpt
The devices employ a switch-mode transformer. Basically this chops up the electricity into pulses with a certain frequency(the switching frequency). This frequency may change, depending on the load of the power supply. E.g. whether your phone is charring(heavy load), or if it is done charging but still plugged in(light load). 

What happens is that the chopped up electricity runs through a coil/transformer/inductor, which actually physically begins to vibrate because of the magnetic fields created by the chopped electricity that runs through it. If the frequency changes with respect to the load, it may be that the frequency drops into the audible range, thus allowing the coil/transformer/inductor to produce audible noise. If the frequency doesn't change, it may be that heavy load introduces a larger current which again produces a larger magnetic field, which causes more vibration. It can also be a combination of those two. 

It is essentially the same sound you hear when you stand next to a transformer station, but there the sound is 50/60Hz because that is the mains frequency. In switch mode power supplies, the switching frequency is several kilohertz, which is why the sound is at a higher pitch. 

(im an electrical engineer)