Results 1 to 3 of 3

Thread: Speech to Text question

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2020
    Posts
    7

    Speech to Text question

    Would it be feasible to use the speech recognition engine to record text from a movie in the form of a wave file? In perusing sample code for the speech objects, it seems that perhaps the only words recognized would have to be in the choices object. Is that a false assumption on my part?

  2. #2
    Member
    Join Date
    Jul 2019
    Location
    Ahmedabad
    Posts
    56

    Re: Speech to Text question

    Hello, @DonaldJamesParker
    Please try this code, To Speech to Text question.

    Here is a quick sample that shows one of the simplest .NET windows forms app to use a dictation grammar that I could think of. This should work on Windows Vista or Windows 7. I created a form. Dropped a button on it and made the button big. Added a reference to System.Speech and the line:

    Code:
    using System.Speech.Recognition;
    Then I added the following event handler to button1:
    Code:
    private void button1_Click(object sender, EventArgs e)
    {         
        SpeechRecognitionEngine recognizer = new SpeechRecognitionEngine();
        Grammar dictationGrammar = new DictationGrammar();
        recognizer.LoadGrammar(dictationGrammar);
        try
        {
            button1.Text = "Speak Now";
            recognizer.SetInputToDefaultAudioDevice();
            RecognitionResult result = recognizer.Recognize();
            button1.Text = result.Text;
        }
        catch (InvalidOperationException exception)
        {
            button1.Text = String.Format("Could not recognize input from default aduio device. Is a microphone or sound card available?\r\n{0} - {1}.", exception.Source, exception.Message);
        }
        finally
        {
            recognizer.UnloadAllGrammars();
        }                          
    }
    A little more information comparing the various flavors of speech engines and APIs shipped by Microsoft can be found.

    I hope this code will be useful to you.
    Thank you,
    < advertising removed by moderator >

  3. #3

    Thread Starter
    New Member
    Join Date
    Jun 2020
    Posts
    7

    Re: Speech to Text question

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width