-
Notifications
You must be signed in to change notification settings - Fork 84
Description
I have a issue regarding the recognizing, recognized event. I have issue, that when a speaker speeks for a long time without interruption the recognized event does not get triggered for a long time, and alot of recognizing text starts being displayed/corrected which makes it hard to read for the user. I would like a faster trigger from the recognizing to the recognized event. Is there any way in the SDK to make a limit, lets say that after 5 seconds of speech it automatically triggers the recognized event.
CODE:
async function sttFromMic() {
const tokenObj = await getTokenOrRefresh();
const speechConfig = speechsdk.SpeechConfig.fromAuthorizationToken(tokenObj.authToken, tokenObj.region);
speechConfig.speechRecognitionLanguage = 'en-US';
const audioConfig = speechsdk.AudioConfig.fromDefaultMicrophoneInput();
const recognizer = new speechsdk.SpeechRecognizer(speechConfig, audioConfig);
setDisplayText('speak into your microphone...');
recognizer.recognizing = (s, e) => {
setDisplayText(`RECOGNIZING: Text=${e.result.text}`);
};
recognizer.recognizeOnceAsync(result => {
if (result.reason === speechsdk.ResultReason.RecognizedSpeech) {
setDisplayText(`RECOGNIZED: Text=${result.text}`);
} else {
setDisplayText('ERROR: Speech was cancelled or could not be recognized. Ensure your microphone is working properly.');
}
});
}