-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Random algorithm reapeating songs frecuently #475
Comments
Just to make sure: Are you talking about shuffling the timeline (eg: the button on the left side) or the Random mode (the dieces on the right side) ? The random mode creates an internal playlist with all songs and will pop() one of them if you reached the last item on the playlist. |
I am talking about the Random mode, some programs translate Shuffle as Random (but in spanish) so there was my confusion. The left button doesn't affect this situation. |
Ok, thanks for clearing this up.
No: Our Random mode works different: Vanilla Music fetches all songs from the library and keeps them in a shuffled array. Every time the end of the queue is reached, the last item of the shuffled array is removed and appended to the queue. So songs should will only start to repeat after all songs in the library have been played. |
Just today I hear Anyway by Genesis and Octopus's Garden twice in less than 2 hours of non continuos music playing. I have a lot of music in my SD, for sure more than 2 hours (cause prog rock, 6 tracks are 2 hours for example). I didn't reset my phone in the middle. Does this shuffled array resets every time I stop playing music? Theres a way to mantain this array even when closing the app/stop playing music?. |
No, but it will reset if Vanilla Music gets killed while being in the background, which is rare but might happen (depending on your OS and Hardware) |
There is a way to know that? Something like the queue not remembering your last song? Or the notification closing even when you left it to be always on? |
Hmm, no: such restarts are somewhat hard to spot: One way to tell is if the scrolling position in the library view jumped back to the top |
getting random songs is not as easy as it sounds: http://www.independent.co.uk/life-style/gadgets-and-tech/news/why-random-shuffle-feels-far-from-random-10066621.html You basically have to take notes for how often you have played songs and try to play each song as often as the other. And take changes in the collection into account so you have to store the first time the track showed up in the collection as well. I would welcome that feature. |
With the new media db, we have this information at hand: We keep track the mtime and a play- & skipcounter for every song. Implementing a smarter random mode could therefore be done in a single SQL statement. Feel free to give it a try (you can grab a copy of the sqlite database if your phone is rooted from /data/data/ch.blinkenlights.android.vanilla/databases) |
Awesome that you are working on implementing this! |
You misunderstood me: i am not working on this, i just said that the required data is already there |
I’m trying to inspire you. :-) |
Lol, this is actually a very funny issue :D Go ahead, tell me that I miss entropy in my |
ok, let me explain the issue for you, look at this code:
Do you really want some of your 100 tracks to be played 3, 4 times and others not at all? True randomness doesn’t help with that issue. Most people want their tracks to be played equally often but in random order. This is the same code, but with much better randomness: for i in {1..100}; do rndm=$(od -vAn -N4 -tu4 < /dev/urandom); echo $(($rndm % 100 + 1)); done|sort -n|uniq -c|sort -n|tail Same result. |
Ok, that makes sense. But we maintain a list of available songs in random order and just walk through it in this mode, so songs aren't repeated. The only issue I can see is that when this list ends and next song is requested, the list is reshuffled and may provide the same song as the one that was last (or near enough to the end of old list) as first one. This may give impression of imperfect random mode. |
Oh that’s interesting. Where is that list stored? |
IIRC it's somewhere in MediaUtils.getRandomSong |
No results found for MediaUtils.getRandomSong
…On Wed, Mar 1, 2017 at 1:14 PM, Antic1tizen One ***@***.***> wrote:
IIRC it's somewhere in MediaUtils.getRandomSong
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#475 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACLeqb2eJGXwf9SID7biDhF999f7xG4rks5rhWE-gaJpZM4KzYMw>
.
|
you could split your list in 3 pieces 1st, 2nd and 3rd part (which i will call buffer) when finished with the 1st, you scramble a new 1st from half the 1st and the buffer, left over songs get dropped in buffer when finished with the 2nd, you scrambe a new 2nd with half the songs from buffer and the 2nd part, leftovers back to buffer the distance between a song repeating is never smaller than a third of the list or did i forgot any corner case? the chance of a song never beeing played still is present Could be done quiet easily with a infinite linked list! |
The current implementation (see getRandomSong) grabs a copy of the library, shuffles it and pops a song on every call. We are not repeating songs until the random list is cleared (app restart) or exhausted |
Right, that explains my issue. As soon as I stop the car the app is restarted. Would it be possible to store the library so it survives restarts? |
You could make you list (if you want all the songs just click in play all), then shuffle tracks and save that list. That's how I fix my "problem". |
Wait - i always thought it would be the other way around? With a shuffle mode like this i always presumed that "Random" would in contrast mean that every track from the library would have a statistically equal chance of being the next one. What sets the Random mode apart from Shuffle & Repeat in regards to plaing dynamics? |
Is possible that the shuffle option is not really that shuffle? After some time listening in this mode or when reseting the phone, I found that some songs shuffle "together".
Does Vanilla algorithm works like Winamp's shuffle? When You shuffle in Winamp (at least old versions), It will jump X number ahead in the list so using the same list and starting from the same point will give you the same songs order,
Sorry for not giving a lot of feedback, I found this very difficult to debug.
The text was updated successfully, but these errors were encountered: