Ok, so here's a little experiment I did: I created a Random Play Song Mix and drew a chart, where you'd see the position of a few artists' tracks within that list would be.

https://docs.google.com/spreadsheets/d/1n--27Xr07Mvv2hCvoVlwmozzTgLVWUTtB0GaFJiuHjw/edit#gid=1199939011

As you can see those tracks aren't always well distributed along the time line (x axis). The first from the top has quite a few clusters, then long periods of no playtimer at all. Or the second would have nothing for a long time, then the two tracks within a relatively short period (well, that might be hundreds or even thousands of tracks, but close together relatively speaking).

I then took a stab at the algorithm as outlined by a Spotify engineer a few years back (https://engineering.atspotify.com/2014/02/28/how-to-shuffle-songs/). I'm not saying I'm implementing 100% accurately, as there's no reference code there. But the result is quite obvious:

https://docs.google.com/spreadsheets/d/1n--27Xr07Mvv2hCvoVlwmozzTgLVWUTtB0GaFJiuHjw/edit#gid=1528357602

An artist's track would be spread quite evenly along the timeline. The very popular artist towards the bottom seems to have more clusters than the others. I'm not sure yet what is causing this. Whether it's a lack of resolution or whatever. But if you have an artist which is so much more popular than others, then that's what you get :-D.

Would there be interest to give this a try? The "balanced" method would be much higher load on the CPU. On my Pi4 it takes about 2-4 seconds to shuffle 21k tracks, probably twice of what the simple Fischer Yates algorithm would take. I haven't really profiled it yet to see where most of the time is spent. But if you look at the code, then you'll see that there's much more processing going on.
_______________________________________________
Squeezecenter mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/squeezecenter

Reply via email to