我目前正在查看WAV文件的以下信息,并且我遇到了其标题中包含的WAV文件的“ChunkSize”。但是,我无法理解如何计算ChunkSize的值。根据
http://tiny.systems/software/soundProgrammer/WavFormatDocs.pdf
36 + SubChunk2Size, or more precisely:
4 + (8 + SubChunk1Size) + (8 + SubChunk2Size)
This is the size of the rest of the chunk
following this number. This is the size of the
entire file in bytes minus 8 bytes for the
two fields not included in this count:
ChunkID and ChunkSize.
我现在已经看了大约40分钟了,我不明白数字的来源。例如,“4”来自哪里,“8”是哪个?
答案 0 :(得分:3)
根据WavFormatDocs链接中的第一个图表,ChunkSize是Format
,SubChunk1ID + SubChunk1Size + SubChunk1
和SubChunk2ID + SubChunk2Size + SubChunk2
字段中的总字节数:
Format: 4 bytes
SubChunk1ID + SubChunk1Size: 4 + 4 = 8 bytes
SubChunk1: <SubChunk1Size> bytes
SubChunk2ID + SubChunk2Size: 4 + 4 = 8 bytes
SubChunk2: <SubChunk2Size> bytes
---------------------------------------------------
4 + (8 + SubChunk1Size) + (8 + SubChunk2Size) bytes
fmt
块是固定大小的:
SubChunk1ID: 4 bytes
SubChunk1Size: 4 bytes
SubChunk1: 16 bytes
--------
24 bytes
所以ChunkSize
是:
Format: 4 bytes
fmt chunk: 24 bytes
SubChunk2ID: 4 bytes
SubChunk2Size: 4 bytes
SubChunk2: <SubChunk2Size> bytes
---------------------
36 + <SubChunk2Size> bytes