tips on how to convert odd wave file format?

NJDubois

Well-known member
Joined
May 15, 2008
Messages
84
Programming Experience
Beginner
Hello hello! I'd like to submit a question to the panel! Please, mercy!

hehe. Here is the situ. I need to take downloaded audio files, convert them to mp3, name them based on data from a mysql database, link this new name to that mysql record, and ftp upload to the host.

I have all of this done, and working. The program has been doing just swell for years. Ahhh haaa but now you see we have a client who is working with a new company that is providing these recordings in some weird wav format.

I say weird because I can only open it in windows media player (default install on win 8.1) but it warns me that "The file you are attempting to play has an extension (.wav) that does not match the file format." Clicking "Yes" will load the file in wmp and it plays. I can't get it to open in winamp, and I can't get the command line audio management tool "sox.exe" to work with it. When I try to convert it with SOX, it outputs "sox.exe FAIL formats: can't open input file 'audio.wav': WAVE: RIFF header not found" Which can be caused by any list of things and didn't give help.

Now, lets go back to Windows media player. Going to the properties of the audio file, I get the audio codex:
Windows Media Audio 9.1 10 kbps, 11 khz, mono 1-pass CBR

Just playing around, I renamed the file from audio.wav to audio.wma and I could play it in winamp now! Sox.exe couldn't work with it still. Didn't know the extension.

So I am here asking what you would do? The audio management program I wrote is called PASTER (written in vb.net), and it uses the command line audio tool SOX.EXE to convert files. The user has very little to do with the process. Windows tells the app when a new audio file has been downloaded, paster picks it up, converts it using sox if needed, then allows the user to play, and select a username, date and score(to match to mysql record) and upload it to the host. Has worked for years with mp3, wav, and au files.

Any suggestions?

Thanks a ton!

Nick
 

jmcilhinney

VB.NET Forum Moderator
Staff member
Joined
Aug 17, 2004
Messages
14,553
Location
Sydney, Australia
Programming Experience
10+
It would appear that the files are not some odd or weird WAV format at all. They are WMA files plain and simple, just with an incorrect extension. It's just like taking an Excel file and saving it with a ".doc" extension, to use non-computer-related analogue, like putting salt into a jar and then writing "Sugar" on the lid. A file extension is just a label. It doesn;t actually affect the file contents; it's just supposed to indicate to anyone, be they person or computer application, what the file contains. Just like a jar though, there's nothing to stop you putting an incorrect label on a file.

So, WMP is smart enough to realise that the file is not a WAV despite the extension and that it's a WMA file, given that WMA is one of the "native" formats of WMP. Your other applications are not so smart. Winamp obviously takes the extension at face value and simply assumes a dodgy file if the format does match. It sounds like Sox simply doesn't support WMA. If you must have MP3 files, you're going to have to find some other tool that can successfully convert a WMA file to MP3.
 
Top Bottom