How to convert audio from any format to .wav formatI need to develop a web application to convert any kind of audio to .wav and able to play the converted wav files in the browser.But this should be done programmatically without using any purchased licenses.How can i do this.Though i am new to this but i still tried the below code but it's not working.can anyone help me out.
My code in .aspx page
<h4>Select a file to upload:</h4>
<asp:FileUpload ID="FileUpload1" AllowMultiple="true"
Text="Save Converted file"
My code in code behind-
string fileName = string.Empty;
string savePath = string.Empty;
protected void Page_Load(object sender, EventArgs e)
protected void UploadBtn_Click(object sender, EventArgs e)
savePath = Server.MapPath(".") + "\\TempFiles\\";
fileName = Server.HtmlEncode(FileUpload1.FileName);
string extension = System.IO.Path.GetExtension(fileName);
if ((extension == ".DSS") || (extension == ".ds2") || (extension == ".dss") || (extension == ".WAV"))
savePath += fileName;
UploadStatusLabel.Text = "Your file was uploaded successfully.";
UploadStatusLabel.Text = "Your file was not uploaded because " +
"it does not have a .dss or .ds2 or .wav extension.";
static void ToWav(string filename, string path)
using (DsReader dr = new DsReader(filename))
IntPtr format = dr.ReadFormat();
using (WaveWriter ww = new WaveWriter(File.Create(path + ".wav"), AudioCompressionManager.FormatBytes(format)))
byte data = dr.ReadData();
With the above code it creates a wav file in my application folder but it asks to purchase it.Here i am attaching the screen shots to show where i got strucked.