azure prononciation assessment async assessment

Iheb Jandoubi 5 Reputation points
2024-05-07T17:04:34.3266667+00:00

i'am using azure speech recognizer sdk , to do the prononciation assessment of an audio file. the problem when the speech is in french the results are always low , and no expressive

    const language = await detectSingleSpeechLanguage(text)

      //Connect to the prononciation assessment ressource
      const speechConfig = sdk.SpeechConfig.fromSubscription(
        "keys",
        "eastus"
        );
        speechConfig.setProperty()
      //download the audio of user from the blob storage
      const audioBlobClient = await storageConnectionAudio(audioBlobName);
      await waitForBlob(audioBlobClient);
    
      const audio = await audioBlobClient.download();
      const downloadedFile = await streamToBuffer(audio.readableStreamBody);
     
      let audioConfig = sdk.AudioConfig.fromWavFileInput(downloadedFile);
      console.log(audioConfig)
      let speechRecognizer = new sdk.SpeechRecognizer(
        speechConfig,
        audioConfig
      );
     
      const pronunciationAssessmentConfig = sdk.PronunciationAssessmentConfig.fromJSON(
        "{\"GradingSystem\": \"HundredMark\", \
        \"Granularity\": \"Phoneme\", \
        \"EnableMiscue\": \"True\", \
        \"EnableProsodyAssessment\": \"True\"}"
    );
    pronunciationAssessmentConfig.referenceText = text;
      if (language === "English") {
        speechConfig.speechRecognitionLanguage = "en-US";
      } 
      if (language === "French"){
        speechConfig.speechRecognitionLanguage = "fr-FR";
      }
      
      
      pronunciationAssessmentConfig.applyTo(speechRecognizer);
     //Start of the prononciation assessment 
      speechRecognizer.recognizeOnceAsync(async (result) =>
      
      {console.log(result)
        switch (result.reason) {

          case sdk.ResultReason.RecognizedSpeech:
            const pronunciation_result =
              sdk.PronunciationAssessmentResult.fromResult(result);

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

1 answer

Sort by: Most helpful
  1. romungi-MSFT 42,761 Reputation points Microsoft Employee
    2024-05-08T07:45:41.1433333+00:00

    @Iheb Jandoubi Try to add the language in the creation of SpeechRecognizer() instance rather than speechConfig() as defined in the sample from github.

    See the sample implementation from github.

    speechRecognizer = new SpeechRecognizer(speechConfig, "fr-FR", audioConfig)
    
    
    

    You can essentially keep the speechConfig() to setting the endpoint and set the language in the recognizer and apply the pronunciation config to the recognizer.

    P.S: Please don't share your keys in code snippets. I have removed here to ensure the keys are mis-utilized. Please regenerate your keys and try the above recommendation. Thanks!!

    0 comments No comments