Skip to main content

Topic: [Request] Weighted random playback (Read 6193 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • ojdo
  • [*][*][*][*][*]
[Request] Weighted random playback
Hi foobar community!

I'm not sure if this has already been requested, but a forum search with the keywords above didn't bring any results.

With all those nice ways to create metadata from playback-statistics (e.g. hotness, hot-or-not, auto-rating, ...) I think it is a shame that they are only useful for sorting and eye-candy purposes at the moment. I would be glad to be able to influence a track's playback frequency with TAGZ, too.

foo_skip shows me how such a component could work: I set up a TAGZ string which returns a value between 0 (skip never) and 1 (skip always), so-to-say a skip probability. A little modification in foo_skip should already make this functionality possible. But in general I would prefer a variant which does not require the song to be loaded before, i.e. the next song can be calculated in the background.

The idea behind this is that I can get different playback experiences from one single playlist file (e.g. an autoplaylist containing all music [not speech]) without having to code a seperated autoplaylist. For example
"Play (more probably, not only!) what I haven't heard for a while",
"Avoid everything from %genre%",
"Give me the high rated ones!", ...

I'd like to hear your opinion about that,

ojdo

  • Kent Wang
  • [*][*]
[Request] Weighted random playback
Reply #1
That would be really cool. Just curious, is there any other music player that already does this?
Everything I've learned about space, I've learned from psytrance.

[Request] Weighted random playback
Reply #2
I would prefer a variant which does not require the song to be loaded before, i.e. the next song can be calculated in the background.

i would love to have this. right now, foo_skip can go through several songs, even playing the first split-second of some of them, before landing on a song that passes the filter. this is annoying and i can't use crossfading because of it.

  • c0utta
  • [*][*]
[Request] Weighted random playback
Reply #3
I have simulated this behaviour by using a VB.net console application that reads my rating tags and outputs the filename into an M3U multiple times.  This effectively gives a weighted playlist.

From an SDK perspective, do we have control over the shuffle mechanism and can we write our own component that will modify the algorithm?

Cheers,

c0utta
  • Last Edit: 01 September, 2006, 12:00:37 AM by c0utta

  • fabiospark
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #4
Oh yes!

And a fuzzy logic interface too, maybe...

  • ojdo
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #5
And a fuzzy logic interface too, maybe...

I know about fuzzy logic, but what is a fuzzy logic interface
When I imagine an interface for a possible plugin I tink of something quite simple like foo_skip. The only "fuzzy" part of all this is the calculated skip probability and it is the user's task to make it as... fuzzy (i.e. result in digital skip [1]/don't skip
  • or a value between [0.5=skip in 50% of all cases) as he wishes to.

    Example:
    Code: [Select]
    $ifgreater(%_hotness%,60,'0.8','0.2')

    This would skip a track with hotness greater 60 with a probability of 80%, otherwise 20%. I'm quite sure that there could be some nifty algorithms possible.

  • ojdo
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #6
A little update from the foo_skip-thread: As I learned from a post by SoulMan $rand() can be used in foo_skip to - for example - play high rated tracks more often than low rated:

Code: [Select]
$if($or(%skip%,$greater($add(1,$rand(10)),$add($mul($if2(%rating%,2),2),1))),1,0)


The $greater-function compares a random integer from 1 to 10 with 2*%rating%+1. If no %rating% is present, a value of 2 is assumed. The result:

Code: [Select]
// R = %rating%
R | 2*R+1 | Skip probability
--+-------+------------------
0 | 1     |  90%
1 | 3     |  70%
2 | 5     |  50%
3 | 7     |  30%
4 | 9     |  10%
5 | 11    |   0%


The only bad thing is that this results in a kind of playlist-hopping, until foobar finds a track to play. A solution which would calculate the next song to play in advance would be much more elegant.

ojdo

  • odyssey
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #7
BUMP!! 

foo_skip is very nice, but as mentioned a few times in this thread, it's not *great*. I think it would be fairly simple for a developer, to make a foo_skip, that actually looks ahead in the playlist and not just evaluates after the skip! ...hint hint 

In regard to the weighted playback function, I did this just before I found this thread:
Code: [Select]
// R = %rating%
R | Skip probability
--+------------------
0 |  100%
1 |  80%
2 |  60%
3 |  40%
4 |  20%
5 |   0%


And the code I came up with:
Code: [Select]
$if($greater($add($mod($rand(),4),2),%rating%),1,0)


Edit: And beware, I don't take any responsability for this code. It has no checking whatsoever, and does not take untagged files into account!
  • Last Edit: 23 October, 2006, 09:13:08 AM by odyssey
Can't wait for a HD-AAC encoder :P

  • rouge
  • [*][*]
[Request] Weighted random playback
Reply #8
Foosion always goes on and on about how random playback isn't supported in the SDK every time this comes up.  This is the 3rd that I've counted.  But, I still want it. ;]

  • odyssey
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #9
Foosion always goes on and on about how random playback isn't supported in the SDK every time this comes up.  This is the 3rd that I've counted.  But, I still want it. ;]

Maybe, but still - since the random play now is a pre-created list of random tracks, how hard could it be to implement?

And we don't get it if we don't whine about it 
Can't wait for a HD-AAC encoder :P

  • rouge
  • [*][*]
[Request] Weighted random playback
Reply #10
Agreed on the whining.  I'm sure there's more complex ways to implement this type of thing, but it generally wouldn't be worth the trouble when it would be easier to implement in the SDK.  However, it has been some months since this was first brought up, and we don't know when or if there will ever be an update.

Something like background automatic playlist generation (the old history component made a seperate playlist) seems somewhat complicated, but I'm not a coder by choice (I fear that it would consume what little I consider to be my life).

Then there's the whole random-not-being-truly-random discussion, blah, blah, blah... I forgot the point I was trying to make, or if there was one...

  • Squeller
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #11
Agreed on the whining.  I'm sure there's more complex ways to implement this type of thing, but it generally wouldn't be worth the trouble when it would be easier to implement in the SDK.  However, it has been some months since this was first brought up, and we don't know when or if there will ever be an update.
iirc peters point of view was like "make your own playlist manually" when it was about the playback queue. Maybe this also applies here...

[Request] Weighted random playback
Reply #12
I would like this for a different reason: to make every a song on every ALBUM the same chance of playing, not songs. That way 3 track albums would have as much chance of playing a song as 20 track ones. The only way to do this with a playlist is to duplicate tracks, which is ugly.
err... i'm not using windows any more ;)

  • odyssey
  • [*][*][*][*][*]
[Request] Weighted random playback
Reply #13
I would like this for a different reason: to make every a song on every ALBUM the same chance of playing, not songs. That way 3 track albums would have as much chance of playing a song as 20 track ones. The only way to do this with a playlist is to duplicate tracks, which is ugly.

If you have tagged your albums with %total tracks% (or whatever that tag is called) you could use a variant of my skip-control:

$if($greater($mod($rand(),%total tracks%),0),1,0)

Takes a random number between 0 and %total tracks%, and skips if it's above 0. Should make every album have the same amount of proberbility (but still has the disadvantage of foo_skip beginning to play every skipped track though).

Note, I did not test the code above. Edit: ...and I would assume that this code would skip ALOT!!! (All I want for christmas is... that Peter allows components to take control of the playlists  )
  • Last Edit: 30 October, 2006, 06:20:42 PM by odyssey
Can't wait for a HD-AAC encoder :P