Introduction
I have often been asked the question " Is there a simple way to play WAV and MP3 files from C#". I have in the past few days devoted myself to doing this and I have been able to create a simple C# form with a single button to play both MP3 and WAV files using only six lines of code.
The program utilizes the device control MP3P.OCX which must be registered with regsvr32.exe but I have created "setup.bat" to do this.
There also must be the following .dll files present.
- AxInterop.MP3PLib.dll
- Interop.MP3PLib.dll
I have a mp3player.zip file containing the program which is named
- MP3play.exx This must be renamed
- mp3play.exe. I have done this to facilitate internet transmission.
I also have a zip file mp3play_source.zip with the source code.
Narendra VermaPosted Feb 23, 2014, 12:28 AM
thnku
halit karaPosted Feb 12, 2013, 10:21 AM
thats working ;) thnks
Arbaz AliPosted Jan 7, 2013, 1:55 PM
thats not working :(
cherish patelPosted Nov 28, 2012, 6:09 AM
thank you very much.......!!
devesh agarwalPosted Apr 6, 2011, 4:34 PM
i m getting the same exception and still not able to fix the exception input string is not in the correct format in the tick event of the timer1
rahul kumarPosted Nov 20, 2010, 6:31 AM
Thanks for your reply. i just want to know how we add a music player in the c sharp project? also can we control the sound also in this project? help me. thanks again for your previous help
rahul kumarPosted Nov 18, 2010, 7:33 AM
Hi myself saurabh and i am learning c sharp.i saw your project and i like it but i don't understand. please help me to understand it.The problem i face in your programe is that it play 1 sone completely but when i go to the other song then it shows errer in the following line" second = int.Parse(buffer.ToString());" and said that the format was unhandled. plz help me.
vikas yadavPosted Nov 17, 2010, 3:45 PM
sir, i thank you for writing this article. sir, i have some problems with the code.. in the statement second=int.parse(buffer.to string()); it is showing an error which is format exception error...can u please tell me what should i do.. i have tried many things. i have read all your comments on other people's posts but still i am not able to solve my problem..please help me... thanking you in advance...
sravan kumarPosted Jan 17, 2010, 8:50 AM
nice work yar.......
justin de guzmanPosted Jan 8, 2010, 1:58 AM
Cool!!! I like it... Nice program... =D
varun katyalPosted Mar 24, 2009, 10:30 AM
I kNOw Much Easier way of creating a soundplayer....but how to post? tell me method
cactus tiniPosted Mar 20, 2009, 10:32 AM
hi , i hava a problem when i click in play button , in line second = int.Parse(buffer.ToString()); please help me
adiPosted Dec 10, 2008, 6:55 AM
Why this article under CF C# ?
jaspreet kaurPosted Oct 10, 2008, 1:52 AM
hi kapil............ thankyou for that coding.............it really worked..................it is really good.......... well will u plz tell me how you came across those classes and methods used in your code ????? or do tell me the particular websites from where i can get some useful and extraordinary codes........... bye...............
jaspreet kaurPosted Oct 9, 2008, 12:37 PM
ya still the exception is coming as suggested by you to add those namespaces and even [DllImport("winmm.dll")] without ';'............ the exception is coming on line:- second = int.Parse(buffer.ToString()); in timer_tick event handler what i did is browse an mp3 song by clicking the browse button and the whole path of that mp3 file was sen in textbox ..............and thus when i click play button the above exception comes............ do i have to change few settings in particular control's properties also?????????? if yes plz tell me the solution to it........ bye.......
jaspreet kaurPosted Oct 9, 2008, 5:59 AM
yes still the exception is coming :- input string not in a correct format even after writing code given below:- StringBuilder buffer=new StringBuilder(128); so please solve my problem related to this exception.........
jaspreet kaurPosted Sep 26, 2008, 4:00 PM
hi kapil, i had added the namespace given by you and problem related to Dllimport was solved....thanks for it....... But the given below exception was coming in the line:- second = int.Parse(buffer.ToString()); the exception was that input string is not in correct format and i had selected the mp3 file by clicking the browse button................... do suggest me the solution to it........... bye....
Mike MPosted Sep 25, 2008, 8:46 PM
Claims that input string was not in the correct format. Any ideas?
jaspreet kaureditedPosted Sep 25, 2008, 2:29 PMEdited Sep 25, 2008, 2:35 PM
The type or namespace name 'DllImport' could not be found (are you missing a using directive or an assembly reference? Well the above error is coming when i wrote the source code given by you in my application.. Please tell what sould be done to remove the error??? I have this dll in my system and i even added it as a reference by ADD REFERENCE option but again its reference couldnt be added saying it is not a valid one. So please provide me the solution to it........
jaspreet kaurPosted Sep 24, 2008, 5:46 AM
WHAT IS [DllImport("winmm.dll")]?and how to add this in the code in VS 2005 with C#?
Mithun BalanPosted Sep 24, 2008, 1:40 AM
Wat happends in mciSendString. Is it in build ?