FS#5837 - song ratings / auto-DJ

Attached to Project: Rockbox
Opened by Scott Scriven (ToyKeeper) - Friday, 18 August 2006, 01:04 GMT
Task Type Feature Requests
Category Playlists
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No


Feature request: song ratings and semi-intelligent auto-DJ

(note: I'm willing to help implement this, or even implement it myself
if pointed in the right direction. I've used this rating/DJ approach
for years on my desktop, and have found it works well.)


The basic idea is simple -- let users rate songs, then use that data to
play better songs more often.

This is incredibly useful for anyone who likes to put a large number of
songs on shuffle.


The implementation is relatively straightforward. Whenever the player
needs to choose the next song, it should compare the song's rating to a
random number and, if the random number was higher, skip the song and
try again. Songs with higher ratings have a smaller chance of being

Note that this approach only makes sense with "repeat all" or "repeat
shuffle" mode. Otherwise, skipped songs would either fall off the list
without being played, or simply migrate to the end of the playlist.

Also, though this concept is compatible with play-in-order (shuffle off)
mode, it would not normally be very useful when used that way. It works
best in shuffle/random mode.

As for ratings, I suggest using values from 0.0 to 1.0. This is simple,
universal, and has nice mathematical properties. For example, squaring
or cubing the song rating before comparing it to the random number
effectively makes the auto-DJ more picky -- better songs play even more
often, and the worse songs play even less often.

Though 0.0 - 1.0 allows very specific ratings (0.6254, for example), the
current rockbox range of 11 steps (0 to 10) should be sufficient...
simply use 0.0, 0.1, 0.2, ... 0.9, 1.0. This maps nicely onto 0 "stars",
0.5 stars, 1 star, 1.5 stars, ... 4.5 stars, 5 stars.

With no curve applied, a song rated 0.7 would have a 70% chance of being
played when encountered in the playlist, and a song rated 0.2 would have
a 20% chance. The better song is 3.5 times as likely to be played.
However, using rating**3, the probabilities are 34% and 0.8%, making the
better song 43 times as likely to be played.

Rockbox already has a WPS feature to display song ratings. The existing
scale of 0 to 10 can be used to display stars or other rating images.
However, it has no feature to let users modify song ratings. Some sort
of interface would need to be added, and a keypress or menu to invoke it.

I suggest providing at least two rating modes, and possibly more:

- harsh (rating ** 3): plays better songs much more often than worse ones
- regular (rating): plays better songs more often, but only somewhat
- unrated: plays only unrated songs (helps users create ratings)
- easy: (rating ** (1/3)): plays almost everything, but still skips bad songs

The most useful modes are "harsh" and "unrated".

Unrated songs would act as if they were rated 0.5, except in "unrated" mode.


Perhaps the most controversial issue involved is where/how to store the
rating data. Currently, rockbox gets rating data from the song file's
tag data, but this is somewhat problematic:

- Ratings are a property of the listener, not the song.
- When ratings change (< 10 bytes), the entire song (MiBs) must be
re-transferred to/from the host PC to keep things in sync.
- Not all file types can store rating data; IIRC, rockbox already
supports some file types without this capability, so the approach
would be crippled by design. Also, with many different ways to
store the data, support becomes a rather complex, error-prone issue.

I've been storing song ratings (and other metadata) as text files in a
per-song subdirectory. This is an easy, flexible way to add data to any
file, and is rsync-friendly. For example:

- /foo/bar/song.mp3
- /foo/bar/.song.mp3/.rating
- /foo/bar/.song.mp3/.whatever

This approach is completely optional, but may be worth considering.
Alternately, the data could be moved to a separate tree:

- /foo/bar/song.mp3
- /.rockbox/meta/foo/bar/song.mp3/rating

Or, it could be stored in a special database:

- /foo/bar/song.mp3
- /.rockbox/ratings.db

The latter two approaches tend to lose data if the path to the song ever
changes, but may be desirable anyway -- especially if checksums are used
as a fallback when looking up songs.


This feature consists of several components:

- Config option to enable ratings, and/or choose a rating mode.
I suggest off/on/unrated, or off/harsh/regular/easy/unrated...
probably the former, as it's simpler.
- UI for displaying song ratings. This is already mostly complete, as far as I know.
- UI for editing song ratings. Perhaps an extra item on the menu
which comes up by holding select during playback?
- DJ algorithms added to the next-song code.
- Storage mechanism for getting/setting ratings, and potentially other

I've implemented this before, in the music player I use on my desktop. It
makes a big difference in the personality of the playlist, and I'd be willing
to help implement it in rockbox.
This task depends upon

Closed by  Bj√∂rn Stenberg (zagor)

Reason for closing:  Fixed
Additional comments about closing:  Closing all feature requests.