Help - Search - Members - Calendar
Full Version: SOX U-Law WAV to "Microsoft WAV"
Hydrogenaudio Forums > Hydrogenaudio Forum > General Audio
Shane N
I've got U-Law WAVs that I need to encode to the Microsoft WAV format.

When I run the following command, and open the file test.wav, it works fine:
sox.exe "ulawfile.wav" -t wav -r 16000 test.wav

However, I need to run this in a PHP site, and would like it to start the download immediately so the user doesn't have to wait for it to encode, so I run this:
sox.exe "ulawfile.wav" -t wav -r 16000 -

That command is executed and the results are dumped out immediately. However, when you try to play the file, it works fine, but you cannot "jump" ahead in the file. When you click on an area in the playback bar, it gives me an error "Windows Media Player cannot play the file." If I start it from the beginning and let it play by itself, it works fine, I just can't jump around in the playback.

What would cause this?

(Sorry if this isn't the right forum, I couldn't find one that dealt with WAVs directly)
42ndSSD
sox writes .wav files with the initial length set to zero, then when the input is finished it rewrites the header with the correct value. Since you're sending the output through a pipe it can't rewrite the header; it normally gives a warning like:

CODE

sox: Length in output .wav header will be wrong since can't seek to fix it


This could cause the problems you're seeing with skipping in the file, since whatever you're using to play it doesn't know how long it is.
Shane N
That is what I was afraid of. Is there any way to get around this or am I SOL?

Thanks
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.