private void btnRecord_MouseDown(object sender, MouseEventArgs e) { lblRecordStatus.Text = "RECORDING..."; lblRecordStatus.ForeColor = Color.Red; tmrRecording.Enabled = true; if (dgvSentences.SelectedRows.Count < 1) { return; } if (!Directory.Exists(audioDir)) { Directory.CreateDirectory(audioDir); } wavAudio = new RecordWaveAudio(audioDir, dgvSentences.CurrentRow.Cells[0].Value.ToString(), cmbInputDevices.SelectedIndex); wavAudio.Start(); }
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(); }
private void usrRecAudio_Load(object sender, EventArgs e) { cmbInputDevices.DataSource = RecordWaveAudio.InputAudioDevices(); cmbInputDevices.SelectedIndex = 0; }
private void button2_Click(object sender, EventArgs e) { comboBox1.DataSource = RecordWaveAudio.InputAudioDevices(); }