VoiceSDK  5.0.2
Classes | Typedefs | Enumerations | Functions
liveness_c_api.h File Reference
#include <voicesdk/core/core_c_api.h>

Go to the source code of this file.

Classes

struct  VoiceSdkLivenessResult
 Voice liveness check result. More...
 

Typedefs

typedef struct VoiceSdkLivenessEngine VoiceSdkLivenessEngine
 Voice liveness check structure. More...
 
typedef enum VoiceSdkLivenessResultValidationStatusCode VoiceSdkLivenessResultValidationStatusCode
 Status code of validation preceding liveness check. More...
 
typedef struct VoiceSdkLivenessResult VoiceSdkLivenessResult
 Voice liveness check result. More...
 

Enumerations

enum  VoiceSdkLivenessResultValidationStatusCode { kVoiceSdkLivenessResultValidationStatusCodeOk, kVoiceSdkLivenessResultValidationStatusCodeTooSmallSpeechLength }
 Status code of validation preceding liveness check. More...
 

Functions

VOICE_SDK_API VoiceSdkLivenessEngineVoiceSdkLivenessEngineCreate (const char *init_path, VoiceSdkErrorCode *error_code, char **error_msg)
 Creates VoiceSdkLivenessEngine. More...
 
VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessAudioFile (const VoiceSdkLivenessEngine *engine, const char *audio_path, VoiceSdkLivenessResult *result, VoiceSdkErrorCode *error_code, char **error_msg)
 Checks liveness from the given audio file. More...
 
VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessBytes (const VoiceSdkLivenessEngine *engine, const uint8_t *bytes, size_t num_bytes, size_t sample_rate, VoiceSdkLivenessResult *result, VoiceSdkErrorCode *error_code, char **error_msg)
 Checks liveness from the given byte representation of PCM16 audio samples. More...
 
VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessPcm16Samples (const VoiceSdkLivenessEngine *engine, const int16_t *pcm16_samples, size_t num_samples, size_t sample_rate, VoiceSdkLivenessResult *result, VoiceSdkErrorCode *error_code, char **error_msg)
 Checks liveness from the given PCM16 audio samples. More...
 
VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessFloatSamples (const VoiceSdkLivenessEngine *engine, const float *float_samples, size_t num_samples, size_t sample_rate, VoiceSdkLivenessResult *result, VoiceSdkErrorCode *error_code, char **error_msg)
 Checks liveness from the given float audio samples. More...
 
VOICE_SDK_API void VoiceSdkLivenessEngineRelease (VoiceSdkLivenessEngine *engine)
 Releases all memory allocated for this VoiceSdkLivenessEngine instance. More...
 

Typedef Documentation

◆ VoiceSdkLivenessEngine

Voice liveness check structure.

◆ VoiceSdkLivenessResult

Voice liveness check result.

◆ VoiceSdkLivenessResultValidationStatusCode

Status code of validation preceding liveness check.

Enumeration Type Documentation

◆ VoiceSdkLivenessResultValidationStatusCode

Status code of validation preceding liveness check.

Enumerator
kVoiceSdkLivenessResultValidationStatusCodeOk 

Successful validation

kVoiceSdkLivenessResultValidationStatusCodeTooSmallSpeechLength 

Speech length is too small for liveness check to be performed

Function Documentation

◆ VoiceSdkLivenessEngineCheckLivenessAudioFile()

VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessAudioFile ( const VoiceSdkLivenessEngine engine,
const char *  audio_path,
VoiceSdkLivenessResult result,
VoiceSdkErrorCode error_code,
char **  error_msg 
)

Checks liveness from the given audio file.

Parameters
[in]engineinstance of Liveness Engine created with VoiceSdkLivenessEngineCreate
[in]audio_pathpath to audio file on the filesystem
[out]resultliveness check result, pointer to preallocated structure instance. Not changed unless this call returns true.
[out]error_codepointer to the error code.
[out]error_msgoutput error message. Points to the null-terminated string containing message in case of failure or to the NULL in case of success. The memory it points to should be freed manually.
Returns
true if call completed successfully, false otherwise

◆ VoiceSdkLivenessEngineCheckLivenessBytes()

VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessBytes ( const VoiceSdkLivenessEngine engine,
const uint8_t *  bytes,
size_t  num_bytes,
size_t  sample_rate,
VoiceSdkLivenessResult result,
VoiceSdkErrorCode error_code,
char **  error_msg 
)

Checks liveness from the given byte representation of PCM16 audio samples.

Parameters
[in]engineinstance of Liveness Engine created with VoiceSdkLivenessEngineCreate
[in]bytespointer to byte array containing PCM16 audio samples. Each two bytes make up one little-endian sample.
[in]num_bytessize of the byte array
[in]sample_ratesample rate of the passed audio in Hz
[out]resultliveness check result, pointer to preallocated structure instance. Not changed unless this call returns true.
[out]error_codepointer to the error code.
[out]error_msgoutput error message. Points to the null-terminated string containing message in case of failure or to the NULL in case of success. The memory it points to should be freed manually.
Returns
true if call completed successfully, false otherwise

◆ VoiceSdkLivenessEngineCheckLivenessFloatSamples()

VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessFloatSamples ( const VoiceSdkLivenessEngine engine,
const float *  float_samples,
size_t  num_samples,
size_t  sample_rate,
VoiceSdkLivenessResult result,
VoiceSdkErrorCode error_code,
char **  error_msg 
)

Checks liveness from the given float audio samples.

Parameters
[in]engineinstance of Liveness Engine created with VoiceSdkLivenessEngineCreate
[in]float_samplespointer to array containing normalized (from -1 to 1) float audio samples
[in]num_samplessize of the floats array
[in]sample_ratesample rate of the passed audio in Hz
[out]resultresulting spoof check, pointer to preallocated structure instance. Not changed unless this call returns true.
[out]error_codepointer to the error code.
[out]error_msgoutput error message. Points to the null-terminated string containing message in case of failure or to the NULL in case of success. The memory it points to should be freed manually.
Returns
true if call completed successfully, false otherwise

◆ VoiceSdkLivenessEngineCheckLivenessPcm16Samples()

VOICE_SDK_API bool VoiceSdkLivenessEngineCheckLivenessPcm16Samples ( const VoiceSdkLivenessEngine engine,
const int16_t *  pcm16_samples,
size_t  num_samples,
size_t  sample_rate,
VoiceSdkLivenessResult result,
VoiceSdkErrorCode error_code,
char **  error_msg 
)

Checks liveness from the given PCM16 audio samples.

Parameters
[in]engineinstance of Liveness Engine created with VoiceSdkLivenessEngineCreate
[in]pcm16_samplespointer to shorts array containing PCM16 audio samples
[in]num_samplessize of the shorts array
[in]sample_ratesample rate of the passed audio in Hz
[out]resultliveness check result, pointer to preallocated structure instance. Not changed unless this call returns true.
[out]error_codepointer to the error code.
[out]error_msgoutput error message. Points to the null-terminated string containing message in case of failure or to the NULL in case of success. The memory it points to should be freed manually.
Returns
true if call completed successfully, false otherwise

◆ VoiceSdkLivenessEngineCreate()

VOICE_SDK_API VoiceSdkLivenessEngine* VoiceSdkLivenessEngineCreate ( const char *  init_path,
VoiceSdkErrorCode error_code,
char **  error_msg 
)

Creates VoiceSdkLivenessEngine.

Parameters
[in]init_pathpath to the init data folder
[out]error_codepointer to the error code.
[out]error_msgoutput error message. Points to the null-terminated string containing message in case of failure or to the NULL in case of success. The memory it points to should be freed manually.
Returns
VoiceSdkLivenessEngine* or NULL in case of any errors

◆ VoiceSdkLivenessEngineRelease()

VOICE_SDK_API void VoiceSdkLivenessEngineRelease ( VoiceSdkLivenessEngine engine)

Releases all memory allocated for this VoiceSdkLivenessEngine instance.

Parameters
engineinstance of VoiceSdkLivenessEngine that needs freeing