I wrote a program that read information from a .wav file . I received the following results.
chunkId :RIFF
chunkSize :7828798
format :WAVE
Junk chunk :JUNK
Junk size :92
Format chunk :fmt
format chunk size :65536
Audioformat :1
numberofchanels :48000
samplerate :1996488704
Byterate :131073
BlockAlign :16
bitspersample :0
subchunk2Id :
subchunk2Size :0
I don't know why wav header like that. I use sox program to look header of this wav file . And here is result
Input File : 'AUDIO00001.wav'
Channels : 1
Sample Rate : 48000
Precision : 16-bit
Duration : 00:01:17.28 = 3709621 samples ~ 5796.28 CDDA sectors
File Size : 7.83M
Bit Rate : 810k
Sample Encoding: 16-bit Signed Integer PCM
Why's my program wrong??
I update my question: my wav header structure:
struct WAVHEADER
{
char chunkID[4];
unsigned int chunkSize;
char format[4];
char junkChunk[4];
int junkSize;
char junkData[92];
char bext[4];
unsigned int bextSize;
char bextData[602];
char subchunk1ID[4];
unsigned int subchunk1Size;
unsigned short audioFormat;
unsigned short numberOfChanels;
unsigned int sampleRate;
unsigned int byteRate;
unsigned short blockAlign;
unsigned short bitsPerSample;
char subchunk2ID[4];
unsigned int subchunk2Size;
};
wav class:
wav::wav(const char* filepath)
{
std::ifstream wavFile(filepath);
if(wavFile.is_open())
{
wavFile.read((char*)&wavHeader,sizeof(WAVHEADER));
}
}
My confusing is that when subChunk1ID is correct ("fmt") , why does subchunk1Size seem wrong ??