#198 Warning on reading IEEE float wave file


When feeding 32bit IEEE float wave file (with WAVE_FORMAT_EXTENSIBLE header), mysterious warning is always shown like this:
"WARN wav: wave header missing FmtExt chunk"
This is because missing condition in if statement around line 629 of wav.c.
Adding condition on WAVE_FORMAT_IEEE_FLOAT will fix this issue.

if (wav->formatTag != WAVE_FORMAT_PCM &&
wav->formatTag != WAVE_FORMAT_ALAW &&
wav->formatTag != WAVE_FORMAT_MULAW) {
if (len >= 2) {
lsx_readw(ft, &wExtSize);
len -= 2;
} else {
lsx_warn("wave header missing FmtExt chunk");

Also, in the same function, by the following check, currently 64bit float wav cannot be read.
By adding case 8: condition, it can at least be read (though it's converted to 32bit float internally).

switch (bytespersample)
case 1:
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
ft->encoding.encoding = SOX_ENCODING_UNSIGNED;

case 2: case 3: case 4:
if (ft->encoding.encoding == SOX_ENCODING_UNKNOWN)
ft->encoding.encoding = SOX_ENCODING_SIGN2;

lsx_fail_errno(ft,SOX_EFMT,"Sorry, don't understand .wav size");
return SOX_EOF;


  • Ulrich Klauer

    Ulrich Klauer - 2012-10-16

    I'm not sure about the first issue. I think the WAV spec (which is a difficult read) could be interpreted in such a way that *only* WAVE_FORMAT_PCM files may leave out the extended part. It seems that is how http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html reads it. In that case, the warning would be legitimate, and we should even give it on a-law and mu-law files without the extension. So I haven't touched this, only changed the wording of the warning to say "extended part of fmt chunk" instead of "FmtExt chunk".

    The second issue is clearly a bug, which is now fixed in git (commit fc127d0).

  • Ulrich Klauer

    Ulrich Klauer - 2012-10-16
    • assigned_to: nobody --> uklauer
    • status: open --> pending
  • nu774

    nu774 - 2012-10-16

    Please read this page:

    In this page, structure WAVEFORMATIEEEFLOATEX is described, and cbSize is set to 22 (same as integer PCM case). It is simply typedef-ed alias for WAVEFORMATEXTENSIBLE structure, declared in mmreg.h of Windows SDK header.
    So, there's no trailing after that. Same as integer PCM.


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks