Development: WAV File Format
From WxWiki
[edit] Waveform (WAVE/WAV)
Part of Developers_Notebook-WAV-File Formats
|Offset|Count|Type |Description |Notes |0 |4 |wxByte |"RIFF" |Common to many MSW file types |4 |1 |wxUint32|File Size - 8| |8 |4 |wxByte |"WAVE" |Key indicator for WAVE files
unsigned long nFmtSize = 16; unsigned short nFormat = 1 /*WAVE_FORMAT_PCM*/; Write((void*)"fmt ", 4, 1); Write(&nFmtSize, 4); //write WAVEFORMATEX
/*
unsigned short nFormat; //...PCM
unsigned short nChannels; // 1 = mono 2 = stereo unsigned long nSamplesPerSec; //Sample Rate unsigned long nBytesPerSec; unsigned short nBlockAlign; unsigned short nBitsPerSample; //8, 16 ...
*
Invisible params:
block align = channels * bits/sample [/ 8|>> 3]
bytes per second = sample rate * block align
total time in seconds = nPCMLength / bytesm per second
*
- /
Write(&nFormat, 2); Write(&nNumChannels, 2); Write(&nSampleRate, 4); Write(&nBytesPerSecond, 4); Write(&nBlockAlign, 2); Write(&nBitsPerSample, 2);
//write data Write((void*)"data", 4, 1); Write(&nNumToWrite, 4); Write(pData, nNumToWrite, nNumChannels);
