The sound of an electric guitar is created by the vibration of the strings over a pickup, which transforms the vibrations into electrical signals. These signals are routed into an amplifier, which amplifies the music and outputs it at various volumes.