Click here to Skip to main content
15,887,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi, I have a C # project that I want to add to that unique voice recognition feature.
Can I add this feature to my C# project using OpenCV or other tools?

What I have tried:

So far, I've only been able to implement a text-sensitive voice recognition program, but that's not enough because it's not sensitive to a specific sound:
C#
public partial class EnVoiceUC : UserControl
    {
        public EnVoiceUC()
        {
            InitializeComponent();
        }
        string[] dialogs = Program.dlgArr;
        private void Recorder_SpeechRecognized(object sender, SpeechRecognizedEventArgs e)
        {
            Form1 f1 = new Form1();
            string recText = e.Result.Text;
            for (int i = 0; i < dialogs.Length; i++)
            {
                if(dialogs[i]==recText)
                {
                    try
                    {
                        ((Form)this.TopLevelControl).Hide();
                        f1.ShowDialog();
                        ((Form)this.TopLevelControl).Close();
                    } catch {;}
                }
            }
        }

        private void DoRecord_Click(object sender, EventArgs e)
        {
            System.Media.SystemSounds.Beep.Play();
            VoiceRecorder(true);
        }

        public void VoiceRecorder(bool enable)
        {
            Choices voices = new Choices();
            SpeechRecognitionEngine recorder = new SpeechRecognitionEngine();
            voices.Add(dialogs);
            Grammar gramer = new Grammar(new GrammarBuilder(voices));
            label2.Visible = enable;
            if (enable)
            {
                try
                {
                    recorder.RequestRecognizerUpdate();
                    recorder.LoadGrammar(gramer);
                    recorder.SpeechRecognized += Recorder_SpeechRecognized;
                    recorder.SetInputToDefaultAudioDevice();
                    recorder.RecognizeAsync(RecognizeMode.Multiple);
                }
                catch { return; }
            }
            else
            {
                try { recorder.UnloadGrammar(gramer); } catch { return; }
            }
        }
    }
Posted
Comments
[no name] 15-Jun-20 15:33pm    
Users subscribe and "pay" for real-time voice translation services from providers for a particular language. No gold from straw.
[no name] 17-Jun-20 23:15pm    
Check this cognitive service available in Azure
https://azure.microsoft.com/en-in/services/cognitive-services/speaker-recognition/

It works well for this cause.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900