Azure-Samples / cognitive-services-speech-sdk

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

Cannot Recognize Speech Invalid WAV header in file, data block was not found #962

Closed twizzyyanki closed 3 years ago

twizzyyanki commented 3 years ago

I have a wav file and I am trying to use it to text azure speech to text using this url - https://azure.microsoft.com/en-us/services/cognitive-services/speech-to-text/#features. I am getting Cannot Recognize Speech Invalid WAV header in file, data block was not found error. I am not sure what is wrong and why I am getting this error. The wav file looks totally fine to me. This is the file I am using to test - http://talonsoftwares.com/upload/2422332.wav

pankopon commented 3 years ago

Hi, thanks for reporting the issue - the problem occurs because of a WAV header size limit in the JavaScript SDK. There is now a pull request to raise this limit: https://github.com/microsoft/cognitive-services-speech-sdk-js/pull/328

For comparison, https://github.com/Azure-Samples/cognitive-services-speech-sdk/blob/master/sampledata/audiofiles/aboutSpeechSdk.wav where the header has no metadata:

image

and your 2422332.wav which contains an INFO chunk in the header which happens to go over the limit:

image

BriceChivu commented 2 years ago

Hello, I faced the same issue and I solved it simply by converting my audio sample rate from 48kHz to 16kHz. It worked well after that.

Stefuu commented 2 months ago

solved it by converting to 16kHz too, weird that it doesn't work out of the box, but it's MS right haha