I have a raw audio file captured from a camera in the format u-law mono 8KHZ (no wav headers). The problem I am having is that when I try to play back the file, I just seem to get bad noise. I have plugged the raw audio through a program called goldwave, and it is able to playback the file perfectly. I am sure I am just missing something simple.
I have been trying to use the waveout functions but with no luck. Do I need to decode the data from u-law first before trying to push it through the waveout functions?
If you’re just using the waveOut functions in the Windows API, the third parameter to
waveOutOpenis a pointer to aWAVEFORMATEXstructure:A
WAVEFORMATEXstructure lets you specify the format, and Windows should be able to do u-Law without you needing to install anything.Set
wFormatTagtoWAVE_FORMAT_MULAW, or 0x0007. Be sure you fill out the other parameters correctly for 1 channel with 8000 samples/sec and 8 bits/sample.If that fails, please post the code where you open the audio device and play the file. Or here’s a delphi implementation of u-Law decoding to linear PCM (
ulawDecode) so you can decode it yourself:http://www.koders.com/delphi/fidEAA58384F59968FEDD0670F6EABF09DF3A5C58A5.aspx?s=algorithm#L19