0

As you know the repository includes a STT quick sample code (JS Browser) : here

However, I am specifically looking for continous speech translation quickstart sample code. I could not find it anywhere else. Normally, I am supposed to bind "recognizing, recognized, and canceled" events to get results on the textarea html, but it did not give any result though i tried the additional code below.

Things got too complicated for me . Is there any way to transform the available 'onceshot stt' into 'continuous speech translation' sample?

var speechConfig = SpeechSDK.SpeechTranslationConfig.fromSubscription(subscriptionKey.value, serviceRegion.value);

        speechConfig.speechRecognitionLanguage = languageSourceOptions.value;
        let language = languageTargetOptions.value
        speechConfig.addTargetLanguage(language)

        var audioConfig  = SpeechSDK.AudioConfig.fromDefaultMicrophoneInput();;

        recognizer = new SpeechSDK.TranslationRecognizer(speechConfig, audioConfig);
        recognizer.recognized = (s, e) => {
          if (e.result.reason == ResultReason.RecognizedSpeech) {
              console.log(`TRANSLATED: Text=${e.result.text}`);
              phraseDiv.innerHTML += `TRANSLATED: Text=${e.result.text}`
          }
          else if (e.result.reason == ResultReason.NoMatch) {
              console.log("NOMATCH: Speech could not be translated.");
          }
      };
        recognizer.startContinuousRecognitionAsync();
      });

0 Answers0