Taiko2k / Tauon

The music player of today! :city_sunrise:
https://tauonmusicbox.rocks
GNU General Public License v3.0
1.64k stars 64 forks source link

Shuffle algorithm. #1078

Open mihnt81 opened 6 months ago

mihnt81 commented 6 months ago

So I've noticed a weird, I don't know if it's a bug, but it's definitely undesired behavior. Just added a few new albums to the collection this past week and I did what I normally do and put my whole library on shuffle when I'm listening to music. I leave it running at night for sleep time music in the same manner.

Today I was looking through play counts and on one of the new albums I added, one track has 30 times played and another from the same album has 10. None of the other tracks in my library have a playcount higher than 7. No, I have not manually played the songs as I literally just leave it on shuffle whenever I am using it.

What's up with this behavior? Is it intended? RNG bad luck?

Screenshot from 2023-12-31 11-18-49

Here's that album isolated:

Screenshot from 2023-12-31 11-23-02

Taiko2k commented 6 months ago

The intended behavior is that every track in the playlist should play exactly once before repeating (excluding any tracks you manually play). So if you run this experiment unattended from scratch then no track should have a higher playcount than one than any other track.

So it does seem like a bug from what you've said. Are you able to determine more of what is going on, like:

mihnt81 commented 6 months ago

The intended behavior is that every track in the playlist should play exactly once before repeating

This did not happen even without this anomaly. I had lots of tracks that had played multiple times with about, I'd say, 40% of my library not played yet.

Did it randomly play a track in full 30 times in a row

It didn't happen while I was awake as I would have noticed that happening, lol. Could have happened when I was asleep.

Did it spontaneously record 30 plays but didn't actually play that much

Would the file not being in that location cause it to do this?

I have no idea on your last two of your list there.

agichim commented 4 months ago

Hi,

I can confirm this behaviour. My thought was that the algorithm needs improving, but of course, it can be a bug as well.

I can't exactly tell the pattern by which some tracks play more than others. I'll try to keep a closer look and report back.

I wonder if something like an option to have a track be disabled automatically after it played could be a momentary workaround if this algorithm bug seems difficult to solve?

agichim commented 4 months ago

So was just having a look. I sorted the songs by playing count. Here's a good example. image

These songs are among 253 songs in a playlist. There are other songs that never played as well.

Using Tauon version 7.7.1 from AUR.

Taiko2k commented 4 months ago

@agichim were you also playing from Jellyfin or are these local tracks?

Also some clarification on what the intended behavior is assuming no bugs:

agichim commented 4 months ago

All tracks are local.

Thanks for the specifics on how shuffle and play counts works. It's good to know. I'm not sure about the first two, I need to pay attention when playing music, but the last one, where each track should play once before repeating doesn't seem to happen. But I understand that I can't base it off of the play counts to know whether a track is being repeated and other is not being played at all.

I will make a new playlist with less tracks and try to diagnose it.

Will let you know.

agichim commented 4 months ago

So, here are some news.

The playlist is 1 album which contains 18 songs. The option for the playlist to "Stop playback" after all songs were played was checked or activated but it didn't do that, it kept playing. This list is the shuffled order in which the songs played. Will explain what I marked.

  1. Mother I Sober
  2. Auntie Diaries
  3. Rich Spirit
  4. Rich (Interlude)
  5. Mr. Morale
  6. Worldwide Steppers
  7. Savior
  8. Father Time
  9. Crown
  10. Die Hard
  11. N95
  12. United in Grief
  13. Savior (Interlude)
  14. Mother I Sober
  15. Purple Hearts
  16. Count Me Out
  17. Silent Hill
  18. We Cry Together
  19. *Mirror
  20. Crown
agichim commented 4 months ago

Just now played a playlist with 1 song only and it repeats instead of "Stopping playback".

agichim commented 4 months ago

Another update.

I played this 5 songs which are in the same folder. Double-clicked on the playlist, the first song marked in the screenshot played twice in a row.

image

Taiko2k commented 4 months ago

Currently shuffle plays continuously and overides "Stop at end of playlist", that's expected behavior as it is.

Currently shuffle only avoids repeats for songs selected by song transitions, so the first song you play won't count for shuffle avoidance. The feature was intended to generally avoid playing the same track but not strictly so. One could argure this should be changed as a bug/feature request so that user selected tracks do count.

agichim commented 4 months ago

I understand. So it would seem in my playlist of 18 songs no song was repeated. Interesting. When I used to have Windows I was using AIMP. I only have a general feeling the shuffle was good and perhaps the first song that would play when first playing a playlist wouldn't get repeated. I think that behaviour is more favourable.

I will try now a playlist with more songs, see what happens.