How to Receive data from StartContinuousRecognitionAsync() of Microsoft Cognitive speech client library
Asked Answered
T

2

6

Not able to find how to get data from StartContinuousRecognitionAsync() as I want to Receive data So that i can process the data only after a keyword.

Tailored answered 30/7, 2018 at 11:36 Comment(0)
Q
3

Try this:

...

recognizer = new SpeechSDK.SpeechRecognizer(speechConfig, audioConfig);

recognizer.startContinuousRecognitionAsync(cb?: () => void, err?: (e: string) => void);

//  The event recognizing signals that an intermediate recognition result is received.
recognizer.recognizing = function(s, e){
    console.log('recognizing text', e.result.text);
};

//  The event recognized signals that a final recognition result is received.
recognizer.recognized = function(s, e){
    console.log('recognized text', e.result.text);
    script += e.result.text;
};
Quotient answered 19/11, 2018 at 23:4 Comment(0)
G
1

You have to 'listen' to speech events to receive the speech recognition results from the speech endpoint. This is explained in the docs as well as demonstrated in the samples.

Here is a C# sample: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/how-to-recognize-speech-csharp#continuous-speech-recognition-from-a-file

For the latest set of samples, check out our https://aka.ms/csspeech/samples GitHub repository.

An additional comment regarding this statement:

So that i can process the data only after a keyword.

The scenario for the SDK is that you transcribe an audio stream to text (more the scenario: press a button and start speaking)..It is not necessary the scenario to wait for a keyword, and start transcribing from that point on.

It is theoretical possible to 'wait for the keyword' with the SDK, more suited for this are dedicated 'keyword spotter', perhaps even with low power support! We plan to make something like this available in a future version (but no ETA yet). KWS functionality is already available in the 'Speech Device Development Kit (preview)', see here: https://learn.microsoft.com/en-us/azure/cognitive-services/speech-service/speech-devices-sdk

Hope this helps Wolfgang

Gallicize answered 2/8, 2018 at 9:12 Comment(2)
The link now points to a page which has a sample of short STT from a microphone and not from a file. Is no longer uses the STT SDK.Chthonian
Unfortunately correct, the documentation was changed... Still the mentioned github repository is a good place to find samples for microphone and file scenarios. an additional note: KWS functionality is now included in the SDK for Windows and Android. It works best with a microphone array, as this optimizes significantly the quality.Gallicize

© 2022 - 2024 — McMap. All rights reserved.