Peter Frampton used a talkbox, which is essentially a speaker that vibrates into a tube, which goes into the guitarist's mouth. They shape their mouth, which changes the sound, which is outputted to a microphone and creates the "talking guitar" effect. You can get a similar effect if you use an electric toothbrush…