# A Better Playlist Shuffle Algorithm Is Possible

When listening to music, most of us reach for the shuffle button on the regular. This is then followed by a bunch of frustrating skips as we hear the same four or five tracks that have been regularly replayed for the last few days. [Ron Miller] wants to fix unsatisfying shuffles, and he’s developed the Miller Shuffle algorithm to do so.

[Ron] realized that many big name streaming services use incredibly simple algorithms to choose shuffled songs. This can often be as simple as songIndex=random(NumOfSongs). The problem with this is that even with a good random number source, you’ll get a lot of premature repetitions. If your music service doesn’t keep track of your shuffle-point between sessions, you’ll often get annoying repeats if you’re listening on a day-to-day basis.

To fix this, the Miller Shuffle algorithm aims to offer good randomness and no repeats without the excess resource usage of the commonly-cited Fisher-Yates algorithm. [Ron] explains it like this: “The way the algorithm works its magic is by utilizing multiple computations which are ‘symmetrical’, in that the range of values which go in are the same values which come out albeit in a different order.” Since its a deterministic fixed list, there’s no need to keep track of what songs have already been played to avoid repeats. Instead, the player must simply step through the index in order, one track after another. As long as a referenced index point is maintained, along with an ID of the shuffle order being used, no repeats should come up.

If you’re implementing a shuffle algorithm for your own music, you might want to give [Ron’s] work a look. He’s taken into account details like resource usage and small and large list sizes, to account for implementation issues for even very large streaming services. If you’re more interested in shuffling cards than songs, though, we can help there too!

# Linux Fu: The Linux Shuffle

Computers are known to be precise and — usually — repeatable. That’s why it is so hard to get something that seems random out of them. Yet random things are great for games, encryption, and multimedia. Who wants the same order of a playlist or slide show every time?

It is very hard to get truly random numbers, but for a lot of cases, it isn’t that important. Even better, if you programming or using a scripting language, there are lots of things that you can use to get some degree of randomness that is sufficient for many purposes. Continue reading “Linux Fu: The Linux Shuffle”

# IPod Shuffle Headphone Remote Reverse Engineered

The headphone remote for the third generation iPod shuffle has a special chip that identifies it to the iPod itself. [David Carne] posted an in-depth report about the process he used to reverse engineering that protocol. He’s discovered that the remote uses a peculiar signal to identify it as authentic when the device powers up. We’ve talked about Apple’s use of peripheral authorization before and it seems this is no different. [David] did manage to emulate the authentication using an ATmega88. If you’ve got a shuffle 3G sitting around this info will allow you to operate it with a microcontroller in your next project.

# 3rd Generation IPod Shuffle Teardown

You should all know the drill by now. New electronics hit the market and someone has to post pictures of it spread open bit by bit. The new shuffle is no different as iFixit shows us. There are some very nice pictures of the entire process. As you can see, most of the space is taken up by the battery. The thing that is probably most striking here is the main problem that many people have with it; there aren’t any buttons.

[via Makezine]

# Replacing The Ipod Shuffle’s Headphones

[blip.tv ?posts_id=1878228&dest=-1]

With the recent announcement that the only controls for the Ipod shuffle will be on the headphones, many were let down. [James] has come to the rescue, showing that you can just solder new ear buds on the end of the wires. Though this may not be the perfect solution, especially if your cable gets damaged, at least you can get a little better sound. This is a great example of something to show kids. It’s not too difficult and teaches them that if we’re not happy with something, we can hack it.

# Card Shuffling Machine Failure

Breaking from his usually routine of winning at everything, [Glacial Wanderer] has posted one of his projects that didn’t actually work. It’s a Rube Goldberg style card shuffling machine. He wanted something that was visually interesting while still randomizing the cards. A blower would be mounted to the top to mix the cards similar to a lottery ball machine. The cards would then drop into a chute that would make sure all of the cards were oriented correctly before being presented to the user. After building the first prototype, several problems were apparent. The first of which was the fan not being strong enough. His interest was waning and it looked like the time he’d have to invest in fixes was growing quickly, so he decided to cut his loses. He still posted about the prototype in hopes that it could help someone else exploring this sort of machine. A video of the mechanism can be found below.