Now let's discuss the probability based random music player. When we play music, we follow some patterns. For example, if you selected a song with classical music then you might choose another song with classical music. Now in that
classical music, there is a high probability that the next song is sung by the same artist or from the same album. So, we can conclude that selecting the next song depends on the previous song. Now let's discuss how I designed the random music player.
I used a simulation technique called Markov Chain. Initially all the songs have the same priority. Let's say it's 1. If there are n types of songs, then probability for each type is 1/n. When the user plays a song, Music Manager increases the priority
for that music to one unit. So, after playing the first song, its priority becomes 2 and probability of that music becomes 2/(n1) and probability of the other music is 1/(n1). Simply put, the probability of a type of music is Priority/(Total Priority).
Now when user plays a music type, Music Manager increase priority to all the music belonging to the same genre. Music Manager adds the average priority of a genre to all the music belonging to that genre. So, priority gets increased for that genre. Then the
next priority is the artist. So, all the music sang by the same artist gets increased by its average priority. Similarly, it adds the album priority. In this part, the user cannot control the priority. But the user can add additional priority specified in
the option dialog. The user defined priority is added to every song according to the genre, artist and album.
The user might not expect the same music to play repetitively. So, the user can check the 'Do not repeat until all music is played' check box in the options. The user can define a priority to repeat the music too. In that case, a played song's priority
is decreased with the factor defined by the user. If it is 20 (the maximum value), then Music Manager doesn't decrease the priority of a played song.
So, this random player plays according to the user's choice and the prediction that the user would like the next song from the same genre or from the same artist or album. So, it has become more interesting than any other random music player.
The priority of a song increases permanently in two cases:
The user selects a song and plays it manually The user listens to the song completely So, if the user does not like the randomly chosen song, then he can skip or play the next song and no priority is added to that song. If the user plays a song manually and
listens to the complete song then the priority is increased by two units. Thus, it builds the probability database. The average priority of the genre, artist or album is not saved in the database. It is needed to affect the probability distribution based on
the music played.
Code Project Article Link http://www.codeproject.com/KB/audio-video/MusicManager10.aspx