これは単純なストリーム操作です。
- wav ファイルのヘッダーを読み取る必要があります。
- データバイトを読み取る必要があります。
MSDN から貼り付けます。
BinaryReader reader = new BinaryReader(waveFileStream);
//Read the wave file header from the buffer.
int chunkID = reader.ReadInt32();
int fileSize = reader.ReadInt32();
int riffType = reader.ReadInt32();
int fmtID = reader.ReadInt32();
int fmtSize = reader.ReadInt32();
int fmtCode = reader.ReadInt16();
int channels = reader.ReadInt16();
int sampleRate = reader.ReadInt32();
int fmtAvgBPS = reader.ReadInt32();
int fmtBlockAlign = reader.ReadInt16();
int bitDepth = reader.ReadInt16();
if (fmtSize == 18)
{
// Read any extra values
int fmtExtraSize = reader.ReadInt16();
reader.ReadBytes(fmtExtraSize);
}
int dataID = reader.ReadInt32();
int dataSize = reader.ReadInt32();
// Store the audio data of the wave file to a byte array.
byteArray = reader.ReadBytes(dataSize);
// After this you have to split that byte array for each channel (Left,Right)
// Wav supports many channels, so you have to read channel from header
これはより詳細な説明です:
http://msdn.microsoft.com/en-us/library/ff827591.aspx
ここでは、WAV ファイル形式について読むことができます。
https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
そして、複素数と FFT としての WAV について:
波形データを複素数に変換する方法