I have a .wav file which contains the text "hello".
The objective is to read the .wav file and to get the text back. I am using NAudio for this purpose by using the below piece of code
using (WaveFileReader reader = new WaveFileReader("D:\\test.wav"))
{
byte[] buffer = new byte[reader.Length];
int read = reader.Read(buffer, 0, buffer.Length);
short[] sampleBuffer = new short[read / 2];
System.Buffer.BlockCopy(buffer, 0, sampleBuffer, 0, read);
}
And while converting the array back to string, I am receiving blank text
var bytes = a.SelectMany(x => BitConverter.GetBytes(x)).ToArray();
var originalText = System.Text.Encoding.Unicode.GetString(bytes);
What is that I am missing?