Compute a voiceprint
In this guide you will learn how to compute a voiceprint of an identity in a space, using an audio. This is a prerequisite to perform identity verifications.
If you are unfamiliar with these concepts, follow their links or read the API reference introduction.
✦ Goal: compute a voiceprint
and store its reference for
future use.
Prerequisites
Set up your HTTP client
Use the playground or automatically generate requests from the OpenAPI definition.
Authenticate using your credentials or API keys
Your API requests must be authenticated using your credentials or API keys.
Gain access to a space
You can only operate in spaces that belong to your user or to one of your organizations. Review these relationships if your access is denied.
→ owner
space
Create an identity
You must have created an identity in the chosen space.
→ identity
Upload an audio
You must have uploaded an audio to the chosen space.
→ audio
To focus on the computing of the voiceprint, this guide expects an audio to be uploaded as a prerequisite. However, it is common to upload the audios as part of the voiceprint computing process, which allows for better step-by-step validation.
Procedure
Choose the voiceprint model
Check the available models and choose the one you will use to compute the voiceprint. See the model index.
Each model has its own requirements. If you do not choose an appropriate one for your audio, you will receive an error when you attempt to add it to the voiceprint.
→ model
version
Create the voiceprint
Create the voiceprint for the identity. See the API reference.
← owner
space
model
version
identity
It is not recommended to use globally unique handles
for voiceprints. Instead, use a predictable pattern.
A good starting point is to have a main
voiceprint
for each identity.
→ voiceprint
(not yet ready for verifications)
- Request
- Response
- Method —
POST
- Path —
/spaces/{owner}/{space}/identities
- Body —
application/json
{
"handle": "{voiceprint}",
"model": "{model}/{version}",
"identity": "{identity}",
"minAudios": 1
}
This guide sets the minimum required audios of the voiceprint to 1. If that does not fit your use case, you will need to repeat step 3 with different audios.
- Code —
201
- Body —
application/json
{
"id": "...",
"handle": "{voiceprint}",
"alias": "...",
"state": "notComputable",
"model": "{model}/{version}",
"identity": {
"handle": "{identity}",
"alias": "..."
},
"minAudios": 1,
"audios": 0,
"totalDuration": "...",
"totalVoiceDuration": "...",
"createdAt": "...",
"computedAt": "..."
}
The notComputable
state indicates that the
model requirements are not yet satisfied. Voice
audios must be added before it can be computed.
Add the audio
Add the audio to the voiceprint. See the API reference.
← owner
space
identity
voiceprint
audio
- Request
- Response
- Method —
POST
- Path —
/spaces/{owner}/{space}/voiceprints/{identity}/{voiceprint}
—>/audios/{audio}
If you wish to add more audios to the voiceprint, just repeat this step.
- Code —
200
- Body —
application/json
{
"id": "...",
"handle": "{voiceprint}",
"alias": "...",
"state": "computable",
"model": "{model}/{version}",
"identity": {
"handle": "{identity}",
"alias": "..."
},
"minAudios": 1,
"audios": 1,
"totalDuration": "...",
"totalVoiceDuration": "...",
"createdAt": "...",
"computedAt": "..."
}
The computable
state indicates that the
model requirements are satisfied. More audios
can be added, but it can already be computed.
Compute the voiceprint
Compute the voiceprint. See the API reference.
← owner
space
identity
voiceprint
→ ✦ voiceprint
(ready for verifications)
- Request
- Response
- Method —
POST
- Path —
/spaces/{owner}/{space}/voiceprints/{identity}/{voiceprint}
—>:compute
A voiceprint can only be computed once and the operation is irreversible. Audios cannot be added or removed afterwards.
- Code —
200
- Body —
application/json
{
"id": "...",
"handle": "{voiceprint}",
"alias": "...",
"state": "computed",
"model": "{model}/{version}",
"identity": {
"handle": "{identity}",
"alias": "..."
},
"minAudios": 1,
"audios": 1,
"totalDuration": "...",
"totalVoiceDuration": "...",
"createdAt": "...",
"computedAt": "..."
}
The computed
state indicates that the voiceprint
can be used to perform identity verifications.
No more audios can be added.
Validation
Validate the voiceprint details
To validate that the voiceprint has been correctly computed, retrieve and analyze its details. See the API reference.
← owner
space
identity
voiceprint
- Request
- Response
- Method —
GET
- Path —
/spaces/{owner}/{space}/voiceprints/{identity}/{voiceprint}
- Code —
200
- Body —
application/json
{
"id": "...",
"handle": "{voiceprint}",
"alias": "...",
"state": "computed",
"model": "{model}/{version}",
"identity": {
"handle": "{identity}",
"alias": "..."
},
"minAudios": 1,
"audios": 1,
"totalDuration": "...",
"totalVoiceDuration": "...",
"createdAt": "...",
"computedAt": "..."
}
Validate the voiceprint usage records
To validate that the voiceprint has been correctly computed, retrieve and analyze the voiceprint usage records. See the API reference.
← owner
This step assumes that the owner
is an organization.
If you are the owner, you must use a slightly different
endpoint. See the API reference.
- Request
- Response
- Method —
GET
- Path —
/orgs/{owner}/records/voiceprint
- Code —
200
- Body —
application/json
[
...,
{
"id": "...",
"handle": "...",
"actor": {
"handle": "...",
"alias": "..."
},
"model": "{model}/{version}",
"voiceprint": {
"handle": "{voiceprint}",
"alias": "...",
"identity": {
"handle": "{identity}",
"alias": "..."
}
},
"space": {
"handle": "{space}",
"alias": "...",
"owner": {
"type": "...",
"handle": "{owner}",
"alias": "..."
}
},
"owner": {
"type": "...",
"handle": "{owner}",
"alias": "..."
},
"computedAt": "..."
},
...
]