Computer keyboards don’t produce sound—they send signals to the computer, which plays audio via speakers/headphones.
Electronic musical keyboards/synthesizers generate sound internally:
Sound depends on selected patch, effects, and engine type (sample-based, FM, virtual analog, etc.).