Random randomness

This summer I was looking to buy an MP3 player. I wanted something simple & cheap. My only requirements was that it would have a flash card slot and FM radio, and that it’d be small. The only place I was planning ot use it was at the gym. I ended up making an impulse purchase at costco and I got myself this one: http://www.rcaaudiovideo.com/Cultures/en-US/ModelDetail.html?PCI=Lyra+Flash+Players&ProductID=RD1080

It’s not so bad, but there’s one thing that’s been bugging me.

As you would expect, it can play your songs in random order. Only, the random sequence is always the same – it always plays track 14, 43, 42, 26, etc, where track numbers are based on the order the files were added to the device. This rather defeats the purpose of getting more memory for it; I’ve put all my good songs on one card, but since the random sequence is always the same I still hear the same songs in the same order every workout session. Changing songs on the card regularly is not an option, that’s too much work.

Solution: I wrote a little command line utility that takes a folder name, and changes the order of all mp3 and wma files in that folder. It:

  1. Creates a temp folder on the device;
  2. Moves each song file, prepending the file name with a random number;
  3. Sorts the list of files in the temp folder based on file name;
  4. Moves the files in this sorted list back, one by one, restoring the original file name
  5. Removes the temp folder.

It’s really quite easy. Since I’m moving – not copying – it’s pretty fast, and I don’t waste disk space. Every now and again, I’ll just run it against the flash card and – hey presto – the randomization has been randomized.

To do: see if I can do something with autorun.inf so all I need to do in the future is plug the player into the USB port.

 This posting is provided “AS IS” with no warranties, and confers no rights.

Comments (5)

  1. Brian says:

    Does flash memory have a limited number of writes? It’d be a good idea to shoot whoever designed that ‘random’ system so they don’t infect anyone else.

  2. Far as I know, it actually is random. Might be, each and every player of this model ever made has its own hardcoded random sequence…

  3. Not that this matters, but if you ever want a really good blash-based player, check out the MPIO from DigitalWay. I got a FL100 about a year ago, and even though their documentation is written in Engrish, it’s a great product. It takes SD cards (which I love — my digital camera takes them too, so it was a bonus), has an FM receiver, and can record using a built-in microphone or one plugged into the headphone jack. It really rocks. The random order stays the same between turn ons/turn offs, but it changes if you turn off random and then turn it on again.

    Again, not that it matters.

  4. Pontus says:

    Yes, compact flash cards provide a limited number of writes (exactly how limited is frequently debated).

    But the beauty of a device with upgradeable firmware shines through here – from the description, it seems bugs like that have been fixed in the current firmware they provide in their download section.

  5. Hey, fancy that! The page with fixes in the firmware update, http://www.rcaaudiovideo.com/Cultures/en-US/RD1080RD1090_Firmware.html, says "The random play feature allows a more random song selection".

    "More random", that’s funny.