I just checked, and yes, the WAVE reading code doesn't skip over chunks correctly... I'll stick this on my dolist. I've never run into a WAV file with extra chunks, but I already had to do the equivalent for AIFF, which was a bear...
cheers Miller
On Tue, Jul 03, 2001 at 03:09:05PM +0100, Richard Dobson wrote:
You are basically saying that the WAVE parsing is wrong (as it so often is in unix apps!). It takes about three extra lines of simple code to jump over unknown chunks, and then ~all~ WAVE files (e.g those produced by Csound including the PEAK chunk - which PD could find very useful anyway!) can be read by PD. The WAVE spec requires that the data chunk is after the fmt chunk, so this simple skipping of unknown chunks will always work. In fact, there can be other chunks ~before~ the fmt chunk; it should not be presumed to be immediately after the RIFF<>WAVE<> elements.
I have some example files with the PEAK chunk on my "Soundcard Attrition Page", if anyone wants to experiment. There are also some examples with a 'long' header as used in CDP.
Richard Dobson
Krzysztof Czaja wrote:
- The readsf~ (and soundfiler) objects assume there is a 'data' chunk
right after a 'fmt' chunk in a .wav file. If your sound was saved in wavelab or some such windowish app, there could be another chunk in between, like a 'PAD' chunk. If so, then readsf~ reads only from this extra chunk (which is usually all zeros) -- and you 'really have to work out how big your header is'...
-- Test your DAW with my Soundcard Attrition Page! http://www.bath.ac.uk/~masrwd (LU: 3rd July 2000) CDP: http://www.bath.ac.uk/~masjpf/CDP/CDP.htm (LU: 23rd February 2000)