Click here to Skip to main content
15,867,686 members
Articles / Programming Languages / C#
Article

Music Manager 1.1

Rate me:
Please Sign up or sign in to vote.
4.85/5 (36 votes)
15 Mar 2008CPOL6 min read 145.4K   7.7K   149   34
Music library, Probability based random play
Sample Image - Music_Manager_10.jpg

Introduction

I use Creative Nano to listen to music. It's good to use. But I find that managing songs is a problem. It has a folder view where I can switch from one folder to other. But it displays all the folders containing MP3 songs in the same level. So, I had to create a folder based on the artist name. However, it becomes a problem to create the folders manually. So, I tried to use the software which can sync music with a removable drive. For that, I found Windows Media Player useful. But in case of my MP3 player, there is a big problem. Windows Media Player creates a folder name as [Artist Name]\[Album Name]\[File Name]. So, in my MP3 player, I can see only the album name which is most of the time incorrect. In fact I want to switch from one artist to another. So, I decided to make my own program which can sync according to my choice.

Then I found that it should have a play feature too. I don't want to use different applications for playing music while I'm copying music to my music player. So, I added the entire feature which helps me to listen to music from my MP3 player.

Then I designed a probability based random music playing algorithm which would monitor my choice and play music according to that. I found it's very useful to listen to music. I was using iTunes before I designed Music Manager. So, the look becomes similar to iTunes. I think this representation of music is better than that of Windows Media Player.

Description

Manage Your Music Library

To import your existing music from your computer, you can browse the location of your music folder and then press the Load button. It will search for all the music recursively and add it to the library. It creates an MMHistory.mmh file for each folder you are interested in. It uses a relative location. So, if you copy this folder to some other location and browse the folder with Music Manager, then it will load the MMHistory.mmh file and play music.

To manage music, you can copy music from the Music Manager, paste to Music Manager and delete music from your music folder with Music Manager. You can also drag and drop music to Music Manager. It will copy according to the file name format you specified in the options.

Options

File name formats are as follows:

  • {Album}\{Artist}\{FileName}
  • {Artist}\{Album}\{FileName}
  • {Artist}\{FileName}
  • {Album}\{FileName}
  • {FileName}
  • {Album}\{Artist}\{Title}
  • {Artist}\{Album}\{Title}
  • {Artist}\{Title}
  • {Album}\{Title}
  • {Title}
  • {Genre}\{Album}\{Artist}\{FileName}
  • {Genre}\{Artist}\{Album}\{FileName}
  • {Genre}\{Album}\{Artist}\{Title}
  • {Genre}\{Artist}\{Album}\{Title}

So, you can manage your music according to the information available in MP3 files.

You can also paste Windows Media Player play list (*.wpl) to Music Manager. Music Manager will copy all the music listed in the play list to the location you specified with your specified file name format.

You can also use add files, add folder from file menu to copy music to the specified location.

If you delete a file from the Music Manager library, then it will delete from the physical location too.

Volume Controller

In the controls menu, there is a Volume Controller menu. The user can control volume including bass and treble.

Volumn Controller

Probability Based Random Music Player

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 Morkov 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/(n+1) and probability of the other music is 1/(n+1). 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:

  1. The user selects a song and plays it manually
  2. 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.

What's New in Music Manager 1.1?

WMA support to music manager - I thank Dave.Kelly for sending me the code to support WMA file.

To design this application, I used some code downloaded from The Code Project. I thank the authors of that code.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) KAZ Software Limited
Bangladesh Bangladesh
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralWMA Suppot Pin
dave.kelly16-Jan-07 3:36
professionaldave.kelly16-Jan-07 3:36 
GeneralRe: WMA Suppot Pin
H. S. Masud18-Jan-07 0:04
H. S. Masud18-Jan-07 0:04 
GeneralRe: WMA Suppot Pin
dave.kelly18-Jan-07 0:15
professionaldave.kelly18-Jan-07 0:15 
GeneralRe: WMA Suppot Pin
Leo Davidson16-Mar-08 1:09
Leo Davidson16-Mar-08 1:09 
GeneralI like it! Pin
i.Posei13-Jan-07 3:21
i.Posei13-Jan-07 3:21 
GeneralRe: I like it! Pin
H. S. Masud13-Jan-07 18:58
H. S. Masud13-Jan-07 18:58 
Generalnice! Pin
Vindicator6667-Jan-07 4:42
Vindicator6667-Jan-07 4:42 
GeneralRe: nice! Pin
H. S. Masud7-Jan-07 17:48
H. S. Masud7-Jan-07 17:48 
GeneralGood Job .. Keep going Pin
farukbd7-Jan-07 3:30
farukbd7-Jan-07 3:30 
GeneralRe: Good Job .. Keep going Pin
H. S. Masud7-Jan-07 17:42
H. S. Masud7-Jan-07 17:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.