Ask HN: Why are modern music players so bad at playing music in random order?
On my phone I have a micro SD card with thousands of Mp3s on it yet I catch both Google Play Music and VLC player playing the same progression of music over and over when I have the random button set to on... I thought this was because it was a tactic to get me to upgrade the music players I was using, but it also happens lately on all kinds of devices I use.
YouTube, Spotify, and SoundCloud provide revolutionary services yet it seems like a lot of the time I am listening to pre-arranged and designated music playlists rather than a truly honest music stream.
In the days of the 5 disk CD changer, people truly knew what random meant. no tune was played twice until all of the tunes were played...
151 comments
[ 2.9 ms ] story [ 113 ms ] thread[S]ampling is typically done "without replacement", i.e., one deliberately avoids choosing any member of the population more than once. Although simple random sampling can be conducted with replacement instead, this is less common and would normally be described more fully as simple random sampling with replacement.
Ref: https://en.wikipedia.org/wiki/Simple_random_sample
Shuffle (mostly) used to do what you expected when you had a medium like CD with a small number of tracks.
As the number of available tracks grew, the definition became less and less obvious.
With a service like Spotify, you could design an entire multi-page specification to cover all the different possible "shuffle" options you could give users - all of which would be useful in at least some settings.
Instead of which users get one button and some guessing.
> no tune was played twice until all of the tunes were played
That is definitely not compatible with actual mathematical “randomness”. Try rolling a die multiple times and see whether you get all six numbers before repeats. It’s very unlikely (probability of all six rolls being unique = 6!/6^6 = 1.5%)
Which brings up the interesting question — what do humans actually expect from “shuffle” mode?
OP wants "Shuffle my playlist into a random order and then play it through"
You are thinking closer to "After this song is done, choose a new song at random among ALL available."
Spotify's is a mixture, while good offline clients tend to go to the first.
The term found on a lot of music players is not "random", it is "shuffle", and this is an important distinction. The term comes from cards. Take a deck of cards, shuffle it, and turn each card over in order from top to bottom. You expect that every card in the deck will be seen once and only once; turning up, say, two eights of clubs in a row means that something is dreadfully wrong with your deck.
Humans tend to expect a similar behavior from "shuffle" modes: the same song does not repeat for a while. If people are shuffling by song, then they may also expect that performers don't repeat within a (smaller) timeframe.
Nobody expects "pick a random number between 1 and numsongs, play that song, repeat, and be perfectly happy to play Baby Shark forty-seven times in a row if that number keeps on coming up".
Of course it is, the concept of randomness is much broader than you allow for. The specific issue you refer to here is if you are sampling with or without replacement - both are valid.
There is another issue which is the distribution you use. Should songs be equally likely to occur, or should the ones you've played more occur more likely?
You may also extend sampling strategies to genre, or to exclude repeated artists, or whatever - but all of these things could still be done via random sampling.
That doesn't sound random.
I use Google Play Music and it "randomizes" things in the way you desire. It takes your playlist and shuffles the entries; you can even press a button to see how it's sorted it. That ordering sticks around forever if you take no further action, though, so it will repeat that random ordering indefinitely unless you press the shuffle button to disable that, then start playing something, then press the shuffle button again.
https://en.wikipedia.org/wiki/Gambler%27s_fallacy
When I shuffle a playlist on Amazon Music, it wont repeat until the end of the playlist.
1. I want it to play in a truly random fashion, with replacement (same song twice in a row is possible).
2. I want it to play in a truly random fashion, without replacement (each song is removed from the list once played).
3. I want it to "seem" random (don't play too many songs by the same artist in a row).
4. I want it to be random, but predictable (same "random" ordering if I start the playlist again).
5. I want it to play my favourite songs more often than my lower-rated songs.
6. I want it to play my less-commonly played songs more often than the stuff I listen to all the time.
So: what exactly do you want when you say random?
I am indecisive about what music I want to listen to in this current moment and I want you to give me options that I will deny until I become decisive about what I want.
I mainly dont want to hear a playlist that starts with the same tune every time and then progresses through the same order of tunes when I select Random.
So often, in Google Play Music selecting random will play any of of 10 pre-set playlist cues.... The tunes will be a mix of one big polaylist that just starts at various points on the master playlist. This is why I often run across the same tunes, and why they follow each other in the exact same order.
e.g.
Normal Play Cue: A-B-C-D-E-F-G
Random is selected -
Random play attenpt 1. B-A-C-D-F-G-E (Several tunes present on the micro SD card never play)
Random play attenpt 2. F-G-E-B-A-C-D (Several tunes present on the micro SD card never play)
Random play attenpt 3. B-F-G-E-A-G-E (Several tunes present on the micro SD card never play)
I prefer the "Shuffle" feature I guess if you want to look at the semantic side of this discussion, where not tune is played twice or in the same order whenever the random button is pressed, and every time I press random, the player should recall the last tune, and pick a new playable tune each time the skip button is pressed or after the prior tune comes to an end.
The only quirk I've noticed is when the same person has multiple bands... I've had it play Jack White or Les Claypool 4 times in a row, for example.
I'd much rather have these sub-genres woven together with changing styles at each track boundary, as a sort of counterpoint.
If I can remember all the way back to when I used to make my own "mix tapes" transferred from vinyl records, I think I used to do this sort of interleaving. So, I think my preference existed before I ever experienced the shuffle of a 5 or 10 disc Sony CD changers, which usually changed discs on every track change and avoided any repeats until the entire set was done.
Because of my preference for shuffle, I used to burn a CD or two for use in rental cars, where I added a pseudo-random prefix to the file names. This gave me a shuffled play when the in-dash player was set to just play sequentially, so I didn't have to discover a random mode with repeats in one particular car...
I'll probably spend a bit more time trying to get Spotify to work as I want, but in general it's resulted in me just listening to less music. I guess that's good for Spotify, since they're still getting paid (but not if it makes be question why I'm still paying them).
“What is the best to listen after this track?” - just with a super small subset of tracks.
It also sparked a lively debate about whether people actually wanted what they said they wanted or were just being difficult.
People are weird and English is imprecise.
This could have the appearance of #4.
I hate the trend from product managers of responding to "wow there's a lot of things people might be intending here" with "let's just pick one in the name of simplicity." Give me the hooks to let me make my own solutions for the other possibilities!
You can have a script sitting on your machine remotely controlling an internet connected player somewhere else.
e.g. here's one I wrote that makes Spotify not play the same track too often: https://github.com/sl236/spotify-deduplicator
That can still be random, for as long as we're not defining the variable:
and then of course with the #2 variation on both variables.Easiest solution that gets you 99% there would be to make a shuffled list, run through the whole thing, then shuffle again. The only reason why this wasn't done in the past was lack of RAM, which isn't an issue anymore.
Or if RAM really actually is an issue on your embedded device, use a Debruijn sequence.
For me, random means: "I want to hear every song in this selection exactly once, chosen randomly". Random should mean uniformly distributed and I don't care whether the same artist or album is played back-to-back. I feel like this is exactly what "shuffle" has meant for decades before some UX quack at Spotify headquarters decided they knew better.
But this usually leads to people perceiving the feature as not being random enough.
See Spotify for example: https://www.quora.com/Is-Spotifys-shuffle-feature-truly-rand...
The hardware restrictions of the earliest IDE HD based MP3 players really have nothing to do with any limitations on modern shuffle ability.
IPod in 2001 had 32MB of RAM. 2k RAM is not relevant to this discussion. You getting close to discussing 3 decade old technology.
Using random number generators for shuffle mode was a stopgap measure that everyone else cargo culted because it's easier than critical thought.
So how about using a maximal linear feedback shift register of smallest size greater than the number of songs, skipping entries that are beyond the end of the list?
Either keep the polynomials[1] in a small list, or implement them as separate functions, invoking the one you need via a function pointer. Both approaches take just a wee bit of extra FLASH/ROM, and just a few bytes of RAM.
https://en.wikipedia.org/wiki/Linear-feedback_shift_register...
For example for a 1000 songs playlist, you choose n to be 2416648531, start with i = 0, you then get the following permutation: 0, 531, 62, 593, 124, 655, 186, 717, 248.
It's odd to hear that this is not standard, given that it's a standard algorithm. Maybe memory limitations?
I’ve definitely seen scenarios where I’ve heard the same random play order due to some fuckery with a car Bluetooth connection.
Lots of music players started out with true randomness and then dialed it back because people complained that it wasn’t very random.
Not that saying "random" is wrong, but users mostly mean it in a colloquial sense, while programmers are apt to interpret it in a technical sense. But one leads to math.urandom() and the other to shuffle algorithms.
I'll work on it when I can get a bit of free time.
Edit: Oh, and it is always on top, you are my favorite open source contributor.
Anyone outside of HN would interpret that as broken random. So we can throw it out.
> 2. I want it to play in a truly random fashion, without replacement (each song is removed from the list once played).
Nope, not good enough for non-specialist randomness.
> 3. I want it to "seem" random (don't play too many songs by the same artist in a row).
Bingo. It should definitely seem random. Because the string "seem random" equals "random" for someone who isn't a technical expert in randomness.
> 4. I want it to be random, but predictable (same "random" ordering if I start the playlist again).
Normies don't care about random seeds for pseudorandom number generators, so nope.
> 5. I want it to play my favourite songs more often than my lower-rated songs.
That's a bonus feature that can be implemented with a slider.
> 6. I want it to play my less-commonly played songs more often than the stuff I listen to all the time.
Same as above
> So: what exactly do you want when you say random?
One obvious definition for normy random, plus a slider with least and most favorited at the left and right, respectively.
Done.
We've come so far with UI design now that we can't have that.
Maybe it is not the way i’d order my playlist, but I trust Spotify knows their stuff. There must be a lot of engineering there.
Why not trusting the musical tastes of a robot, after all?
I do. 1 and 2 aren't even options. I have playlists with 100 or so songs in it. I don't hate that I can predict what the next song will be. Smart Shuffle is fine, so long as you don't say it's random and you offer an actual shuffle button that works the way shuffle has worked since the introduction of the CD player.
TL, dr: Bad product management, that didn't stop coders from featurecreeping
In that case, it's because random numbers generated by a computer are pseudorandom, or just generated by the exact same arithmetic sequence. For instance, here's a really bad pseudo-random number generator: Start with 4. Take the last number, divide it by 2, and if it's even add 5. If it goes over 100, subtract 100. (I didn't claim it was good.)
These pseudo-random number generators can be improved by providing a seed number, which means if you give it the same starting point it will generate the exact same sequence, but the key is giving it a random seed. Often programs provide the current time as the seed. My last MP3 player would have been much better if they did that.
Spotify does a much better job with actually randomly shuffling playlists. But the problem with Spotify is if you listen to, say, Wilco radio, it's not adventurous enough and keeps playing the same few songs over and over in random order until you get sick of all of them.
Spotify upped its game with the "daily mix" feature, but yeah, radio stations are kind of crappy right now.
Unless you specifically want to play the album versions, Apple is likely to give you the single.
While I'm on my soapbox, another tremendous annoyance I want to get rid of: "Deluxe" tracks. I'm so tired of scrolling through re-released/deluxe versions of albums to find the album with the original track listing. I don't want remixes or rough cuts in my random playlist. With all of the shallow marketing attempts at selling the same classic albums to the general public over and over again, the alternate tracks outnumber the original.
Eventually someone kindly wrote a plugin that did pretty much this using what we all agreed was the best way: the under-loved `grouping` tag. Caveat: I haven't actually tried it yet...
(Please file a Github issue if you try it but it doesn't work...)
If you search the Spotify forums, there are a few posts on the issue with no official answer from Spotify whatsoever.
And so what we've added is smart shuffle to actually make it less random - if you want.
Even though people will think it's more random it's actually less random and what it is, in preferences, there it is right there, it says smart shuffle allows you to control how likely you are to hear multiple songs by the same artist or from the same album in a row."
https://youtu.be/lg188Ebas9E?t=719
That theory also explained the disconnect between the complaints and Apples response. Apple would indeed be right that the music was randomized, but not continuously, as consumers expected.
It was never clear to me what the issue actually was, perhaps we really don't understand randomness.
My point being, even mathematicians might mistakenly believe that repeating a song or artist is less random. The creators of the Enigma machine were not dumb, but they believed that repeating letters would be more predictable and thus less random.
They did not allow a digit in the key to repeat in the same position 2 days in a row, I just reread. If the key was "123" yesterday, it could not be "145" today, because the first position was unchanged.
To this day I still wasn’t sure what was the purpose of that question? Was it to see how I think or did they really wanted me to come up with a way to create random playlist that satisfies their arbitrary definition of random
It seems like pretty much no matter what song I start listening to on YT, it eventually falls into a rut where I start hearing the same handful of songs that I've heard a million times. It's like it's too good at figuring out "what I like" and tries to only play songs it "knows" I like. Or more likely, since plenty of what I like are "deep cuts", it's just playing the most popular few songs by the given artist(s).
The order within a given session is probably shuffled up OK, but it still sucks from a variety standpoint because I don't want to hear "Eighteen and Life", "Round and Round", "Kickstart My Heart", "Livin' On A Prayer", "Rock You Like A Hurricane", "Fallen Angel", "Shot In The Dark", etc., day after day after day after day after day... as much as I like all of those songs.
It does seem to be at least somewhat genre aware though. If I start out listening to classical music, it doesn't jump to metal/rock, or if I start out listening to synthwave, it doesn't bridge to classical. But the problem I just described seems to exist within each genre. :-(
So…not random, then?
Since then I've not had it any service or software I use, it's the missing killer feature for me. I want "random"/recommended albums not recommended/random songs.