Rockbox Technical Forums

Rockbox Development => Feature Ideas => Topic started by: littlenick on March 10, 2010, 12:18:20 PM

Title: Song rating to affect playback frequency in shuffle mode?
Post by: littlenick on March 10, 2010, 12:18:20 PM
I wonder if rating a song could affect the frequency of it's playback in a playlist in shuffle mode?
Maybe making playback of favourite songs 2 or 4 times more frequent than average likelihood for these song and slimming down the chances for less liked songs in a similiar way?
Title: Re: Song rating to affect playback frequency in shuffle mode?
Post by: Llorean on March 10, 2010, 01:52:57 PM
"Shuffle" isn't the same as some sort of pseudo random playback.

When you choose to shuffle songs it takes the exact list that is your current playlist (or your current selection) and shuffles them. Then it plays through that shuffled list from start to finish, playing each song exactly once.

What you're describing would need to be an entirely different playback mode, rather than an aspect of shuffle.

You might be better off just creating a database search for the highest rating and second highest rating, "Insert Shuffled" each one multiple times to represent your personal choice of "weight", then shuffle the resulting playlist again for better randomness, then play it. Quick and relatively easy implementation of your idea.
Title: Re: Song rating to affect playback frequency in shuffle mode?
Post by: littlenick on March 16, 2010, 10:53:05 AM
Hi Llorean,
thank you for giving thought to this idea!
Hmmm - I'm not a fan of this database thing at all.
When I bought my player (from ebay) it came with database enabled and I got quite a shock when I put music on it:
All the folders (genre, artist, albums) were ripped open and tracks were played as a crazy mixture of any different styles starting off with all tracks number 01 (dozen or hundreds of 01s)...
Probably (?) making good use of the database function might cure this but it will take a very serious maintenance of ID-tags -won't it?
Anyway I managed to kick out the database and that saved my h120 from never getting looked at anymore (the kind of treatment my Cowon D2 is enjoying right now as I haven`t managed to disenable database on my D2 and I got fed up fiddling around with it's touch screen).

Besides I don't know if your idea works also in a negative way - slimming down chances for playback and for tracks that haven't yet received a rating?

Of course I could create playlists with each track entered 4 times (for normal playback frequency in "rated shuffle mode") - this would be valid let`s say for tracks with average rating (3stars) or without any rating.
Enter twice tracks with below average rating (2 stars) and once songs with lowest rating (1 star) into this playlist.
And enter 8 times tracks with above average rating (4 stars) and 16 times each track with very high rating (5 stars);

Then shuffle playlist and play ... but you understand why I don't consider this a straightforward solution?

Greetings,
Tom
Title: Re: Song rating to affect playback frequency in shuffle mode?
Post by: Chronon on March 16, 2010, 03:37:27 PM
Hmmm - I'm not a fan of this database thing at all.
I don't understand.  Song ratings aren't used at all by the file browser.  If you want behavior that depends on song ratings then it seems that you should be using the database.

Quote
When I bought my player (from ebay) it came with database enabled and I got quite a shock when I put music on it:
All the folders (genre, artist, albums) were ripped open and tracks were played as a crazy mixture of any different styles starting off with all tracks number 01 (dozen or hundreds of 01s)...
Probably (?) making good use of the database function might cure this but it will take a very serious maintenance of ID-tags -won't it?
Are you saying that you bought it with Rockbox already installed on it?  If that's the case, then you should know that you can use Rockbox without ever using the database if that's what you want.  I use it only on rare occasions myself.  I still make sure my metadata tags are valid, though.  There are many metadata scanners out there that can automatically batch tag your files based on various attributes (Picard is an example that can be used on both Linux and Windows).
Quote
Anyway I managed to kick out the database and that saved my h120 from never getting looked at anymore (the kind of treatment my Cowon D2 is enjoying right now as I haven`t managed to disenable database on my D2 and I got fed up fiddling around with it's touch screen).
If this all has to do with Rockbox then I highly advise you to read the manual.  There's no requirement to use the database in Rockbox, unlike many other DAP firmwares.
Quote
Besides I don't know if your idea works also in a negative way - slimming down chances for playback and for tracks that haven't yet received a rating?
What Llorean said is pretty clear to me.  There's no change in relative frequency when you shuffle.  The list is reordered and each track in the playlist is played exactly once.
Quote
Of course I could create playlists with each track entered 4 times (for normal playback frequency in "rated shuffle mode") - this would be valid let`s say for tracks with average rating (3stars) or without any rating.
Enter twice tracks with below average rating (2 stars) and once songs with lowest rating (1 star) into this playlist.
And enter 8 times tracks with above average rating (4 stars) and 16 times each track with very high rating (5 stars);

Then shuffle playlist and play ... but you understand why I don't consider this a straightforward solution?

Greetings,
Tom
It seems that what you want is a plugin that will scan ratings and then add files to a playlist with a relative frequency corresponding to the song rating.  It seems like the only reasonable way to do this would be for the plugin to query the database.
Title: Re: Song rating to affect playback frequency in shuffle mode?
Post by: littlenick on March 28, 2010, 10:24:29 AM
Thank you Chronon for taking the time and your thorough answer!
Actually the player(s) (iriver h120 and D2) came with original firmware in my hands.  I use Rockbox now without database in the h120  - very glad there is no need for database in rockbox! The D2 lies around abandoned without rockbox; never liked its touch-screen from the beginning!
But I'm no expert in computer stuff and so I wasn't clear to me that for a feature like the one I suggested database would be necessary.
Still takes some getting used to - this idea of the database. And a friend mine (far more skilled than I in these things) warned me that even he disenabled database in his D2 (lucky he knows how to do it) because he couldn't keep his ID tags valid all the time (same CD may be listed under three different types of genres if you care to look in different databases).

So all this was written from the viewpoint of a "simple" user, not that of an expert.
Title: Re: Song rating to affect playback frequency in shuffle mode?
Post by: Eric Einem on April 14, 2010, 07:00:04 PM
I agree, being able to have the frequency that a song is played back depend on the song rating would be a great feature.

Perhaps a Smart Playlist feature could be added that uses the Song Rating and some new configuration settings to select a portion of the music for a Now Playing playlist.  The Smart Playlist could be made from any selected folder, artist, album, etc. from the context menu.  A percentage of the total selected songs would be selected into the Now Playing list using the song ratings to weight the frequency of selection.

The Smart Playlist configuration settings could include the following:
Then for each rating, a frequency percentage is calculated as follows:
  rating_10_percent = 100;
  rating_9_percent = rating_10_percent x weight_factor%
  rating_8_percent = rating_9_percent x weight_factor%
  rating_7_percent = rating_8_percent x weight_factor%
  rating_6_percent = rating_7_percent x weight_factor%
  rating_5_percent = rating_6_percent x weight_factor%
  rating_4_percent = rating_5_percent x weight_factor%
  rating_3_percent = rating_4_percent x weight_factor%
  rating_2_percent = rating_3_percent x weight_factor%
  rating_1_percent = rating_2_percent x weight_factor%

So if a weight factor of 80% is used, the percentage that tracks of rated 10 through 1 would have a percent frequency of 100%, 80%, 64%, 51.2%, 41%, 32.8%, 26.2%, 21%, 16.8% and %13.4.

A simple algorithm could be used to select the tracks into a Now Playing list using these configuration settings.  Tracks could be selected at random until the list contains the desired number of tracks.  As the tracks are randomly selected some of them randomly skipped based on the percent frequency of the track.  So with the above settings, if a track of rating 6 is randomly selected, it will have a 41% chance of being included.  If the randomly selected track has a rating of 10, then it will have a 100% chance of being included.