Skip to main content
Skip table of contents

Voice Biometrics - Android

VDK features two Voice Biometrics libraries: TSSV and IDVoice.

Configuration

Voice biometrics engines must be configured before the program starts. Here is a complete setup for the TSSV provider:

JSON
{
    "version": "2.0",
    "tssv": {	// Contrary to other technologies,
        "biometrics": { // biometrics paths are relative to the program's working directory!
            "generated_models_path": "data/models",
            "background_model_TI": "data/text-independent-16kHz.ubm",
            "background_model_TD": "data/text-dependent-16kHz.ubm"
        }
    }
}

Starting the engine

JAVA
com.vivoka.vsdk.Vsdk.init(mContext, "config/main.json", vsdkSuccess -> {
    if (vsdkSuccess)
    {
        com.vivoka.tssv.Engine.getInstance().init(mContext, engineSuccess -> {
            if (engineSuccess)
            {
                // at this point the BiometricEngine has been correctly initialized
            }
        });
    }
});

Creating a model

Models contain enrollment data that recognition operations need.

JAVA
// To create a text independant model
Model model = com.vivoka.tssv.Engine.getInstance().makeModel("test_ti", ModelType.TEXT_INDEPENDANT);

// To create a text dependant model
Model model = com.vivoka.tssv.Engine.getInstance().makeModel("test_ti", ModelType.TEXT_DEPENDANT);

Checking users in the model

If a model was previously created with the same name it will be loaded. You can check enrolled users with:

JAVA
if (model.getUsers().size() == 0)
{
  // No enrolled users
}

Adding a user to the model

You can either add raw audio data directly. After adding all the data for a given user, compile the model to finalize the enrollment process:

JAVA
//model.addRecord(String name, Buffer buffer);
model.addRecord("victorien", buffer);

The more data you give the model, the better the result will be.
Prefer to register the data in the condition of the use case of the model.

The format is preferred to be 16Khz mono-channel.

Performing authentication or identication

Both are covered in the same chapter as it is very similar:

JAVA
// Identificator
Identificator identificator = com.vivoka.tssv.Engine.getInstance().makeIdentificator("ident", model,
    new IStatusReporter<IdentificatorResultType, IdentificatorEventCode, IdentificatorErrorCode>() {
        @Override
        public void dispatchResult(IdentificatorResultType authenticatorResultType, String s, JSONObject jsonObject, boolean b) {
        String user = jsonObject.optString("id");
        }

        @Override
        public void dispatchEvent(IdentificatorEventCode identificatorEventCode, String s, String s1, int i) {}

        @Override
        public void dispatchError(ErrorType errorType, IdentificatorErrorCode identificatorErrorCode, String s, String s1) {}
    });

// Authenticator
Authenticator authenticator = com.vivoka.tssv.Engine.getInstance().makeAuthenticator("ident", model,
    new IStatusReporter<AuthenticatorResultType, AuthenticatorEventCode, AuthenticatorErrorCode>() {
        @Override
        public void dispatchResult(AuthenticatorResultType authenticatorResultType, String s, JSONObject jsonObject, boolean b) {
        String user = jsonObject.optString("id");
        }

        @Override
        public void dispatchEvent(AuthenticatorEventCode authenticatorEventCode, String s, String s1, int i) {}

        @Override
        public void dispatchError(ErrorType errorType, AuthenticatorErrorCode authenticatorErrorCode, String s, String s1) {}
    });
authenticator.setUserToRecognize("victorien");

The only difference is that the authentication can only recognize user “victorien” and the identification can recognize every user enrolled in the model.

Different providers will give you different results, for example IDVoice reports varying results as it analyzes the audio, while TSSV only sends you result if the engine thinks it is acceptable (depending of the confidence level you set).

We recommend that you try it out the application in real situation to select your custom minimum score required to satisfy your need in false rejection and false acceptation. But by default you can just check if the score is above 0.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.