I am learning piano from a book and I can't understand the meaning of the phrases "playing on the beat" and "playing off the beat" and the difference between them. Can anyone explain them to me?
Assume you are playing in 4/4 time. For every bar there are 4 beats.
Playing 'on the beat' means playing a note at the same time as one of those 4 beats begins. If a bar has 4 quarter-notes in 4/4 time, every note would be played 'on the beat'.
Playing 'off the beat' means playing a note at some time other than the start of a beat. Imagine a bar that has 8 eighth-notes in 4/4 time. In this case, the first note is played 'on the beat', the second is 'off the beat', the third is 'on the beat', etc.
Every piece of music has a 'beat' -- noted by the time signature of the music. For instance, you may have a song that is in 4/4 time (4 beats per measure where each beat is a quarter-note). When you are 'playing on the beat', you are timing your playing so that the rhythmic emphasis of your playing matches the beat. This could simply mean that you come in on the downbeat rather than 'off the beat'.
Think of a stave of sheet music as a graph, where the Y axis is pitches, or the notes you play, and the X axis is time. Now in sheet music, time is not expressed as a strictly linear measurement such as fractions of a second; rather, it's divided into beats.
If you were to start up a metronome at a certain tempo and try to play a measure of piano music along with the metronome, you would try to strike each piano key exactly at the indicated time -- for example, a row of quarter notes. However, if you made an audio recording of this exercise, and you examined the playback of the recording, slowed down a great deal, you would discover that you are humanly incapable of hitting each note exactly in time with the click of the metronome, which measures the beat. Some notes you might hit a fraction of a second before the click of the mentronome, other notes you might hit a fraction of a second after the click on the metronome. This is what is meant by playing "ahead of the beat" or "behind the beat".
When we practice to play an instrument, it is good to practice with a metronome and learn to play as strictly in perfect time as we can. This takes practice and skill. However, in actual musical performance, an experienced musician will deliberately alter the playing of the notes to make some of them ahead of the beat or behind the beat. In pop music we call this "creating a groove". In classical music, it is called "rubato".
So first you have to learn to play strictly on the beat, with a metronome. As you get more experienced, you learn how to shift the timing of the notes either ahead of or behind the beat according to the musical effect you want to create.