The default "BufferMilliseconds" is 100ms.
int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000;
For a 11,025 sample rate, 16 bit format, bufferSize = 2205, which is incorrect.
Suggested Fix:
int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000;
if (bufferSize % WaveFormat.BlockAlign != 0)
{
bufferSize -= bufferSize % WaveFormat.BlockAlign;
}
int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000;
For a 11,025 sample rate, 16 bit format, bufferSize = 2205, which is incorrect.
Suggested Fix:
int bufferSize = BufferMilliseconds * WaveFormat.AverageBytesPerSecond / 1000;
if (bufferSize % WaveFormat.BlockAlign != 0)
{
bufferSize -= bufferSize % WaveFormat.BlockAlign;
}