Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: SOX U-Law WAV to "Microsoft WAV" (Read 4993 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

SOX U-Law WAV to "Microsoft WAV"

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)

SOX U-Law WAV to "Microsoft WAV"

Reply #1
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: [Select]
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.

 

SOX U-Law WAV to "Microsoft WAV"

Reply #2
That is what I was afraid of. Is there any way to get around this or am I SOL?

Thanks