Important alert: (current site time 7/16/2013 10:02:16 AM EDT)
 

winzip icon

csMusicLibrary PRo v1.0 with Example Application

Email
Submitted on: 1/17/2004 9:41:30 PM
By: Jason Hensley 
Level: Beginner
User Rating: By 26 Users
Compatibility: VB.NET
Views: 17648
(About the author)
 
     This is a Class Library I created with VB.Net to add support for playing various music formats including: mp3, wav, and wma files. This class contains over 30 subs, functions and propertys. Some of the features include: getting the length of the song in milli-seconds, seconds, or a userfriendly format. Get the playing position in milli-seconds, seconds or a user friendly format. Open and save M3U playlists. Adjust separately, the volume for the left/right channels or both channels. Change the speed at which the song is played, mute the sound output and many more. This class is completely compatible with Window 9x and Above. Including Windows 2000 and Windows XP. No need to worry about any 3rd party controls or DirectX. As this class uses the built-in mci command interface to do it all. This class was designed to be user friendly, easy to use, and implement. Once the class is compiled, it would be useable by any .Net language. If you add Com Interop it would be compatible with the classic versions of Visual Basic. It did take quite a bit of time and work to create this. Hopefully it will prove to be useful. Please feel free to leave some feedback. Note: The upload process will probably strip the .dll file from the zip file. You will need to compile the Class Library project.
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 8 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments
1/18/2004 2:30:39 AMAdam Beer

This is a great library with example. Definatly 5 globes from me!
(If this comment was disrespectful, please report it.)

 
1/18/2004 5:09:05 AMPietro ing. Cecchi

Hi Jason,
you say:
'If you add Com Interop it would be compatible with the classic versions of Visual Basic'...
I believe this sounds even more interesting!...
Yes, I agree with Adams,
and give you 5 donuts.
And thanks a lot for sharing the good code... :)
(If this comment was disrespectful, please report it.)

 
1/21/2004 7:10:38 PMJason Hensley

Thanks for the comments. Not sure why only 2 out of 300 gave some feedback. Would like comments/feedback on new features to add.

Jason
(If this comment was disrespectful, please report it.)

 
2/17/2004 4:59:48 PM

Great Simple Code :) 5 globes !
(If this comment was disrespectful, please report it.)

 
3/24/2004 7:06:39 AM

Hi Jason, thank's to share this code. Simple and clear. 5 globes from me.
(If this comment was disrespectful, please report it.)

 
4/22/2004 4:50:23 AMfbe1978@hotmail.com

EXCELENT!!!!
Thank you for this splendid share.
5 stars for you
(If this comment was disrespectful, please report it.)

 
5/8/2004 6:14:55 PMçentipede

I have a couple comments, first - this code is EXCELLENT!!

1. Is there any way that this could be modified to allow more than one csMusicLibrary controls on a single form to both play simultaneously

2. Is there any way to get the output level as it is playing, so that the level can be sent to level meter controls etc.
(If this comment was disrespectful, please report it.)

 
5/21/2004 5:54:50 PM

I haven't even downloaded this yet, but as of now I am believe I will be using it simply to play music in the game I am making which I will soon have on here.

(If this comment was disrespectful, please report it.)

 
5/29/2004 11:06:59 PMJason Hensley

Thanks everyone for your comments.

çentipede, the answer to your first question is yes. What you will want to do is modify the class library. You want to make it so you can open multiple devices by opening each file you want to play with a different alias. It should be very easy to do. Email me if you need some help with it.

Your seconds questions is yes, but not with the mci command string interface. The way to do it with vb is to use the WAVEIN api's. You want to set it up as recording but read the actual sound data that is returned from the structure. The best site to learn to do this is: http://www.fullspectrum.com/deeth/main.html. He has some very nice examples on how to do it. Either mono or stereo visuals. FFT, spectrums, ect... Take a look and you should definitely find what you are wanting.

Thanks everyone for your comments. Feel free to mail me or post here about some new features or bugs. Thanks again. :)

Jason
(If this comment was disrespectful, please report it.)

 
5/30/2004 4:44:42 AMDaniel Flahive

This is the BEST thing I have found that plays mp3's. Great Work!
(If this comment was disrespectful, please report it.)

 
7/16/2004 2:54:00 PMBlazeSharp

Too sweet! I listened to a TIMMY! sound bite and 50% speed and LMAO!

Do you think you could add the ability to record what is loaded to play (basically sound editing)? Sweet class! 5 from me.
(If this comment was disrespectful, please report it.)

 
7/29/2004 9:16:46 AMpig

I wish I would of seen this before writing my own. I could have saved much time.
Anyway,
I suggest you add a paused property
(If this comment was disrespectful, please report it.)

 
8/28/2004 6:36:24 AMMr.Sekhar

Cool player.
Suggestion: How abt adding support to play .ra, .rm , oggvorbis formats as well? :)
(If this comment was disrespectful, please report it.)

 
8/28/2004 10:13:38 PM

Very cool app! Thanks for your hard work!
(If this comment was disrespectful, please report it.)

 
8/30/2004 10:49:14 AMBbroussard

This code is very nice, easy to read and straightforward. Any chance of a version that would play from a file loaded in memory ? This would be very useful for audio stored in a database.
(If this comment was disrespectful, please report it.)

 
9/27/2004 12:10:12 AMJason Hensley

Thanks alot to everyone for the feedback and the votes. I am planning on making a new version of this Class. I will look into adding support for the feedback listed in the above posts.

Please mail me at: jason@vbcodesource.com if you have any specific features you want added or changed. Thanks alot!


Jason
(If this comment was disrespectful, please report it.)

 
7/23/2005 11:58:24 PMJared McGuire

Excellent code! I modified it as suggested to handle multiple sounds playing at once and it works perfictly. Thanks.
(If this comment was disrespectful, please report it.)

 
7/25/2005 6:32:06 PMJason Hensley

Thanks alot for the comments.

I will be creating a new version and it will have support for playing multiple files at the same time built in. Sorry you had to modify it to do what you wanted. I am not sure when I will release the new version. I will be doing a overhaul on most of the code to optimize the speed and disk size. I am trying to get rid of ALL legacy style code and make it all 100% native VB.NET. You can goto my website at: http://www.vbcodesource.com for anymore info or other librarys and downloads. Thanks :)


Jason
(If this comment was disrespectful, please report it.)

 
8/11/2005 8:56:57 AMRob

When I see what you have pulled off. I dont feel worthy. Thanks for sharing. It has saved me hours of HARD work and research.


(If this comment was disrespectful, please report it.)

 
12/23/2005 12:43:38 PMdjk

This code is OK but doesn't work with mp3s that have higher bitrate. :/
(If this comment was disrespectful, please report it.)

 
11/7/2006 11:55:54 AMDave

Hi I was wondering if you could use this to do some management of the MP3 files as well.. Like delete duplicates...?? Thanks Great CODE
(If this comment was disrespectful, please report it.)

 
1/19/2007 10:48:01 PMJason Hensley

Hi, you could create your own sub to do it inside the class if you want to. But otherwise no code it included with the class to delete duplicate MP3 files. Thats something I may add in the future though.

Jason
(If this comment was disrespectful, please report it.)

 
2/23/2008 1:57:10 PMguideX

This sure is a blast from the past! Reminds me of some older vb6 versions I've seen. Very good conversion to .NET. 5 Stars
(If this comment was disrespectful, please report it.)

 
3/15/2008 2:08:07 PMMike

This is amongst the best code I've seen on this site! Very well done!
(If this comment was disrespectful, please report it.)

 
1/16/2009 4:04:50 PMPingBad

Not bad code. However, some of your file handling routines do leave some room for concern. Have you considered using the System.IO.FileInfo class to ascertain various filesystem-related pieces of information about a given file?
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.