In this API I had successfully created Identification Profile, as well as created enrollment successfully and checked the operation status and received successfully enrolled.
Now I am trying to identify speaker but I am getting an error : b'{"error":{"code":"BadRequest","message":"Audio too long"}}' b'{"error":{"code":"BadRequest","message":"Audio too short"}}'
I tried various voice samples with different sizes like 5-Second, 10-Second, 15-Second, 30-Second, 40-Seconds, 80-Seconds. And also mentioned identificationProfileIds should be as strings (How to do that)
For audio Recording, I am using $rec -c 1 -r 16000 -b 16 xa.wav
But still getting the same errors I hope there might be some problem in my code. Please Help me If you can provide me the code for Speaker - Identification it will be so much helpful
import http.client, urllib.request, urllib.parse, urllib.error, base64
subscription_key = 'XXXXXXXXXXXXXXXXXXXX'
headers = {
# Request headers
'Content-Type': 'multipart/form-data',
'Ocp-Apim-Subscription-Key': subscription_key,
}
params = urllib.parse.urlencode({
# Request parameters
# 'shortAudio': 'false',
"identificationProfileIds":"080d22d6-917e-487f-a553-fb13a0575067",
})
try:
conn = http.client.HTTPSConnection('speaker-recognition-api.cognitiveservices.azure.com')
body = open('xa.wav','rb')
#aud = base64.b64encode(body.read())
print(body)
conn.request("POST", "/spid/v1.0/identify?identificationProfileIds=080d22d6-917e-487f-a553-fb13a0575067&%s" % params, body, headers)
response = conn.getresponse()
print(response)
data = response.read()
print(data)
conn.close()
except Exception as e:
print("[Errno {0}] {1}".format(e.errno, e.strerror))