public MyMediaStreamSource() { _waveFormat = new WaveFormatEx(); _waveFormat.BitsPerSample = 16; _waveFormat.AvgBytesPerSec = (int)ByteRate; _waveFormat.Channels = ChannelCount; _waveFormat.BlockAlign = ChannelCount * (BitsPerSample / 8); _waveFormat.ext = null; // ?? _waveFormat.FormatTag = WaveFormatEx.FormatPCM; _waveFormat.SamplesPerSec = SampleRate; _waveFormat.Size = 0; // must be zero _waveFormat.ValidateWaveFormat(); _stream = new System.IO.MemoryStream(); }