Voice Biometrics Sample

This is a command line console application that provides access to the voice biometrics facilities of the Aculab Cloud Web Services APIs. The voice biometrics facilities are divided into 3 API categories which this application demonstrates the use of:

Users API

Can be used to register a user with a group. At the time of registration the user must specify their user group access key and supply audio of their voice.

User Groups API

Can be used to create a group that users can register with.

User Group Keys API

Can be used to generate a key that gives a user access to a group.

Note

When running this sample, Python 3.6 or newer is recommended. Versions of Python older than 3.4 lack WebSocket streaming support and for this reason running a register/update/verify user command with the GET method will fail to run.

Usage

Users API:

VoiceBiometrics [--wsserver <cloudWebServerAddress>] [--method <httpRequestMethod>] user <cloudId> <username> <command>

where command can be one of the following...

register <userId> <userGroupKey> <audioFilename>

update <userId> <userGroupKey> <audioFilename>

verify <userId> <userGroupKey> <audioFilename> [<sensitivity> [<textDependent> [enablePAD]]]

stats <userId> <userGroupKey>

exists <userId> <userGroupKey>

delete <userId> <userGroupKey>

User Groups API:

VoiceBiometrics [--wsserver <cloudWebServerAddress>] userGroup <cloudId> <username> <apiAccessKey> <command>

where command can be one of the following...

list

create <userGroupName>

delete <userGroupName>

User Group Keys API:

VoiceBiometrics [--wsserver <cloudWebServerAddress>] userGroupKey <cloudId> <username> <apiAccessKey> <command>

where command can be one of the following...

list <userGroupName>

create <userGroupName>

modify <userGroupKey> <keyEnabled> [<retainData>]

delete <userGroupKey>

Arguments

cloudWebServerAddress

The address of the cloud web server. By default the wrappers call web services on https://ws-<cloudId>.aculabcloud.net. In certain circumstances you may need to use a different address which you can set here.

httpRequestMethod

PUT, POST or GET. The method used to make one of the requests that supply audio data. When using PUT and POST the audio file is supplied in the request body while for GET, the request returns a URL on which a WebSocket is opened and the audio file streamed to it. The default is to use POST.

cloudId

Cloud region id (e.g. 1-2-0)

username

Cloud account username

apiAccessKey

Cloud API Access key

userId

A user-defined Id that uniquely identifies the user.

userGroupName

The name of a user group that will contain user registrations.

userGroupKey

An access key from the user group with which this user will be associated.

audioFilename

The name of the audio file to process. For PUT and POST, if the string starts with "http:" or "https:" the name is assumed to be a URL from which to download the audio data. For register and update using POST it can be a comma-delimited list.

sensitivity

The sensitivity of the biometric analysis. Range is -10.0 to 10.0. Default is 0.0. Positive values decrease confidence, negative values increase confidence.

textDependent

By default this is true, meaning all audio data supplied to register, update and verify must contain the same spoken phrase. Set this to false to allow any phrase to be used to register, update and verify.

enabledPAD

Enable presentation attack detection (PAD). Presentation attacks may be encountered when voice data is supplied that has been covertly obtained from the user, synthesized or replayed. When PAD is enabled, and an attack is detected, extra information is returned identifying the type of attack. PAD is disabled by default.

keyEnabled

True to enable the key or false to disable it.

retainData

True to retain biometric and transaction data for all transactions using key.

Examples

  1. Register a user with POST and using a local WAV file

    python voice_biometrics.py user 1-2-0 bob@acompany.com register Bob ak-3FHfDbq7e-g9QaOGwyv6C9 BobPhrase1a.wav
    
  2. Register a user with GET and using a local WAV file

    python voice_biometrics.py --method GET user 1-2-0 bob@acompany.com register Bill27645 ak-3FHfDbq7e-g9QaOGwyv6C9 BillPhraseAlawa.wav
    
  3. Register a user with POST and using using a URL

    python voice_biometrics.py user 1-2-0 bob@acompany.com register Bob ak-3FHfDbq7e-g9QaOGwyv6C9 https://my.wav.files.com/get_wav?filename=BobPhrase1a.wav
    
  4. Register a user with POST and using multiple URLs

    python voice_biometrics.py user 1-2-0 bob@acompany.com register Bob ak-3FHfDbq7e-g9QaOGwyv6C9 https://my.wav.files.com/get_wav?filename=BobPhrase1a.wav,https://my.wav.files.com/get_wav?filename=BobPhrase1b.wav
    
  5. Update a user with POST and using a local WAV file

    python voice_biometrics.py user 1-2-0 bob@acompany.com update Bob ak-3FHfDbq7e-g9QaOGwyv6C9 BobPhrase1b.wav
    
  6. Verify a user with POST and using a local WAV file

    python voice_biometrics.py user 1-2-0 bob@acompany.com verify Bob ak-3FHfDbq7e-g9QaOGwyv6C9 BobPhrase1c.wav
    
  7. Verify a user with POST, using a local WAV file and enabling PAD detection

    python voice_biometrics.py user 1-2-0 bob@acompany.com verify Bob ak-3FHfDbq7e-g9QaOGwyv6C9 BobPhrase2a.wav 2.0 false true
    
  8. List a user's statistics

    python voice_biometrics.py user 1-2-0 bob@acompany.com stats Bob ak-3FHfDbq7e-g9QaOGwyv6C9
    
  9. Check if a user exists

    python voice_biometrics.py user 1-2-0 bob@acompany.com exists Bob ak-3FHfDbq7e-g9QaOGwyv6C9
    
  10. Delete a user

    python voice_biometrics.py user 1-2-0 bob@acompany.com delete Bob ak-3FHfDbq7e-g9QaOGwyv6C9
    
  11. List the user groups

    python voice_biometrics.py usergroup 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list
    
  12. Create a user group

    python voice_biometrics.py usergroup 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ create BobsCompany
    
  13. Delete a user group

    python voice_biometrics.py usergroup 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete BobsCompany
    
  14. List the User Group Keys in 'BobsCompany' user group

    python voice_biometrics.py usergroupkey 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ list BobsCompany
    
  15. Create a User Group Key that will allow a user register with 'BobsCompany' user group

    python voice_biometrics.py usergroupkey 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ create BobsCompany
    
  16. Disable a User Group Key

    python voice_biometrics.py usergroupkey 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ modify ak-ksxh4hiLdNEwGdEKd3osOH false
    
  17. Enable a User Group Key and retain transaction data

    python voice_biometrics.py usergroupkey 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ modify ak-ksxh4hiLdNEwGdEKd3osOH true true
    
  18. Delete a User Group Key

    python voice_biometrics.py usergroupkey 1-2-0 bob@acompany.com 6b4UmwoOPxjeI2M76aebfQ delete ak-ksxh4hiLdNEwGdEKd3osOH