What Is This PCB Component? (Sonos Play 5 Gen 1 Speaker)
That is the transformer of the power supply. Sometimes these vibrate mechanically at the operating frequency, which emits a typical coil whine. The sound may also come from other parts

It depends how you intend to fix it. That is most likely a custom part so you can't simply buy a new replacement transformer. You could find a identical device that has a working power supply and change the transformer, but sounds like you should get someone with experience to change it so that the device is still safe to use, as that transformer converts mains voltage to safer low voltage.
Another solution is to simply spray some lacquer on it, but the chemical must be suitable for it so it does not melt the original lacquer and short the coils.

Opinion based, will not answer.