• Status Closed
  • Percent Complete
  • Task Type Bugs
  • Category Playlists
  • Assigned To No-one
  • Operating System
  • Severity Low
  • Priority Very Low
  • Reported Version
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by kobler - 2004-11-05
Last edited by bagder - 2005-03-09

FS#2381 - Song gets repeated at random playlist

Recorder 8MB, (flashed) Rockbox (daily build 041001)

Since about four months Rockbox repeats (playes twice
at once) - I guess - about every 50th song from a 9000
songs random played list.

Another thing with random play is, that I've got the
impression, that some files are prefered and some never
gets played. To be more precise: I usually only come up
to the first few hundred shuffled songs of my 9000
songs playlist before it gets reshuffled and some songs
are played very often, and others I'll never hear.
Is there any chance, that the randomizer has only a
limited resolution (less than 2^15 ?) or the maping to
the playlist index is incorrect?

Thank you.

Closed by  bagder
2005-03-09 10:32
Reason for closing:  Fixed
Project Manager

We've had several reports about repeated songs and badly
weighted shuffle, but so far nobody has been able to back
their claims. It has always turned out to be duplicate
entries in the playlist or just bad (human) memory.

Are you sure that some songs never get played? Have you ever
played the entire 9000 song playlist and remembered that a
certain song never got played?

I'll try to investigate this as well.

Project Manager

I have investigated the code and I have indeed found a bug
that was introduced about 4 months ago. I'm working on a

Thank's again, for all your efforts!

Are you sure that some songs never get played?

This isn't what I wanted to say. I have the impression, that
in the first few (let's say 200 of the 9000) there are
always a couple of songs, which gets prefered in the
shuffling to be at the upper/earlier position. I'm sure the
algorythm plays all files in the list, but several more
often at first. I noted down a few shuffles of nine songs:


All songs gets played, but e.g. never the first song at
first. Is there special code to achive this?

To realy be sure, one would need a method to get the list(s)
and make a histogram..

I guess a solution would be to only create a new seed for
the random generator and reshuffle, if the list is played
completely. I think now a new seed is generated every time
shuffle is switched on or a different playlist or another
file get's played. If we could keep the seed and a bookmark
for every playlist, every song would be played once, I think.

Project Manager

We (re)seed the generator when starting a playlist/directory
playback. The bookmarks store the seed, otherwise we
wouldn't be able to regenerate the exact same shuffle when
we resume. So the solution to the 9000-file playlist problem
would be to bookmark the position every time you want to
play something else.

BTW, I found a bug in the shuffle code that could make an
uneven distribution, and possibly even duplicates. I'm
working on it.

Project Manager

I believe this is fixed in the daily builds. Please try the
latest daily build and tell me if it works.

Project Manager
zagor commented on 2004-11-08 11:17

Even if the distribution was poor, I don't see how it could
cause duplication (repeat). Since the list is shuffled by
swapping tracks with each other, each track can only ever be
listed once no matter how bad random function is used.

Project Manager

The (supposed) duplication wasn't caused by the poor random
distribution, but a bug in the playlist shuffle code, that
could read outside the index array.

However, that bug could only cause at most 1 single
duplicate in the entire list, and only under special

I'd like to see if Thomas can verify if there really is a

Test the whole day with great pleasure :-) No songs played twice at once and I'VE GOT A NEW DJ! ALL NEW
MUSIC ON MY ARCHOS :-)!! Thank you! None of the usual
suspects came to my ears today! Rockbox played songs I've
never heared before. But I just managed to hear less than
100 songs from my big playlist this time, so I'll keep
testing .. :-)

still current buildt 041107 on Recorder8MB, shuffling big

Bad luck. I had two dublicates today. When the song started
the second time, I checked the display and saw it was song
number 32 of the playlist. Then I shortly pressed rewind
twice to go to the previous song. It displayed 31 and showed
the name of the same song and played it, too. Then I skiped
again to the next - and suprisingly I got a different song
(dis)played!! Strange..
I'll recheck this next time and try to get more info. With
the playlist viewer I can't see any dublicates at all.
But anyhow, the new shuffling/random is still very good!!

Project Manager

OK. This means that the duplicates don't come from a bug in
the shuffling, but from a bug in the code that fetches the
songs from the playlist.

still current buildt 041107 on Recorder8MB, shuffling big
It is even more strange: Song played twice, I paused, and
skipped back and forth through the songs:
14+15 are the same, 13 doesn't get played at all (always
skipped when skipping) 12 and 16 are normal. In the playlist
viewer the double played song (14/15) is only showed on pos.
14! 13 and 15 are different songs. If i selet the song 13
from the playlist viewer, it doesn't get played. If I select
it from file browser, it playes. I can even bookmark and
resume this twisted playlist. 12 playes, 13 is skipped, 14
playes, for 15 song 14 gets played, and 15 plays normal again.
This is all I'm able to figure out.

Project Manager

Can you save the current playlist and send it to me, along
with the original, unshuffled playlist?

linus at

/RockPop/Neil Young/Decade/22 Heart Of Gold.mp3
gets played
/RockPop/DZihan & Kamien - Gran Riserva/01 Stiff Jazz.mp3
gets skipped
/RockPop/Frank Zappa/ahead of their time/12 help im a
rock.mp3 plays
/RockPop/Queen/Live Killers/09 Now I'm Here.mp3
not played, but above one again
/RockPop/Alice/Non Ti Confondere Amico.mp3 ok
/RockPop/Heather Nova/Glow Stars/05 Glow Stars.mp3 ok

you cold generate all the mp3 files by copying a (very
small) mp3 file for every playlist file, if you need it for

for /F "tokens=*" %f in (RockPop.m3u) do copy small.mp3 "%f"

Sorry, forgot the checkmark for the file upload..

Sorry, attachment didn't work, next try..

Project Manager

I believe I have fixed the repeat bug now. Can you try the
latest bleding edge and tell me if it works for you. It
should no longer repeat any files.

Version 041119, Recorder 8MB

Created a long Playlist with every second song missing and
first tested with the buildt 041107 and bookmarked a
repeatedly played song. Than I roloed into 041119 and
started the bookmark. The song didn't got repeated anymore
and every missing song seems to be skiped without a problem.


Project Manager

Thank *you* for helping us find and fix these 3(!) bugs.


Available keyboard shortcuts


Task Details

Task Editing