rposbo / speaker-recognition-api

A simple demo project for the Microsoft Cognitive Services Speaker Recognition APIs
https://rposbo.github.io/speaker-recognition-api/
30 stars 14 forks source link

400 (Bad Request) #6

Closed lumayara closed 4 years ago

lumayara commented 4 years ago

My logs are showing: ...working...

speaker-recognition-api-demo-core.js:438 creating profile
speaker-recognition-api-demo-core.js:438 {"identificationProfileId":"here they show the id profile and I am omitting"}
identifyuserarm.cognitiveservices.azure.com/spid/v1.0/identificationProfiles/omitting this key/enroll?shortAudio=true:1 POST https://identifyuserarm.cognitiveservices.azure.com/spid/v1.0/identificationProfiles/omitting this key/enroll?shortAudio=true 400 (Bad Request)
speaker-recognition-api-demo-core.js:438 enrolling
speaker-recognition-api-demo-core.js:438 {"error":{"code":"BadRequest","message":"Invalid Http Request"}}
speaker-recognition-api-demo-core.js:438 Ugh. I can't poll, it's all gone wrong.
lumayara commented 4 years ago

I checked and the profile has been created but it is not saving my voice to it.

rposbo commented 4 years ago

Thanks for highlighting this; I can recreate it, so it looks like the required format of the audio may have changed. I'll investigate, but if you can figure it out please submit a PR!

tadasauciunas commented 4 years ago

"List Verification Phrases" returns the same response with 400 response code, so this is not an issue with the audio format, since listing the phrases is a simple GET request.

rposbo commented 4 years ago

Ah, no, I've fixed that in another branch I need to merge; API endpoints have changed and it breaks if you specify a content type unnecessarily

On Wed, 27 Nov 2019, 12:48 tadasauciunas <notifications@github.com wrote:

"List Verification Phrases" returns the same response with 400 response code, so this is not an issue with the audio format, since listing the phrases is a simple GET request.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rposbo/speaker-recognition-api/issues/6?email_source=notifications&email_token=AACNGSJMAYONBUJIE6KY6K3QVZUBVA5CNFSM4JR35UN2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEFJMUPI#issuecomment-559073853, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACNGSM2KSLRVIECAFJIRODQVZUBVANCNFSM4JR35UNQ .

tadasauciunas commented 4 years ago

I have a demo in 40 minutes, would it be possible to have a fix prepared till then? :D

lumayara commented 4 years ago

Hi @rposbo thank you so much! I've been struggling with this since yesterday but still no luck. I will be following your project and if I can figure it out here I will post it. Thanks!

rposbo commented 4 years ago

Hi @lumayara,

An update: if you head back to https://rposbo.github.io/speaker-recognition-api/ and enter your "endpoint" (as specified in your Azure Cognitive Services dashboard panel, e.g "https://rposbo-demo.cognitiveservices.azure.com/spid/v1.0/") as well as your key, then the list verification phrases button will work.

I'm still working on the other ones, as it seems like the audio requirements might have changed.

rposbo commented 4 years ago

Oh wait, the verification now works too: image

So it's just Identification that's not working.

rposbo commented 4 years ago

Might be related to https://github.com/MicrosoftDocs/azure-docs/issues/25798

I've enabled logging on my Azure Cognitive Services account and have raised a support request. Let's see what happens :)

lumayara commented 4 years ago

Thank you very much @rposbo !

yshahin commented 4 years ago

@lumayara, @rposbo The problem was fixed. The speaker recognition service was updated to asp.net core and with it some extra checks were added. https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html Any multi-part message must specify boundary Looking at the request made from the tool I don’t see a boundary.

For backward compatibility, I have allowed the current request to succeed.

For future reference, the code should either remove the content-type header request.setRequestHeader('Content-Type','multipart/form-data'); Or change it to request.setRequestHeader('Content-Type','application/octet-stream');

Thanks

rposbo commented 4 years ago

@yshahin Thank you! Can't believe I removed that header from the Verification section, but not from the Identification section.

This now works: https://rposbo.github.io/speaker-recognition-api

image

Can you check please @lumayara ?

Fixed in c612feeaad677b3aefdfc1585b97c6a9b11be8c2

lumayara commented 4 years ago

@yshahin @rposbo you guys are awesome! Yes! everything works now! Thank you :)