Speech To Text with REST API returns 'Success' with a partial word

Ian Choi 0 Reputation points
2023-08-17T03:26:27.0233333+00:00

I'm trying to use REST API for Speech To Text as below.

            const endpoint = `https://${azureRegion}.stt.speech.microsoft.com/speech/recognition/conversation/cognitiveservices/v1`;
            const query = new URLSearchParams({ language: 'en-US' });
            const url = `${endpoint}?${query}`;

            const headers = {
              'Ocp-Apim-Subscription-Key': azureSubscriptionKey,
              'Content-Type': 'audio/wav; codecs=audio/pcm; samplerate=16000',
              'Accept': 'application/json'
            };
        
            const response = await fetch(url, {
              method: 'POST',
              body,
              headers,
            });

And I used a wav file tested by many people as a reference, saying "What's the weather like".

API response looks not correct because DisplayText ontains only a partial word of the audio. ("The.")

Recognition result: {
  RecognitionStatus: 'Success',
  Offset: 8900000,
  Duration: 44500000,
  DisplayText: 'The.'
}

FYI the code above gets the arraybuffer of the wav file for 'body'. Please let me know how to fix it it...

Azure AI Speech
Azure AI Speech
An Azure service that integrates speech processing into apps and services.
1,976 questions
JavaScript API
JavaScript API
An Office service that supports add-ins to interact with objects in Office client applications.
1,057 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.