RecognizeOnceAsync finish before audio is finished

Familia maura sastre 1 Reputation point
2021-07-12T13:35:04.38+00:00

Hi, i'm using a wav file that has a little silence. The method RecognizeOnceAsync stops converion to text until that point. How can i force the method to listen ALL the audio?

This is my code:
async static Task<string> RecognizeFromMic(SpeechConfig speechConfig)
{
using var audioConfig = AudioConfig.FromWavFileInput("Ejemplo de pedido.wav");
using var recognizer = new SpeechRecognizer(speechConfig, audioConfig);

            var result = await recognizer.RecognizeOnceAsync();
            switch (result.Reason)
            {
                case ResultReason.RecognizedSpeech:
                    Console.WriteLine($"RECOGNIZED: Text={result.Text}");
                    break;
                case ResultReason.NoMatch:
                    Console.WriteLine($"NOMATCH: Speech could not be recognized.");
                    break;
                case ResultReason.Canceled:
                    var cancellation = CancellationDetails.FromResult(result);
                    Console.WriteLine($"CANCELED: Reason={cancellation.Reason}");

                    if (cancellation.Reason == CancellationReason.Error)
                    {
                        Console.WriteLine($"CANCELED: ErrorCode={cancellation.ErrorCode}");
                        Console.WriteLine($"CANCELED: ErrorDetails={cancellation.ErrorDetails}");
                        Console.WriteLine($"CANCELED: Did you update the subscription info?");
                    }
                    break;
            }
            return result.Text;
        }

Thanks

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,380 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Familia maura sastre 1 Reputation point
    2021-07-13T13:44:11.027+00:00

    No, i have an audio wav file. I do not need continous as i do not want to show progress or listen all time.

    The docs are clear :

    The end of a single utterance is determined by listening for silence at the end, or until a timeout period has elapsed
    

    The question is how to set this timeout or threshold silence....

    I have an azure suscription and i would like to know if there is some sort of option to set more time. I'm subscribed to S0 Standard...

    Thanks

    0 comments No comments

  2. Familia maura sastre 1 Reputation point
    2021-07-14T11:14:31.367+00:00

    I've changed the code to use your StartContinuousRecognitionAsync. and now all the wav is processed.

    But, very strange. Look at my code:

    recognizer.Recognizing += (s, e) =>
                        {
                            text = e.Result.Text;
    
                            Console.WriteLine($"RECOGNIZING: Text={e.Result.Text}");
    
                            Dispatcher.Invoke(()=>this.ctText.Text=e.Result.Text);
                        };
    

    When recognition arrives at 30 s the variable text holds the text converted.
    But THEN, e.Result.Text starts again!!!!

    So, if full text should be 'hello i'm your friend and i would like to .............. Glad to see you again'

    At second 29, text is:

    text=hello i'm your friend and i would like to....

    Then at second 30 text is:

    text=Glad to see you again

    Do have my account some sort of limitation= That's not normal...


  3. Familia maura sastre 1 Reputation point
    2021-07-16T10:18:39.807+00:00

    I have no suport plan. I can send you my project and the audios....

    0 comments No comments