Azure-Samples / cognitive-services-speech-sdk

Sample code for the Microsoft Cognitive Services Speech SDK
MIT License
2.96k stars 1.86k forks source link

How to add the EnableProsodyAssessment in the api request? using JS #2230

Closed disio1126 closed 5 months ago

disio1126 commented 10 months ago

Hello, first of all thank you for your time. I am creating a JS widget to analyse pronunciation. using the services of Speech Studio and its Pronunciation Assessment Tool. All good so far, just a small detail, exploring its functions in the Speech Studio I noticed that there shows in the JSON response some values that my widget does not throw which is the Prosody Score and consequently to see the results of the syllables this does not throw other important information such as Feedback where reports such as Unexpected Break or Miss Break are found.

3 2 1

Looking for information in the posts of microsofot I came to the conclusion that it is because of the following condition in the request: EnableProsodyAssessment that should be sent in True since by default this deactivated, I have tried to send it of all the possible forms in the each of parameters but it continues without giving me results, some idea of how to soulucionarlo?

This is my code

var subscriptionKey = "XXXXXXXXXXXXXXXXXXX"; var region = "eastus";

const referenceText = reftext.value; const enableProsodyAssessment = true; var pronAssessmentParamsJson = '{"ReferenceText":"' + referenceText + '","GradingSystem":"HundredMark","Granularity":"Phoneme","enableProsodyAssessment":"True","EnableMiscue":"True","PhonemeAlphabet":"IPA","NBestPhonemeCount":"5","Dimension":"Comprehensive"}';

var pronAssessmentParams = btoa(unescape(encodeURIComponent(pronAssessmentParamsJson)));

const apiUrl = `https://${region}.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1?language=${idioma_general}`;

const options = {
    method: 'POST',
    headers: {
        'Accept': 'application/json;text/xml',
        'Content-Type': 'audio/wav; codecs=audio/pcm; samplerate=16000',
        'Ocp-Apim-Subscription-Key': subscriptionKey,
        'Pronunciation-Assessment': pronAssessmentParams

    },
    body: blob
};
github-actions[bot] commented 9 months ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

github-actions[bot] commented 7 months ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

pankopon commented 7 months ago

@yulin-li @yinhew Any comments/update on this?

yinhew commented 7 months ago

@wangkenpu can you take a look?

github-actions[bot] commented 6 months ago

This item has been open without activity for 19 days. Provide a comment on status and remove "update needed" label.

wangkenpu commented 5 months ago

Hi @disio1126, REST API doesn't support prosody assessment and there is no plan to support it currently. If you'd like to use the prosody assessment, we suggest you use Speech SDK.

FYI. https://learn.microsoft.com/en-us/azure/ai-services/speech-service/how-to-pronunciation-assessment?pivots=programming-language-javascript