It’s been years since I dabbled with programming, but how hard can it be for these music app developers to make a random list of your songs, and pop every played song from the list until it’s empty and then repeat.
I remember reading decades ago how music player devs would implement proper random playback and people would complain that it’s not really random because it played the same song second time soon after the first. So the devs had to change it and make it less random…
Thats why some players have “random” and “shuffle”.
Random is truly random, it might play the same two songs multiple times back to back. Highly unlikely, but it might.
Shuffle has a thing built in that avoids a song if it has been played within X amount of time or plays. Some shuffles might have other criteria as well.
I remember reading this about the iPod, where they programed it to not play the same artist multiple times in a row or within certain number of songs of each other.
You wouldn’t even need to pop songs off the list, just shuffle, go through the playlist, shuffle then restart the playlist.
But the music app developers aren’t trying to give you true randomness. They’re using machine learning algorithms to try and guess what you really want.
Nothing does what it says it does anymore, everything’s trying to second guess you. I hate it.
Actually it’s worse. Spotify will explicitly tell you when you randomize your liked songs list that they play bands who pay for the privilege more often.
defgetNextShuffle(songs):
randList = random.sample(songs, k=len(songs))
for song in randList:
yield song
Didn’t include persisting it to storage for brevity. Only tricky part would be detecting when the source playlist changes and how to handle that. Personally I’d just append any new songs to a random position in the unplayed portion, while removal is obviously simple
It’s a single function call to randomize the order of a list in most randomization libraries. The hardest part would be to persist this randomized list across program restarts, and it’s not hard either.
Unfortunately, not Plex. Plex has the absolute worst fucking shuffle mechanism I have ever used in my entire fucking life. It will literally play things in the exact same order multiple times in a row like days later. And in the Plexamp app, it will literally not play past like the fourth track on any album.
I don’t think any of the ones I used are truly random, or there’s something else going on. I often just randomize my whole music library and it’s always pretty samey. It’s often the same songs coming up even though I have 100s and I know for a fact there’s songs that have never come up.
Hmm, if the songs never show up, it might be worth checking, whether they can be played when you select them manually. I’ve had it before where the particular music player didn’t understand the file format or the metadata of a song, so it just silently skipped it.
But yeah, otherwise that’s weird. Obviously, some of the more corporate music players will try to do weird stuff with how shuffle works, but there’s so many open-source music players out there, where I just don’t see why they’d bother to implement something else than randomized order…
This dude (famous for “do you guys not have phones?”) actually has a pretty good YouTube series on interesting ways to tackle programming challenges. He’s got one on randomness that I thought was pretty cool: https://youtu.be/2anY9ICA-Pg
It’s been years since I dabbled with programming, but how hard can it be for these music app developers to make a random list of your songs, and pop every played song from the list until it’s empty and then repeat.
I remember reading decades ago how music player devs would implement proper random playback and people would complain that it’s not really random because it played the same song second time soon after the first. So the devs had to change it and make it less random…
Thats why some players have “random” and “shuffle”.
Random is truly random, it might play the same two songs multiple times back to back. Highly unlikely, but it might.
Shuffle has a thing built in that avoids a song if it has been played within X amount of time or plays. Some shuffles might have other criteria as well.
The algorithm the grandparent comment suggests is equally random. It’s just that it’s a random sequence rather than a random selection.
I remember reading this about the iPod, where they programed it to not play the same artist multiple times in a row or within certain number of songs of each other.
Previous comment wants random order not fully random
You wouldn’t even need to pop songs off the list, just shuffle, go through the playlist, shuffle then restart the playlist.
But the music app developers aren’t trying to give you true randomness. They’re using machine learning algorithms to try and guess what you really want.
Nothing does what it says it does anymore, everything’s trying to second guess you. I hate it.
Actually it’s worse. Spotify will explicitly tell you when you randomize your liked songs list that they play bands who pay for the privilege more often.
def getNextShuffle(songs): return random.choice(songs)Vs
def getNextShuffle(songs): randList = random.sample(songs, k=len(songs)) for song in randList: yield songDidn’t include persisting it to storage for brevity. Only tricky part would be detecting when the source playlist changes and how to handle that. Personally I’d just append any new songs to a random position in the unplayed portion, while removal is obviously simple
MPD will do that if you enable the ‘consume’ option.
Uuuh, “MPD for Android APK can be installed from F-Droid”, nice.
Pretty sure that’s how most of them work…?
It’s a single function call to randomize the order of a list in most randomization libraries. The hardest part would be to persist this randomized list across program restarts, and it’s not hard either.
Unfortunately, not Plex. Plex has the absolute worst fucking shuffle mechanism I have ever used in my entire fucking life. It will literally play things in the exact same order multiple times in a row like days later. And in the Plexamp app, it will literally not play past like the fourth track on any album.
I don’t think any of the ones I used are truly random, or there’s something else going on. I often just randomize my whole music library and it’s always pretty samey. It’s often the same songs coming up even though I have 100s and I know for a fact there’s songs that have never come up.
True randomness has a lot more “clumping” than seems intuitive.
Hmm, if the songs never show up, it might be worth checking, whether they can be played when you select them manually. I’ve had it before where the particular music player didn’t understand the file format or the metadata of a song, so it just silently skipped it.
But yeah, otherwise that’s weird. Obviously, some of the more corporate music players will try to do weird stuff with how shuffle works, but there’s so many open-source music players out there, where I just don’t see why they’d bother to implement something else than randomized order…
The songs do work. I recently switched to symfoniun. Haven’t had it long enough to test the randomness but I’m liking the other features so far.
This dude (famous for “do you guys not have phones?”) actually has a pretty good YouTube series on interesting ways to tackle programming challenges. He’s got one on randomness that I thought was pretty cool: https://youtu.be/2anY9ICA-Pg