I'd like to know more about my phone's shuffle algorithm!
October 18, 2013 11:22 AM   Subscribe

When on shuffle mode, do phones try to play songs which sound better next to each other?

I've been listening to a large collection of music files on my Samsung Galaxy Rush phone. I use the default music player. It may be my imagination, but I could swear that the phone plays songs which are somewhat alike in terms of tempo or...amplitude?...the way that a radio station might play songs that sound well one after the other. I've checked the phones user guide, but all that it says is: "Shuffle all: Play all songs in a random order."
posted by goethean to Computers & Internet (12 answers total) 2 users marked this as a favorite
Response by poster: More information: my phone has this somewhat stupid music square feature, which categorizes songs as "passionate", "exciting", "joyful", "calm", which is what leads me to think that it might be able to do the thing that I describe above.
posted by goethean at 11:24 AM on October 18, 2013

Best answer: Can't speak for your phone in particular, but people often find patterns in random shuffle functions. "How random can it be if it played two Rolling Stones songs in a row?" they ask. But in fact, with perfect randomness, mathematically it is inevitable that this happen from time to time.
posted by kindall at 11:35 AM on October 18, 2013

Best answer: Put a library of music (100 tracks, say) containing just two opposing types, split evenly. For example, 50 tracks of "exciting" and 50 tracks of "calm". If Samsung is flipping a fair coin, you'd generally expect roughly equal odds of hearing an exciting or calm track, after hearing, say, 40 randomly selected songs. If, after listening to 40 tracks, one category is repeatably played more than the other based on your initial selection, then Samsung's software is not playing fair.
posted by Blazecock Pileon at 11:47 AM on October 18, 2013

Best answer: In general, totally random things tend to "clump" more than intuition would expect. My high school math teacher once gave us a very simple homework assignment - flip a coin 100 times and record, in a long column, whether it lands on heads or tails. He could immediately tell who actually flipped the damn coin and who cheated and just wrote "random" heads/tails, because the actual random coinflips looked something like this:


and the fake "random" ones looked like this:


The real coin flips have a lot more runs of 4, 5, or 6 of the same side than the made-up flips, which tend to alternate between one or the other, which "looks" more random but is really a more predictable distribution.

It could be that your phone really is somehow adjusting the order based on song characteristics, but I bet it's that dang flawed intuition of randomness just making you think it is.
posted by theodolite at 12:01 PM on October 18, 2013 [3 favorites]

Best answer: Generally, shuffle has meant to put the songs in a random order, sort of like shuffling a deck of cards. This is also what your manual says.

I think a good explanation for why the manual says nothing more than "Shuffle all: Play all songs in a random order." is because that's all that shuffle does.

Seems like if they came up with a wonderful new feature like creating harmonious playlists automatically they would want to advertise that, and that they would probably give it a name other than "shuffle".

People tend to see patterns in randomness. Try making a playlist of nothing but Enya and speed metal, then lie down and go to sleep on an Enya song, and see if you still feel like it makes such harmonious playlists automatically.
posted by yohko at 12:08 PM on October 18, 2013 [2 favorites]

Best answer: How varied is your musical collection? If you're bored or have time, tally your songs by those silly mood categories or in any other way that you could to identify ways that songs would be similar or dissimilar. Do you have that much variation in tempo, or is it more cohesive than you expected?

If you're even more bored, you could try to generate your own random playlist in a couple of different ways. 1) load the songs into a few different software players on your computer, then let those programs randomize the lot of songs, and evaluate the results, or 2) print off all your songs onto a sheet or sheets of paper, then cut up the page(s) so each song is on its own little tab of paper; toss these tabs into a bucket or shuffle them up in a pile, then close your eyes and start picking songs; place your picks in order from first to last until you have selected every song; evaluate your random selection process compared to your expectations and your phone's output.
posted by filthy light thief at 12:15 PM on October 18, 2013

Best answer: One note on coin flips versus a playlist: there likely more than two types of songs in your collection, so the selection process isn't as parallel to the either/or options of coin flipping. The more diverse your music collection, the more likely you are to have a really random selection. But if you only have Enya and Pantera in even amounts, you would indeed replicate the coinflip grouping style.
posted by filthy light thief at 12:17 PM on October 18, 2013

Best answer: Okay, so I just got my Samsung Galaxy S II out and made a playlist containing 12 songs. Six of the songs were quieter Southern-rock/country ballads (Alabama Shakes, Drive-By Truckers, Johnny Cash, Statler Brothers, Stompin' Tom Connors), and six of the songs were uptempo hip-hop songs (Beastie Boys, Macklemore and Ryan Lewis, Kendrick Lamar). I played the playlist on shuffle, recording the song and then hitting "next". I played 121 songs, for 120 song-to-song transitions.

Within my classification, there are four possible transitions: two like-to-like (country-country, rap-rap) and two crossover (country-rap, rap-country). One would expect about 30 of each transition.

Instead, I got the following results:
Country / Country: 25 (21%)
Hip-hop / Hip-hop: 24 (20%)

Country / Hip-hop: 35 (29%)
Hip-hop / Country: 36 (30%)
I'm not sure if the statistics are significant or not; I'd suggest multiple tests with multiple mixed-style playlists. But it is surprising to me that the like-to-like were only 41% and the crossover were 59% and that each direction was symmetrical.
posted by Homeboy Trouble at 12:30 PM on October 18, 2013

Best answer: A music player probably won't do a purely random shuffle for a few reasons. E.g., from "Blackbox Analysis of Shuffle Algorithms":
While the iPod mini was the only player which generated a uniform and complete coverage of the entire permutation space, it was also the only player to suffer from the possibility of song repetition. Given that the iPod mini we tested was released before the iPod Shuffle, it is quite possible that Apple has since changed it’s algorithm to the one utilized by the iPod Shuffle in response to complaints about repeated songs. Such an incident would probably only have to happen once before a typical user would begin complaining about QoS delivered by the product.
Also, iTunes at least has had settings that change the way shuffle works, e.g. from Wikipedia: "The randomness of the shuffle algorithm can be biased for or against playing multiple tracks from the same album or artists in sequence (a feature introduced in iTunes 5.0, and later discontinued in iTunes 8.0). iTunes DJ can also be biased towards selecting tracks with a higher star rating."

So yeah, it's a real possibility that your player is trying to do something fancy with its shuffle.
posted by jjwiseman at 12:42 PM on October 18, 2013 [2 favorites]

Best answer: I'm not sure if the statistics are significant or not; I'd suggest multiple tests with multiple mixed-style playlists. But it is surprising to me that the like-to-like were only 41% and the crossover were 59%....

Note that in your experiment, there are automatically 1/6 fewer "like" songs that can follow any given song, since a song is (usually) never repeated back-to-back. So you'd expect the results to be biased away from "like" and towards "cross-over".

... and that each direction was symmetrical.

This is what you'd expect if the shuffle algorithm was truly random: it wouldn't be biased towards one genre or the other.
posted by Johnny Assay at 1:08 PM on October 18, 2013 [2 favorites]

Best answer: FWIW, I have several hundred songs on my device. There are three songs that husband loves and I hate. He usually plays at least one of these songs when he listens to iTunes on rhe the desk top.

I have never gone more than an hour without hearing one of these three songs. If traffic is light I will skip.

Could be a coincidence. Could also be that iBrain gives them more weight.

FWIW, tbey are folky-type male vocalist tunes which is a top husband genre. i Brain may be dishing out a lot of this genre and I only notice those threes because they crack my teeth snd make me want to punch someone.

Have always doubted the shuffle is pure-D random in the literal sense.
posted by Lesser Shrew at 4:48 PM on October 18, 2013

Best answer: The problem with randomness
posted by Johnny Wallflower at 9:28 PM on October 18, 2013 [1 favorite]

« Older Can Software Help Me Keep Track of What I've...   |   Trustee won't distribute funds from the trust... Newer »
This thread is closed to new comments.