views:

836

answers:

5

Microsoft Silverlight 4 is in beta. It supports PCM audio output. It would be madness to stream PCM over internet (for ex in P2P chart webApp) so we need Pure C# open source PCM to Mp3 convertor. No unmanaged code, nothing going out of .net sandbox.

So does any one know such Pure C# open source PCM to Mp3 convertor?

What do I need:

  • Open Source Libs for encoding.
  • Tutorials and blog articles on How to do it, about etc.

BTW: why Pure C#? - because Silverlight 4 does not support unmanaged or just not C# DLL's.

A: 

mp3 is not a free codec. Try looking for Ogg instead, youve got better chances of finding an open source one there.

Also codec translations are rarely in managed code, because they need high efficiency, as in, it is a CPU intensive task , so going to a native dll would be a lot faster. (for varying levels of a lot). If you found what you are looking for it would be slow and probably violating the fraunhofer copyright.

Two seconds at google shows a c# example to use a native dll mp3 encoder: http://www.codeproject.com/KB/audio-video/MP3Compressor.aspx

Three seconds at google did not yield any ogg encoders. These things are rare in managed code.

Karl
A: 

Are you sure a pure C# implementation is necessary? You could just wrap the lame.dll and use that instead. If you're capturing audio live and then streaming it as an mp3, this link might help.

The other thing is, I think MP3 isn't your only option for streaming. Silverlight should support WMA and there should be a pure C# way of doing that to.

Here's a link to a tutorial project that streams mp3s.

Richard Nienaber
> link to a tutorial project that streams mp3s.streamer plays, it does not encode!(
Blender
You stated in your other question (http://stackoverflow.com/questions/1781741/pure-c-open-source-pcm-to-ogg-convertor), that Silverlight doesn't support unmanaged dlls. Silverlight is a client-side technology and the tutorial project shows that it supports MP3. Consequently, it doesn't matter in what way you get the PCM into MP3 on the server, managed or unmanaged.
Richard Nienaber
A: 

It doesnt exist yet and it would be slowwer than unmanaged code, but you could try converting java ogg encoder http://downloads.xiph.org/releases/vorbis-java for a skype-audio like solation

slyi
A: 

If you're looking to encode high quality music-level sound in Silverlight, I think you may be out of luck, until someone gets around to porting the Ogg Vorbis encoder. But if you just need to do voice, there's a reasonable port of the Speex video codec to pure (Silverlight) C# called CSpeex, posted here. It's a (mostly automated) C# port of a Java port of a ~2003 version of the Speex codec, but I've made it work. And of course, it's only part of the solution for streaming audio up to a server (and down), but it's arguably the most difficult part.

No joy for any C# echo cancellation, however . . . until someone gets brave and ports the Speex DSP library to C# :-).

Ken Smith