I'm having a problem with NAudio 1.8 when creating a .wav file from a G711 RTP stream. Can anyone help?
The wav files created by NAudio have loud machine-gun noise that obscures the voice audio. Intelligible audio is present, but it's masked by the pulsating, clicking noise. Wireshark plays audio from the pcap files without a problem. Wireshark shows the sample rate is 8K ulaw.
Here's my code:
if (wavOutput == null)
{
string today = DateTime.Now.ToString("yyyy-MM-dd");
wavOutput = new WaveFileWriter("D:\Calls\" + today + "\" + CallID + ".wav", new WaveFormat(8000, 16, 1));
}
for (int index = 0; index < udpPacket.PayloadData.Length; index++)
{
short pcm = MuLawDecoder.MuLawToLinearSample(udpPacket.PayloadData[index]);
wavOutput.WriteByte((byte)(pcm & 0xFF));
wavOutput.WriteByte((byte)(pcm >> 8));
The wav files created by NAudio have loud machine-gun noise that obscures the voice audio. Intelligible audio is present, but it's masked by the pulsating, clicking noise. Wireshark plays audio from the pcap files without a problem. Wireshark shows the sample rate is 8K ulaw.
Here's my code:
if (wavOutput == null)
{
string today = DateTime.Now.ToString("yyyy-MM-dd");
wavOutput = new WaveFileWriter("D:\Calls\" + today + "\" + CallID + ".wav", new WaveFormat(8000, 16, 1));
}
for (int index = 0; index < udpPacket.PayloadData.Length; index++)
{
short pcm = MuLawDecoder.MuLawToLinearSample(udpPacket.PayloadData[index]);
wavOutput.WriteByte((byte)(pcm & 0xFF));
wavOutput.WriteByte((byte)(pcm >> 8));