I am trying to record my microphone input and instead of saving the recording in a wav
file in local hard drive I want to store it in array of bytes in real time.
So while I am speaking it would be recording my voice and storing bytes in an array in real time.
Is it possible?
currently the code I am using only records my voice then eventually after I am done with recording it will save it in a file.
and here is the code :
[DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi, SetLastError = true, ExactSpelling = true)]
private static extern int mciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
// START RECORDING
mciSendString("open new Type waveaudio Alias recsound", "", 0, 0);
mciSendString("record recsound", "", 0, 0);
// STOP RECORDING
mciSendString(@"save recsound " + "Hello" + ".wav", "", 0, 0);
mciSendString("close recsound ", "", 0, 0);
You are using task? () Is a Windows Forms application or Webforms? You can create Task using asynchronous. Asynchronous programming.