You must also adjust the headers (chunk and sub-chunks) data to match the size of the new (shortened) file. Assuming the file uses RIFF_WAVE format, you can use this structure:
typedef struct {
char chunkID[4]; DWORD chunkSize; char type[4]; char fmt[4]; DWORD fmtSize; } RiffHdr_t;
fmtSize
specifies the size of the following "fmt " block which may be a
WAVEFORMAT
,
PCMWAVEFORMAT
, or
WAVEFORMATEX
structure (defined in
mmsystem.h). After this follows a "data" section containing the raw sound data.
See also
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/[
^]