The piano produces sound with strings, which are struck by internal hammers connected to the piano keys. The strings are suspended along an internal metal frame, and the sound is amplified by the wood of the piano. Pianos are "dynamic" instruments, meaning that the volume is controlled by how hard the player strikes the keys.
Keyboards produce sound electronically, and notes are produced by depressing the keys to trigger a predetermined note and sound. All keyboards have the ability to connect directly to an external amplifier or recording device, and the sound can be varied by electronic means on the keyboard or an external device. Keyboards do not require microphones for recording.
Since a piano's string frame is very large (the width of the piano keyboard), recording requires two or more microphones placed in key locations to pick up the sound of all piano notes. Placement of the microphones vary according to to the particular piano, player technique, recording room, the type of microphone and the recording engineer's personal preference based on experience. Generally, two microphones are placed on either side of the piano, with the microphones directed toward the string frame. Sometimes, additional microphones are used and are placed farther away from the piano in an effort to capture the ambient sound of the room. In addition to microphone placement, the quality of the microphone has much to do with the recorded sound. Quality studio microphones can range from several hundred to thousands of dollars each.
The soft, medium and loud dynamics of the piano can present problems while recording. If the recording levels are set to capture the lower-volume tones, the levels will be too high when medium and higher-volume tones are played. Recording studios often employ the use of a dynamic compressor and limiter when recording pianos and other acoustic instruments, including voice. A compressor "evens" the sound by making low-volume sounds louder, and loud-volume sounds softer. A limiter "limits" the loudest sounds to prevent recording levels from becoming too high, which causes distortion.
Keyboards are designed to sound even and balanced whether amplified or recorded, and require few special recording techniques other than setting the correct tone and recording level. Even digital pianos or keyboards with "weighted" or "touch sensitive" keys (to provide piano-like dynamics and key feel) are limited to their minimum and volume dynamics. Compressors and limiters are also used for some keyboard recording applications to even out the overall sound, but their use is not as important as when recording acoustic instruments and pianos.
Pianos and keyboards (even digital piano keyboards made to sound as close as possible to an acoustic piano) are totally different instruments. Electronic keyboards offer a simpler setup and do not require microphones. For this reason, owners of most small home studios prefer keyboards, which also offer the advantage of "silent" playing and recording with the use of headphones. Pianos do not offer silent playing capability, require expensive microphones for best results, and the use of compressors and limiters.