private void button1_Click(object sender, EventArgs e)
 {
     if (button1.Text == "Gravar")
     {
         button1.Text = "Parar";
         audio        = new RecordWaveAudio(Application.StartupPath, "TESTE");
         audio.Start();
     }
     else
     {
         if (audio != null)
         {
             audio.Stop();
             audio = null;
         }
         button1.Text = "Gravar";
     }
 }
        private void btnRecord_MouseUp(object sender, MouseEventArgs e)
        {
            dgvSentences.MultiSelect = false;

            tmrRecording.Enabled      = false;
            lblRecordStatus.Text      = "Hold the button to record.";
            lblRecordStatus.ForeColor = Color.Black;

            if (wavAudio != null)
            {
                wavAudio.Stop();
                wavAudio = null;
            }
            AudioFileReader reader  = new AudioFileReader(Path.Combine(audioDir, dgvSentences.CurrentRow.Cells[0].Value.ToString() + ".wav"));
            TimeSpan        silence = AudioUtil.GetSilenceDuration(reader, AudioUtil.SilenceLocation.Start);

            MessageBox.Show("Silence: " + silence.TotalMilliseconds.ToString());
            NextSentenceRow();
        }