microsoft / Cognitive-SpeakerRecognition-Python

Python SDK for the Microsoft Speaker Recognition API, part of Cognitive Services
https://www.microsoft.com/cognitive-services/en-us/speaker-recognition-api
Other
109 stars 62 forks source link

Getting Bad request error for enrolment - Speaker Recognition #2

Closed margaretmz closed 8 years ago

margaretmz commented 8 years ago

From @rajagopal28 on May 17, 2016 8:4

Hi, I've been trying to enroll a voice file for a created profile using the python API. I was able to create a profile and list all profiles successfully. But when I try to enroll a voice (.wav) file with a simple hello world phrase with the created profile, I get the error 'ERROR:root:Error enrolling profile.' which in the trace tells 'Exception: Error enrolling profile: Bad Request'. If needed I can attach the stack trace. Can you help me getting started with this?

Copied from original issue: Microsoft/ProjectOxford-ClientSDK#66

margaretmz commented 8 years ago

From @rajagopal28 on May 18, 2016 8:35

It seems like an API problem, I've tried hitting the actual endpoint with a POST request along with the documentation specified parameters and headers. I get the response { 'status' : 'Bad request', message: 'Not a valid WAVE file - No RIFF header'. I've tried with multipart/form-data and using file input from postman REST client. I've also tried to hit the API endpoint in the actual console provided by Microsoft (which doesn't have any way to pass the wave file as file input) by encoding the audio file into string(which starts with data:audio/wav;base64..) Can anyone from Microsoft answer this. I know its in preview stage, but it should have some understandable instructions and parameter details.

margaretmz commented 8 years ago

From @momohs on May 18, 2016 9:31

Hi @rajagopal28, Thanks for your comments. Can you please attach the *.wav file used for enrollment?

margaretmz commented 8 years ago

From @rajagopal28 on May 18, 2016 10:42

I've used 3 files, I'm attaching all the three Archive.zip

@momohs I see that you are from Microsoft. In the API console link for enrolling and verifying there are text fields to send the audio file, In what format it should be sent? I used base64 encoded text (as mentioned above), I get the same error. Can you please clarify this? Thanks for your comment.

margaretmz commented 8 years ago

From @cthrash on May 19, 2016 2:23

It looks like the enrollment audio is too short. The audio file should be at least 20 seconds long and no longer than 5 minutes. The minimum number of total speech needed for enrollment, after removing silence, is 60 seconds.

@momohs - one improvement to consider is to include the response body in the exception. In this case it would have made the error much more obvious: { "error": { "code": "BadRequest", "message": "Audio too short" }

margaretmz commented 8 years ago

From @rajagopal28 on May 19, 2016 7:15

@cthrash Thank you so much. It worked, I enrolled a voice phrase to the created profile. It would be better if there is a way to know this message('Not a valid WAVE file - No RIFF header' or 'Audio too short') in the python wrapper log. It only shows the code ('BadRequest'), which is not so helping in identifying the issue.

margaretmz commented 8 years ago

From @momohs on May 19, 2016 16:41

@rajagopal28 I have tried out the files you sent and I did some successful enrollments with them. However, the file "password.wav" has an incorrect sampling rate. and thus gave me an "incorrect sampling rate error". I have used a REST client for this.

Regarding the python wrapper, the enrollments were successful but I have received a "Bad request" for the file "password.wav". Indeed the exception needs to be better handled in the python wrapper.

Using the console, I am not sure how to attach the file to the request. I am in contact with the team responsible for that. I'll get back to you once it is sorted out.

@cthrash The "Audio Too Short" exception message is currently thrown out by the server if the audio is too short. At this moment, the audio should be from 1 to 15 seconds (as mentioned in the API Documentation)

margaretmz commented 8 years ago

From @cthrash on May 19, 2016 18:8

1-15 seconds, IIUC, is for Speaker Verification. In the Stack Overflow Post, @rajagopal28 is asking (despite the title) about Speaker Identification, as you can see from the call stack.

margaretmz commented 8 years ago

From @jjsuarez on June 25, 2016 22:21

Hello, I am also having problems enrolling an audio file in the API testing console. Please can you answer the question that @rajagopal28 asked, what format should be used in the Request body field? I am getting the same error: { "error": { "code": "BadRequest", "message": "Invalid Audio Format: Not a WAVE file - no RIFF header" } }

My file is recorded according to the required parameter values of format and length. Any help would be greatly appreciated. Thanks a lot.

margaretmz commented 8 years ago

From @momohs on June 26, 2016 13:51

Thanks for your feedback @jjsuarez! We are aware of the issue with uploading audio files using the API Testing Console and we are still sorting it out! Meanwhile, I urge you to use the Python sample code or the C# sample code or the Online demos to test the Speaker Recognition service.

momohs commented 8 years ago

I will close this issue for now, please feel free to re-open if you still have a problem.

taunkankur commented 7 years ago

I am getting

{ "error": { "code": "BadRequest", "message": "InvalidPhrase" } }