0
I’m recording audio with the code below:
public WaveIn waveSource = null;
public WaveFileWriter waveFile = null;
private void StartBtn_Click_1(object sender, EventArgs e)
{
if(System.IO.File.Exists(@"D:\TELEFONE\Gravacao01.wav"))
{
System.IO.File.Delete(@"D:\TELEFONE\Gravacao01.wav");
}
StartBtn.Enabled = false;
StopBtn.Enabled = true;
btnPausar.Enabled = true;
waveSource = new WaveIn();
waveSource.WaveFormat = new WaveFormat(44100,1);
waveSource.DataAvailable += new EventHandler<WaveInEventArgs>(waveSource_DataAvailable);
waveSource.RecordingStopped += new EventHandler<StoppedEventArgs>(waveSource_RecordingStopped);
waveFile = new WaveFileWriter(@"D:\TELEFONE\Gravacao01.wav", waveSource.WaveFormat);
waveSource.StartRecording();
// waveFile.
}
private void StopBtn_Click_1(object sender, EventArgs e)
{
StopBtn.Enabled = false;
btnPausar.Enabled = false;
waveSource.StopRecording();
}
void waveSource_DataAvailable(object sender, WaveInEventArgs e)
{
if (waveFile != null)
{
waveFile.Write(e.Buffer, 0, e.BytesRecorded);
waveFile.Flush();
}
}
void waveSource_RecordingStopped(object sender, StoppedEventArgs e)
{
if (waveSource != null)
{
waveSource.Dispose();
waveSource = null;
}
if (waveFile != null)
{
waveFile.Dispose();
waveFile = null;
}
}
But when I open recording by windows media player the recording volume is low
Windows Forms or WPF?
– Leandro Angelo
Windows Forms Forms
– Jhony