[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] [ot] new 24-bit wav file format



Erik de Castro Lopo wrote:

> This is a standard 24 bit PCM WAV file using the WAVE_FORMAT_EXTENSIBLE
> format marker.

Actually, i did find something unusual about this file after all.

>     RIFF : 118776
>     WAVE
>     fmt  : 40
>       Format        : 0xFFFE => WAVE_FORMAT_EXTENSIBLE
>       Channels      : 2
>       Sample Rate   : 44100
>       Block Align   : 6
>       Bit Width     : 24
>       Bytes/sec     : 264600
>       Valid Bits    : 24
>       Channel Mask  : 0x3
>       Subformat
>         esf_field1 : 0x1
>         esf_field2 : 0x0
>         esf_field3 : 0x10
>         esf_field4 : 0x80 0x0 0x0 0xAA 0x0 0x38 0x9B 0x71 
>     fact : 1972
>       frames  : 0
>     data : 116736
>     End

Those who know the WAVE file format know that 'RIFF', "WAVE',
'fmt ', 'fact' and 'data' are the chunk markers.

The odd thing about this particular file is that the fact chunk
is large (1972 bytes instead of the usual 4 bytes). Secondly,
the frames count is 0 instead of the correct value (for this 
file) of 19456.

I wouldn't actually call this file mal-formed, but it is unusual.
Fortunately libsndfile simply handles it correctly. I wouldn't 
be surprised if other WAVE file parsers get it wrong, especially 
since I know how much time and effort I have put into making 
sure my parser is reasonably robust.

Erik
-- 
+-----------------------------------------------------------+
  Erik de Castro Lopo  nospam@xxxxxxxxxxxxx (Yes it's valid)
+-----------------------------------------------------------+
"Projects promoting programming in natural language are intrinsically
doomed to fail." -- Edsger Dijkstra