I am learning piano from a book and I can't understand the difference between swing and shuffle. I have searched, but I still can't understand the difference. Could someone please iterate the difference between swing and shuffle?
[I'm addressing 'swing time' and 'shuffle time', not 'swing style' and only indirectly bearing upon 'shuffle style'. Ulf raises a very useful distinction between these, I think.]
Swing covers a broader range than shuffle, which is a sort of crystalized swing.
If you start with strict time,
then squeeze the off-beats a little closer to the following beat you get swing.
Duh. da-Duh. da-Duh. Like a heartbeat.
If you squeeze further, the stretched beat and the squeezed beat approach the ratio of 2:1, so you can notate it with a quarter note and an eighth note. This is often notated at the top of the chart, eg. 2 eighth notes equals 1 quarter plus 1 eighth, then the music itself is written with straight eighth notes and you must add the swing to it.
Shuffle is a special case where the swing time coexists with a straight time and a good drummer will keep changing the emphasis between the two. Often written 12/8, it is 4/4 time. It is also 3/8+3/8+3/8+3/8 tie.
Bippity Boppity Bippity Boppity.
I suppose the difference, in my opinion, boils down to: swing merely squeezes the off-beat closer to the following beat; shuffle does this and also adds the middle note, locking the triplet in place. A piece can swing harder, approaching a dotted eighth plus a sixteenth. Or a piece can lightly swing, perhaps like a dotted eighth plus a regular eighth. But you cannot shuffle any more or less; you're either doing it or you're doing something else.
Let's divide the question into (A) playing with a swing or shuffle feel, and (B) performing music as in swing or shuffle musical genre style.
(A) Playing with swing or shuffle feel means to play with swung eighths1 (or to employ "triplet feel" eigths) - which means that the first eighth of a beat gets a longer duration than the second. Also off-beats are generally emphasized, or syncopated. Performing this is conceptually pretty much the same for swing and shuffle music.
(B) The difference between performing music as swing, and performing music as shuffle, I'd say, lies in that you'd expect different styles of accompaniment. I.e. if you just hear a phrase played solo with swung eighths, and/or some other trait of swing or shuffle timing/phrasing/emphasis, you can't necessarily tell whether the song is performed as swing or shuffle (unless the phrase uses phrase elements typical of jazz/swing or of some shuffle genre). Especially since a soloist can be very free in the timing of the swung eighths. But when you add accompaniment you can tell by the style the drums, guitar, and piano (or other accompanioning instruments) are playing.
For instance swing drumming could typically be played
So when playing the melody or a solo on the piano you don't need to worry too much about the timing in terms of it being swing or shuffle; just find a swung eighths timing and syncopation that you feel "swing".
However there is no universal definition on what swing nor shuffle is so you'll likely get different answers from everyone you ask.
Someone wrote "Shuffle is the swing of the blues" and maybe that statement can give some guidance.
1The swung note value can be other note values than eighths - such as sixteenths - but eighths are the most common.
Swing can differ a lot depending on the musician. Listen to the 8th notes of 50's swing and you'll find it's very jumpy. It's rather achieved through time values. Swing these days is different, it's more achieved through changing note volume (you can play straight 8ths but emphasizing every other 8th and it will sound sort of like swing, practising this will make it more natural and subconciously you might change time values, too).
In general you have to make out for yourself what kind of swing you want, and just practise it by listening to the musician that has the swing you want.
Whether music "swings" or not is almost entirely independent of the duration of the eighth-notes. That said, it's very rare that music that truly swings treats a pair of eighth notes as a quarter-eighth triplet; more often, that's a recipe for sounding like Lawrence Welk, or a mediocre high school jazz band. There certainly are exceptions - and performances in the shuffle style constitute many of these exceptions - but even with those exceptions, the duration of the notes is not what makes the music "swing." Swing has much more to do with articulation and accenting, and focusing on these - but still in a mostly intuitive way, not over-thinking with a specific intention for each note - will be much more conducive to creating music that swings than focusing on the duration of the eighth notes. You have to listen to a lot of music in the style you want to play, and focus on getting the music you play to "feel" like the music you're listening to.
Good answers from @luser and @ulf. In some genres, the terms mean something slightly different. For example in traditional fiddle music, "shuffle" and "swing" mean the same thing except that a "fiddle shuffle" is the fiddler playing the roots of the chords but swinging them while "diggin in" -- playing with strong bow pressure.
And "swing fiddle" means playing Texas old-time or traditional swing music.