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
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();
}
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With