To begin tell them that my English is not very good but try to explain my problem.
I'm working with NAudio library to process audio in C # .Net.
I'm recording an audio file (WAV) and then process the data without any problem this way.
Then edit the code when I write the wav file in the following way.
Sorry for my bad English
I'm working with NAudio library to process audio in C # .Net.
I'm recording an audio file (WAV) and then process the data without any problem this way.
WaveChannel32 wave = new WaveChannel32(new WaveFileReader(rutaWav));
arch = new StreamWriter(rutaCsv);
byte[] buffer = new byte[16384];
int read = 0;
objS.iniTiempo();
while (wave.Position < wave.Length)
{
read = wave.Read(buffer, 0, 16384);
for (int i = 0; i < read / 4; i++)
{
double val = BitConverter.ToSingle(buffer, i * 4);
objS.Escenario(val);
arch.WriteLine(val); // CSV file just to check the data
}
}
arch.Close();
My problem is that I need to do the same but instead of reading a WAV file I read the same data directly from the microphone.Then edit the code when I write the wav file in the following way.
ficheroOndaSalidaEscenario.Write(e.Buffer, 0, e.BytesRecorded);
for (int i = 0; i < e.BytesRecorded/4 ; i++)
{
double val = BitConverter.ToSingle(e.Buffer, i*4);
arch_dinamico.WriteLine(val); // // CSV file just to check the data
}
But the result is not the same as reading the WAV file, I searched for information for many days and still not find the answer please if anyone knows how to solve my problem appreciate your helpSorry for my bad English