C# code for recording a wav file from microphone and generating a waveform