when i records audio with the sample WaveIn class, it's get wrong speed, if i shoose rate different from 8000. Only in 8 kHz i've got correct speed - on the 16000 audio got two times longer and lower tone, at 44000 it almost nothing to hear, sound terrify. Please check, what i've done wrong.
public static void StartRecording(string path, int device)
{
waveInStream = new WaveIn();
writer = new WaveFileWriter(path, waveInStream.WaveFormat);
waveInStream.DeviceNumber = device;
waveInStream.WaveFormat = new WaveFormat(8000, 32, 1);
waveInStream.BufferMilliseconds = 200;
waveInStream.NumberOfBuffers = 4;
waveInStream.DataAvailable += waveInStream_DataAvailable;
waveInStream.StartRecording();
}
static void waveInStream_DataAvailable(object sender, WaveInEventArgs e)
{
writer.Write(e.Buffer, 0, e.BytesRecorded);
}
public static void StartRecording(string path, int device)
{
waveInStream = new WaveIn();
writer = new WaveFileWriter(path, waveInStream.WaveFormat);
waveInStream.DeviceNumber = device;
waveInStream.WaveFormat = new WaveFormat(8000, 32, 1);
waveInStream.BufferMilliseconds = 200;
waveInStream.NumberOfBuffers = 4;
waveInStream.DataAvailable += waveInStream_DataAvailable;
waveInStream.StartRecording();
}
static void waveInStream_DataAvailable(object sender, WaveInEventArgs e)
{
writer.Write(e.Buffer, 0, e.BytesRecorded);
}