I am recording bytes that coming from serial port and converting them to wav file using NAudio. However when I plot my wav file it does have a proper look. Its range is 0 to 1 but other wav files have the range -1 to 1. Is it related with the encoding or something else?
WaveFormat waveFormat = new WaveFormat(8000, 8, 1);
using (WaveFileWriter writer = new WaveFileWriter(fileName, waveFormat))
{
writer.Write(audioBuffer, 0, audioBuffer.Length);
}
This depends on the data type within your "audioBuffer".
32-bit floating point audio samples are usually in the range from -1.0 to 1.0. 16-bit integer audio samples are usually signed in the range -32768 to 32767. 8-bit integer audio samples are very commonly unsigned, with the range being 0 to 255, with 128 being the same as 0.0 in floating point.