Click here to Skip to main content
15,901,284 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to convert .wma to mono, PCM 8 KHz .wav format using C#. Which should be particularly compatible with Windows server 2008/ XP and 7.

Does this work?
Posted

1 solution

The best thing I know is ffmpeg or related libav. Please see:
http://en.wikipedia.org/wiki/FFmpeg[^],
http://en.wikipedia.org/wiki/Libavcodec[^],
http://ffmpeg.org/[^],
http://libav.org/[^].

You can see how it works and implement it in C#, but it would be huge amount of work, even if you want to implement the required minimum.

A trivial solution will be: to obtain or build executable from source code and then execute it as a child process via System.Diagnostics.Process.Start: http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx[^].

Also, you can obtain and build the libraries and link them using P/Invoke.

If you need to learn P/Invoke, start from here:
http://en.wikipedia.org/wiki/P/Invoke[^],
http://msdn.microsoft.com/en-us/library/Aa712982[^].

This CodeProject can also be useful: Essential P/Invoke[^].

One alternative to P/Invoke is to use C++/CLI mixed-mode (managed+unmanaged) project. This project could build a DLL required by the global hooks, but it can contain some managed wrapper CLI code, so, from the standpoint of your .NET application, you can use it as a regular .NET assembly, that is, reference it. Please see:
http://en.wikipedia.org/wiki/C%2B%2B/CLI[^],
http://www.ecma-international.org/publications/standards/Ecma-372.htm[^],
http://msdn.microsoft.com/en-us/library/xey702bw.aspx[^],
http://msdn.microsoft.com/en-us/library/3bstk3k5[^].

If you want to re-distribute the libraries in compiled form, there is a legal problem: due to patent issues or something, they are not re-distributed on pre-compiled form.

—SA
 
Share this answer
 
Comments
Espen Harlinn 5-Dec-12 18:11pm    
Good reply :-D
Sergey Alexandrovich Kryukov 5-Dec-12 21:58pm    
Thank you, Espen.
--SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900