There are two parts to this question. One comes under the heading of 'grand', the other 'upright'.
Getting a good sound from the piano starts with having access to a good piano.
Some pianos have a rather 'sour' sound, that doesn't sound good to the ear, and neither does it to the microphone. You will never get a good recording of a sour piano.
(And even if you visit a piano showroom full of new pianos, you will undoubtedly find some that are a little more sour than they could be.)
So, assuming you have a good, clean-sounding piano, next make sure that it is in tune.
A piano might sound adequately in tune, but pianos have a strange ability to drop uniformly in pitch across the keyboard. So the piano will be in tune with itself, but not with other instruments. A quick visit from a piano tuner will sort all of this out. (And remember to ask him to come back every six months at the most.)
So, let's start with the upright piano.
Sound comes out of an upright piano from four sources...
Some sound will penetrate the wooden case, but it's the direct sound from the strings or soundboard that you want to capture.
The next step is to experiment and see where the best sound is coming from. Every situation is different and there is no one 'correct' way.
What you will find in addition is that if you place the microphone towards the right of the instrument, you will get higher levels in the high notes. Place the microphone to get the best balance between good clean high notes and a rich sonority from the low notes.
Now the grand.
Sound comes out from the strings reflected from the lid, and from the soundboard underneath.
So you might consider pointing the microphone at the lid, from the perspective of a seated listener at a piano recital.
Note that when you listen to a piano in the normal way, you can't see the strings. So to replicate this experience in a recording, the microphone shouldn't be able to 'see' the strings either.
But there is more to it than that.
If you experiment with the height of the microphone from below the top of the casing to a position where the mic is angled down at the strings by about 45 degrees, you will discover a range of sound qualities.
Also if you move the microphone around the curve of the casing you will find sounds that range from sharp and incisive, to mellow and sonorous.
So in summary, you don't just point the microphone at the piano, you experiment with a range of positions and find the placement that suits you best.
Here's a video that we made in Abbey Road Studio 3. The pianist is Chris Franklin...Come on the FREE COURSE TOUR
Great home recording starts with a great home recording studio. It doesn't need to be expensive if you know how to select the right equipment for your needs.