|Summary:||iTunes’ available song ratings of 1 to 5 stars allow users to quickly find their favorites and help the Party Shuffle feature play more of what they like most. This article explores the algorithm iTunes uses to pick what comes next in the playlist.|
|News Post:||“Playing Favorites”|
After hearing one artist played over and over during a shuffled play of your entire music library in iTunes you may think your player has a preference of its own. Apple claims the iTunes’ shuffle algorithm is completely random The shuffle algorithm chooses songs “without replacement.” In other words, much like going through a shuffled deck of cards, you will hear each song only once until you have heard them all… or until you have stopped the player or selected a different playlist.
iTunes Party Shuffle2 is a different matter. Its algorithm selects songs “with replacement,” meaning the entire deck of cards is reshuffled after each song is played. The play higher rated songs more often option does exactly what it says, but how much preference is given to higher rated songs?
To test the option’s preference for 5-stars, I created a short playlist of six songs: one from each different star rating and a song left un-rated. The songs were from the same genre and artist and were changed to be only one second in duration. After resetting the play count to zero, I hit play and left my desk for the weekend. To satisfy a little more curiosity, I ran the same songs once more on a different weekend without selecting the option to play higher rated songs more often. Monday morning the play counts were as shown in Table 1.
The play counts in the random trial were very close to each other, as can be expected with a random selection. For the rating-biased trial the preference algorithm appears to be linear from 12% to 27% for the rated songs. Moving from the 5-star rating downward, the linear preference declines around 4% with each step down in rating, but doubles over the drop from 1-star to unrated with a fall of 8%. While one star may seem like the lowest rating, no-rating proved the black sheep of the lot.
Changing the number of songs within each rating will change these probabilities. With multiple songs of each rating, the chance of a song with rating r coming up next in the ratings-biased party shuffle can be calculated using the equation in Figure 2.
With iTunes’ preference probabilities for each rating determined from the trial, the resulting equation is:
Although the higher rated songs are given preference, you will not definitively hear more 5-star rated songs than all other ratings. Most people follow a bell shaped curve for their ratings, with the 3-star rating being the most common. Table 2 displays a hypothetical iTunes library with this bell shaped curve for the rating song count. Figure 4 displays the resulting probabilites after running these hypothetical numbers through the equations above.
As you can see in Figure 4, the chance of a rating coming up next in the playlist is greatly determined by the song count within the rating. The iTunes preference for higher rated songs and dislike for lower rated songs only slightly lowers or raises the probability determined first from the song count.
These chances of hearing a certain rating can be applied to find the chances of hearing a particular song. If we remove the song count from the numerator in Figure 3 we can calculate the chance of a certain song coming up next, not just the rating.
About a month after running these tests, I noticed my iTunes party shuffle at work played the same song two times in a row. This was the first time I had noticed a consecutive repeat and I checked the playlist. Not only did I find Nirvana’s Territorial Pissings listed twice in a row, but AFI’s Death of Seasonswas listed twice in a row three tracks later. I use the play higher rated songs more often option, but these were each middle-of-the-road 3-star songs in my song library of nearly 4000. The odds may seem outrageous at first, but not if you consider just how many songs you hear throughout a workday. If I average ten hours at work each day and a 3.5 minute song duration, odds say I should hear another consecutive repeat in less than a month.
Many claim to still see patterns as iTunes rambles through their music collection, but the majority of these patterns are simply multiple songs from the same artist. Think of it this way: If you have 2000 songs and 40 of them are from the same artist, there is always a 2% chance of hearing them next with random play. So right after one of their songs finishes, odds show a 50% chance they will play again within the next 35 songs and a 64% chance they will be played again within the next 50 songs. This can be calculated using the following equation:
It’s simply the mind’s tendency to find a pattern that makes you think iTunes has a preference.
- Levy, Steven. “Does Your iPod Play Favorites.” 31 January 2005. http://msnbc.msn.com/id/6854309/site/newsweek/ Accessed 4 June 2005.
- Hofferth, Jerrod. “Using Party Shuffle in iTunes.” 22 August 2004. http://ipodlounge.com/index.php/articles/comments/using-party-shuffle-in-itunes/ Accessed 4 June 2005.