1.11M Members

Playing mp3 in C#

 
0
 

Hello, I want to ask if there is any way to play an mp3 file in C# without the use of P/Invoke or winmp dll and the like. I can use external libraries too. It would also be nice if I could "include" the mp3 in the C# project, as I will only be playing one sound, and the user is unable to choose.

 
1
 

use this code u will be able to play wave as well as MP3 File if working dont forgate to mark solved

System.Media.SoundPlayer player = new System.Media.SoundPlayer();
 
player.SoundLocation = "My Wav File.wav";
player.Play();
WMPLib.WindowsMediaPlayer wplayer = new WMPLib.WindowsMediaPlayer();
 
wplayer.URL = "My MP3 file.mp3";
wplayer.controls.play();
 
0
 

No, that uses windows functions. I want to make it such that it does not depend on any external function, dll or library.

 
0
 

Hello, I want to ask if there is any way to play an mp3 file in C# without the use of P/Invoke or winmp dll and the like. I can use external libraries too. It would also be nice if I could "include" the mp3 in the C# project, as I will only be playing one sound, and the user is unable to choose.

Hi Visit this weblog, Goude U Fully...
http://www.deyamil.persianblog.ir

 
0
 

I can't read tamil. Besides, I cannot use external libraries, external including system.media

 
0
 

I can't read tamil. Besides, I cannot use external libraries, external including system.media

Ok, why can't you use the built in support for what you're trying to accomplish?

 
0
 

You see, asked my prof and he said I have to find some way to play the mp3 directly, without anything else. Actually I already know of SoundPlayer, but it needs the mp3 in a file, I need the program to be integrated, as one assembly. The only way would be to include the mp3 in the project. Is it possible? If not I will have to choose another project. Maybe this is one of his "unsolvables", as he likes to play tricks on us.

 
0
 

So let me get this straight...

You want to play an MP3 file, but you can't use the built-in library, or any external library?

So you want to play an MP3 file without using any functionality?

This cannot be achieved. Either use the System.Media.SoundPlayer, or use a DLL file. They are your ONLY options (unless you want to low level program some soundcard I/O port and just hope the hell that it's actually there)

 
0
 

Ok. Thanks. Now to tell my mates not to choose this project :)

 
0
 

Ok. Thanks. Now to tell my mates not to choose this project :)

I would talk to your professor again, and clarify he actually meant you couldn't use .NET with your C# project.

I have a hard time believing that's what he meant.

C# is useless without .NET. He had to know you'd use it. I'd clarify that he meant you couldn't use any API or DLLs outside C# and .NET.

My money is on the latter.

 
0
 

I would talk to your professor again, and clarify he actually meant you couldn't use .NET with your C# project.

I have a hard time believing that's what he meant.

C# is useless without .NET. He had to know you'd use it. I'd clarify that he meant you couldn't use any API or DLLs outside C# and .NET.

My money is on the latter.

Hmmmmm... I just had a thought. Is he trying to 'dis' C#? Or drive home how hard it is to write an MP3 player from scratch?

I have had professors that have done stupid stuff like that.

 
0
 

Right... Turns out that you lost the money. I asked him, and he said NO .NET usage, besides basic stuff like System.IO and System.Console, and things like vars etc.

 
0
 

Hello...
In this page,I send answer's of play sound by C#.net.
Click Here
excuse me for i don't write english well!!!

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: