Reputation: 7525
Is there a way to convert WAV files to MP3 in ASP.NET? I have heard of LAME but haven't found any examples for a web application. Also, I wasn't sure if it can be commercially used.
Thanks
Upvotes: 11
Views: 16248
Reputation: 1039418
There's an article on CodeProject showing how to compress a wave file in C# using the Lame codec. It is a managed wrapper around the codec.
Upvotes: 2
Reputation: 2341
try this code:
public void mciConvertWavMP3(string fileName, bool waitFlag) {
string outfile= "-b 32 --resample 22.05 -m m \""+pworkingDir+fileName + "\" \"" + pworkingDir+fileName.Replace(".wav",".mp3")+"\"";
System.Diagnostics.ProcessStartInfo psi=new System.Diagnostics.ProcessStartInfo();
psi.FileName="\""+pworkingDir+"lame.exe"+"\"";
psi.Arguments=outfile;
psi.WindowStyle=System.Diagnostics.ProcessWindowStyle.Minimized;
System.Diagnostics.Process p=System.Diagnostics.Process.Start(psi);
if (waitFlag)
{
p.WaitForExit();
}
}
Upvotes: 14