How does the shuffle algorithm in the Music app and in iTunes actually work?

I have a large amount of music that I grouped together from various artist into a single playlist (770 songs and growing). I would like to try to listen to the whole of the playlist from start to finish on a shuffle without repeating the music in it until all songs have been heard. However, in the Music app on my iPhone, this is nearly impossible as the app itself may crash before I hear it all. There is 2.4 days worth of music non-stop and I would likely listen to 1-3 hours a day. If the app is closed or the phone turned off, then the playlist restarts and reshuffles itself such that I start to repeat songs. In this process I find that some music starts to be "liked" more by the program and gets played more frequently while other songs are "disliked" as they never got played the first time through. So my question is primarily how does the algorithm work. Does it play songs that have been played more frequently or does it play songs that are not played as frequently or does it truly randomize the playlist such that all songs have an equal chance of being played? Furthermore, the real question is to do with not allowing the Music app be reloaded. Is there a way to start the playlist and have the app know where the music was playing if the app crashes? This way I can get through the whole playlist and actually listen to all the music within it. Also with this, I have recently begun to think that when I shuffle the playlist the whole playlist isn't within the shuffle. That is, I slightly believe that several songs up to over half of them are left out of the shuffle and may not be played even if I were to make it to the end. So is that the case as well, does my shuffle keep some songs out?

Posted on May 9, 2017 3:17 PM

Reply
3 replies

May 30, 2017 12:05 PM in response to marsh771989

I can't address how the "Music" app works — I have a 160MB iPod Classic and I, too, have had issues with how the iPhone now (and for some time) has handled music playback.


That said, I do have a solution to playing an entire playlist in its entirety without it repeating any songs. I've been doing this for over a decade now and I have some 10.4K songs in my library as of this writing. This system works using multiple devices. I use two different iPods (a classic and a second generation nano), iTunes itself, and, once upon a time, I used my iPhone (until I grew to dislike the interface to the degree that I do now).


Here's how I do it:


1) Create a smart playlist, and instruct it to contain only songs played before March 29, 2017 (the day should be whatever date you want to begin listening to your playlist, and needs to begin on a date after the completion of your last cycle, which, in this case, would need to be March 28, 2017).


2) Make sure that your iTunes preferences are configured to sync playback information across devices (whether through the store or through home sharing).


3) Make sure that the playlist is set to "live updating."


4) Name the playlist. By way of example, I'm going to call my hypothetical list "itunes list".


5) Duplicate the playlist (or build another). I'll name this next one "iphone list".


6) Determine how much drive space you want to (and can) devote to music storage on the device (i.e., the iPhone). I have 48.25GB free on my phone. Based on that, I'll open "iphone list", and I'll check the "limit" box, which should, by default, read "Limit to 0 items selected by random." [The number and two words in bold are the criteria you can choose for this sorting option.] I'm going to change "0" to "40", "items" to "GB", and I'm going to leave "random" alone.


7) Connect your iPhone to iTunes. Deselect all playlists and other music that you may currently by syncing to your phone. Select the "iphone list". Make sure that it has no option to play music other than the music on your playlist will be stored locally once you sync your phone.


8) Repeat if necessary. I have a list limited to 1.8GB for my iPod Nano (which I use when I run). My iPod Classic is large enough to hold my entire music library, so it uses the same list that iTunes uses.


If everything works properly (which I will not guarantee since I'm not familiar with the "music" app), whenever a song is played, it should be updated to reflect its last playdate and, at that point, "kicked off" of the list. When you sync your iPhone with iTunes, iTunes will update its library and it will remove those songs from the master playlist (and any other satellite playlists that you've set up will no longer be able to select those songs).


There may be times when the Music app crashes, and, in cases like those, it may not remember what songs were played and when (the same can happen on old school iPods, too). Your mileage may vary, but, in terms of best practices, start a playlist on your satellite device after a fresh sync to iTunes and use "pause" to start and stop the list. If you use "stop", or if you command it to "play" the entire list again, there is always the chance that the app may not have removed the songs that you've already played from the playlist. Even if you have not exhausted the playlist when you return to your computer, sync your iPhone to iTunes religiously. The songs that have not been played will remain on your device. The songs that have been played will disappear, and new songs, that have not yet been played during the cycle, will replace the ones that have been played.


I wish that this system worked as flawlessly as it did under iTunes 6, but it no longer does. Apple has done too many weird things to iTunes that can complicate playback—especially during the last two or three dozen songs. Still, that's the best system that I've found to date, and it should insure that the same group of songs aren't available for the Music app to choose.


I hope that a similar system might solve your problem even though it my reply doesn't directly address the algorithm issue, and, regardless, I do hope that you find some solution to your problem that is more elegant than not.


Happy listening.

May 30, 2017 12:05 PM in response to Nathan Walters

Thanks for that. I think this would work, but the latest version of iTunes doesn't seem to allow the playlist to have dates attached. As such, the songs get played and remain in the playlist rather than kicked out. Besides that, the fields on the smart playlist are limiting rather than inclusive, or so I think based on what I was able to generate with it. I was able to added music to the list that is in the category that I wanted (Monstercat albums) based on the rule: Album (contains) "Monstercat." However, if I add a second rule then the list gets limited by the combination of the two rules such as rule: Artist (is) "Grabbitz," who has other albums that aren't related to Monstercat directly. This rule adds to the first and makes the playlist only contain Grabbitz songs that are under the Monstercat albums (my playlist goes from 803 songs to 8 songs). I think this is a brilliant way to make a playlist, but I want it to have rules that work separately from each other like a rule "includes but is not limited to." I'm not sure how you would do that; likely I don't know what I'm doing here and iTunes is cutting me off for stupidity. And on the algorithm, it would be great to know but the real question is the fix to prevent it from meddling with my playlist. So, thanks for the general thought; hopefully I'll find another way to fix this or a second explanation resolving my inabilities.

May 30, 2017 2:15 PM in response to Nathan Walters

Alright, so I figured out how to do this. Though the date options don't exist, there is a limit option. Under that I can limit the number of songs to a number (25 for example) and then tell it to only choose the "least recently played." If the live update were on, then it keeps 25 in the playlist at all times, but kicks out the songs that were played recently. To get the playlist to have the right songs in it I set the rule as: Playlist (is) "Monstercat," where Monstercat is a new playlist that contains all the potential songs I would want in the playlist. This allows me to add whatever music I want to the playlist while excluding other music and not having it do an additive effect of rules. I am not sure if it will properly update on the Music app on my iPhone, but theoretically it will. At least it works right on iTunes itself. So, this is how to do it with the latest version of iTunes. Thanks again Nathan for the help to start me off towards the answer.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How does the shuffle algorithm in the Music app and in iTunes actually work?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.