Quickly switch macOS' PowerChime
Just type git.io/nochime
to go here.
As far as I can guess, this sound appears only on MacBooks with USB-C charging port, so starting with 2015 MacBook.
I don't expect you using it often, so the script doesn't install on your Mac, it just runs and that's all
Open Terminal and run the following command:
curl -sL git.io/no-chime | sh
The script is harmless, transparent, and easily revertable (by running it again)
Annoyance
The sound of a charging cable being connected might be unnecessary and even annoying, because you already see the battery status right in your Menu Bar.
The weird thing is that macOS lets you easily switch, for example, the startup sound, but not PowerChime.
People might be sleeping
To remove PowerChime even with the lid closed...
Starting from Big Sur, the loudness of PowerChime depends on your system's volume. If it's muted — the charging sound won't play. Even with the lid closed.
For Catalina and prior, the charging sound volume has a fixed value — consider reading this article on how to change the charging sound.
> System Preferences...
> Sound
> Sound Effects
> 🔲 Play sound on startup