Electronic keyboards have been around for decades now, and many early models were equipped with sounds labelled 'piano'. However, most made a mockery of the true sound of a piano, and could not be considered as serious alternatives to the real thing.
The key, as it were, to the digital piano revolution, lies in the technology known as 'sampling'. This involves recording the sound of a real piano being played, sometimes one note at a time and at multiple dynamic levels, and then replaying it when the keys of the electronic keyboard are struck. The quality of the samples used varies considerably, and the price you pay for your piano will be significantly affected by the investment that has gone into creating the original sound - to a large degree, you really do get what you pay for.
Kawai CN-31 R Digital Piano
Very high quality microphones, pre-amplifiers and other recording equipment are used to collect the samples for the best digital pianos. The art lies in recreating the actual response of a piano key when it is played - the sound must be true and consistent, whether you are playing softly or with vigour.
In the age of sampling, even relatively low-priced digital pianos can sound convincing and play well - often better than real pianos of an equivalent price. They also typically offer more than one type of piano sound, so you can select one to suit the mood - a grand piano for some introspective noodling, a bright upright for a good old sing-song.
Whatever your preference, sampling technology has made it possible for most of us to afford a good sounding piano, and to keep one in even a small apartment. Digital pianos may not become collector's items, but they are helping people of every age and ability to make music.