Recording voice using winmm.dll

  • Thread starter Thread starter Yasintha Srimanthi
  • Start date Start date
Y

Yasintha Srimanthi

Guest
Hi,

I have a created a small application that records and save audio. However, my application needs to save the wave file to the sever computer.

I used my code in my asp.net application ,It is working fine in local machine.

But if I publish it on server, It does not save the recording on server machine. But it create wav file with zero length.

Please can some one help me with this problem??

I am using VS2017 Web form application.

My code :

public class AudioHandler
{

[DllImport("winmm.dll", CharSet = CharSet.Auto)]
private static extern uint mciSendString([MarshalAs(UnmanagedType.LPTStr)] string command,
StringBuilder returnValue,
int returnLength,
IntPtr winHandle);

public AudioHandler()
{
mciSendString("Open new Type waveaudio alias rec", null, 0, IntPtr.Zero);
}
public void Record()
{
mciSendString("Record rec", null, 0, IntPtr.Zero);
}

public void Save(string path)
{
uint result = 0;
result = mciSendString("save rec "+ path , null, 0, IntPtr.Zero);

}

public void Dispose()
{
mciSendString("close rec", null, 0, IntPtr.Zero);
}
}

Continue reading...
 
Back
Top