//This stops the recording functionality and does the speack to text convertion //INPUT: //OUTPUT: private void stopRecording() { //Stop the timer timerClock.Stop(); //stop recordinmg from the microphone audioCapture a = new audioCapture(); a.OnRecordingStopped(null, null); //Enable/Disable the buttons as required btnStartCommand.Enabled = true; btnStopCommand.Enabled = false; //Show the length of the sample for the user to see double sampleLength = (audioCapture.recordingEnded - audioCapture.recordingStarted).TotalMilliseconds * 0.001; lblRecordingLength.Text = Math.Round(sampleLength, 2).ToString(); //If the sample lenght is greater than 2.5 seconds if (doSpeechTextValidation()) { string sitekey = ""; string username = ""; string website = ""; string encryptedPass = ""; bool keyFound = false; //If we find a valid login, then find the matching website and login credientials foreach (DataGridViewRow dr in dgvUserAccounts.Rows) { sitekey = dr.Cells["SiteKey"].Value.ToString(); username = dr.Cells["username"].Value.ToString(); website = dr.Cells["website"].Value.ToString(); encryptedPass = dr.Cells["password"].Value.ToString(); if (txtTextRecognises.Text.ToLower().Contains(sitekey.ToLower())) { keyFound = true; break; } } if (keyFound) { EncryptionDecrypt ende = new EncryptionDecrypt(); frmWebLoader f = new frmWebLoader(website, username, ende.Decrypt(encryptedPass)); f.ShowDialog(); } else { MessageBox.Show("Unable to find matching logon details for the command spoken"); } } else { MessageBox.Show("Do Nothing here"); } }
private void btnPlayback1_Click(object sender, EventArgs e) { this.Cursor = Cursors.WaitCursor; audioCapture a = new audioCapture(); a.onPlayback(ref audioStream1); this.Cursor = Cursors.Default; }
private void btnRecord1_Click(object sender, EventArgs e) { //Enable/Disable the buttons as required audioCapture a = new audioCapture(); functionResult f = a.onRecord(ref audioStream1); if (f.Result == true) { timerClock.Start(); setValidStream(false); btnStopRecord1.Enabled = true; } }
private void btnSpeakCommand_Click(object sender, EventArgs e) { //create the audio capture functionality and start recording audioCapture a = new audioCapture(); functionResult r = a.onRecord(ref audioStream1); if (r.Result == true) { //If there are no errors. Set the lable text and button enable/disable. //also start the timer txtTextRecognises.Text = "Please say your command:"; timerClock.Start(); btnStartCommand.Enabled = false; btnStopCommand.Enabled = true; } }
private void btnRecord_Click(object sender, EventArgs e) { //create the audio capture functionality and start recording audioCapture a = new audioCapture(); functionResult r = a.onRecord(ref audioStream1); if (r.Result == true) { //If there are no errors. Set the lable text and button enable/disable. //also start the timer timerClock.Start(); btnRecord.Enabled = false; btnCreate.Enabled = false; btnStopRecording.Enabled = true; } }
//This stops the recording functionality and starts the validation //INPUT: //OUPUT private void stopRecording() { //Stop the timer timerClock.Stop(); lblValidation.ForeColor = Color.Black; //stop recordinmg from the microphone audioCapture a = new audioCapture(); a.OnRecordingStopped(null, null); //Enable/Disable the buttons as required btnRecord.Enabled = true; btnStopRecording.Enabled = false; //Show the length of the sample for the user to see double sampleLength = (audioCapture.recordingEnded - audioCapture.recordingStarted).TotalMilliseconds * 0.001; lblRecordingLength.Text = Math.Round(sampleLength, 2).ToString(); //If the sample lenght is greater than 2.5 seconds if (sampleLength > 2.5) { //Start the progress bar so the user can see something is happening progressBar1.Style = ProgressBarStyle.Marquee; lblValidation.Text = "Validating, please wait"; if (doSpeechTextValidation(txtTextToRead.Text)) { performSpeakerValidation(); validSpeech = true; } // if (chkAutoLogin.Checked == true) btnContinue_Click(null, null); else { validSpeech = false; progressBar1.Style = ProgressBarStyle.Continuous; lblValidation.Text = "Invalid User"; lblValidation.ForeColor = Color.Salmon; } } }
//This stops the recording functionality private void stopRecording() { //Stop the timer timerClock.Stop(); //stop recordinmg from the microphone audioCapture a = new audioCapture(); a.OnRecordingStopped(null, null); //Enable/Disable the buttons as required btnRecord.Enabled = true; btnStopRecording.Enabled = false; //Show the length of the sample for the user to see double sampleLength = (audioCapture.recordingEnded - audioCapture.recordingStarted).TotalMilliseconds * 0.001; lblRecordingLength.Text = Math.Round(sampleLength, 2).ToString(); //If the sample lenght is greater than 5 seconds if (sampleLength > 5) { btnCreate.Enabled = true; } }
private void btnStopRecord1_Click(object sender, EventArgs e) { timerClock.Stop(); audioCapture a = new audioCapture(); a.OnRecordingStopped(sender, null); //This create the wave output that is shown on the screen var waveFormat = WaveFormat.CreateMuLawFormat(8000, 1); using (var x = new RawSourceWaveStream(audioStream1, waveFormat)) { waveViewerSample1.WaveStream = x; } //Enable/Disable the buttons as required setValidStream(true); //Show the length of the sample for the user to see double sampleLength = (audioCapture.recordingEnded - audioCapture.recordingStarted).TotalMilliseconds * 0.001; lblSample1Length.Text = Math.Round(sampleLength, 2).ToString(); }
private void btnSaveStream_Click(object sender, EventArgs e) { audioCapture a = new audioCapture(); a.onSaveFile(ref audioStream1, "wavefile1.wav"); }