\alizephpAlizePHP

AlizePHP is a php wrapper for Alize and LIA_RAL, an open source platform for biometrics authentification.

This class aims to abstract AlizePHP's commands and files, providing a per-user set of methods, and allowing developers to extract audio features and i-vectors with ease.

Alize and LIA_RAL are not part of this package and they must be downloaded and compiled in your machine. Once compiled, place the libraries and binaries generated in bin/ directory. It is STRONGLY advised to read documentation from Alize package as well as study the tutorials in order to understand what this package is doing and how to adapt it to your project. Anyway, a rough set of steps to create a user information in a sistem is to sequentially execute the following commands:

1 - extractFeatures() 2 - normaliseEnergy() 3 - detectEnergy() 4 - normaliseFeatures() 5 - ivExtractor()

Every method needs the output of the preceding one stored in your directory structure in order to properly work (you'll receive an AlizePHPException if that is not the case). Once the i-vector generated by ivExtractor() is present, you can use ivTest to verify if two users are the same person.

A set of default configuration files and settings is also provided in cfg/ directory. These files have been created by Anthony Larcher (alarcher - at- i2r.a-star.edu.sg) as part of his Alize tutorials and, as he states, "The author does not give ANY waranty about the performance and the usability".

You can change file extensions and directories to create your own directory structure. This may be useful if you want to use the files generated by Alize with another software. Settings file can be found in cfg/alizephp_conf.php.

Alize has been created by: A. Larcher, J.-F. Bonastre, B. Fauve, K.A. Lee, C. Levy, H. Li, J.S.D. Mason, J.-Y Parfait, "ALIZE 3.0 - Open Source Toolkit for State-of-the-Art Speaker Recognition," in Annual Conference of the International Speech Communication Association (Interspeech), 2013

Alize website: http://alize.univ-avignon.fr/index_en.html Alize SVN: http://alize.univ-avignon.fr/svn/ALIZE/trunk/ LIA_RAL SVN: http://alize.univ-avignon.fr/svn/LIA_RAL/trunk/ Alize documentation (including Tutorials): http://alize.univ-avignon.fr/doc_en.html

Summary

Methods
Properties
Constants
getSpeaker()
getOriginalAudioFile()
getAudioFilePath()
getFeauresFilePath()
getLabelsFilePath()
getMixtureFilesPath()
getMatrixFilesPath()
getVectorFilesPath()
getNdxFilesPath()
getResultFilesPath()
getIvExtractorFileName()
getAudioFileName()
getRawFeaturesFileName()
getNormalisedEnergyFileName()
getNormalisedFeaturesFileName()
getLabelFileName()
getVectorFileName()
getTrainModelFileName()
getNdxFileName()
getResultsFileName()
__construct()
extractFeatures()
normaliseEnergy()
detectEnergy()
normaliseFeatures()
ivExtractor()
ivTest()
cleanUserFiles()
hasVector()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getConfig()
executeCommand()
getBinPath()
getBaseDataDir()
getBaseConfigDir()
getBackgroundNdxFileName()
createIvExtractorFile()
createTrainModelFile()
createNdxFile()
deletefeFile()
$speaker
$original_audio_file
$conf
N/A

Properties

$speaker

$speaker : string

Type

string — Speaker id. If it's a number, it will be cast to a string.

$original_audio_file

$original_audio_file : string

Type

string — Path to original audio file sample from the speaker

$conf

$conf : array

Type

array — Array to hold every configuration option, as directory paths and extensions

Methods

getSpeaker()

getSpeaker() : string

Returns speaker Id as a string

Returns

string

getOriginalAudioFile()

getOriginalAudioFile() : string

Returs full path to the original audio file provided in the creation of the object

Returns

string

getAudioFilePath()

getAudioFilePath() : string

Returns path of pcm audio files, where audio files of each speaker in pcm format should be placed.

Pcm audio files directory is located inside base data directory. Audio files path value can be set in "audio_dir" option of config file.

Returns

string

getFeauresFilePath()

getFeauresFilePath() : string

Returns path of feature files, where raw, energy and normalised features should be placed.

Feature files dir is located inside base data dir. Features files path value can be set in "audio_dir" option of config file.

Returns

string

getLabelsFilePath()

getLabelsFilePath() : string

Returns path of label files, where label files with energy detections should be placed.

Label files dir is located inside base data dir. Label files path value can be set in "labels_dir" option of config file.

Returns

string

getMixtureFilesPath()

getMixtureFilesPath() : string

Returns path of mixture files.

Mixture files path value can be set in "mixture_files_path" option of config file.

Returns

string

getMatrixFilesPath()

getMatrixFilesPath() : string

Returns path of matrix files.

Matrix files path value can be set in "matrix_files_path" option of config file.

Returns

string

getVectorFilesPath()

getVectorFilesPath() : string

Returns path of vector files.

Vector files path value can be set in "vector_files_path" option of config file.

Returns

string

getNdxFilesPath()

getNdxFilesPath() : string

Returns path of ndx files.

Ndx files path value can be set in "ndx_dir" option of config file.

Returns

string

getResultFilesPath()

getResultFilesPath() : string

Returns path of test result files.

Test result files path value can be set in "results_dir" option of config file.

Returns

string

getIvExtractorFileName()

getIvExtractorFileName() : string

Returns full path to IvExtractor file. Filename will be IvExtractor_(username) and extension can be set in extensions -> ndx_files option

Returns

string

getAudioFileName()

getAudioFileName() : string

Returns full path to audio file. Filename will be username and extension can be set in extensions -> audio option

Returns

string

getRawFeaturesFileName()

getRawFeaturesFileName() : string

Returns full path to raw features file. Filename will be username and extension can be set in extensions -> raw_features option

Returns

string

getNormalisedEnergyFileName()

getNormalisedEnergyFileName() : string

Returns full path to energy file. Filename will be username and extension can be set in extensions -> normalised_energy option

Returns

string

getNormalisedFeaturesFileName()

getNormalisedFeaturesFileName() : string

Returns full path to normalised features file. Filename will be username and extension can be set in extensions -> normalised_features option

Returns

string

getLabelFileName()

getLabelFileName() : string

Returns full path to label file. Filename will be username and extension can be set in extensions -> label option

Returns

string

getVectorFileName()

getVectorFileName() : string

Returns full path to vector file. Filename will be username and extension can be set in extensions -> vector option

Returns

string

getTrainModelFileName()

getTrainModelFileName( $speaker) : string

Returns full path to train model file. Filename will be trainModel_(speaker) and extension can be set in extensions -> ndx_files option

Parameters

$speaker

Returns

string

getNdxFileName()

getNdxFileName() : string

Returns full path to user ndx file. Filename will be ivTest_plda_target-seg_(speaker) and extension can be set in extensions -> ndx_files option

Returns

string

getResultsFileName()

getResultsFileName() : string

Returns full path to ivTest score file. Filename will be scores_(speaker) and extension will be txt

Returns

string

__construct()

__construct(string $speaker, string $audio_file_path)

Creates an AlizePHP object

Parameters

string $speaker

User id of the speaker

string $audio_file_path

Filepath to an audio file sample of user

Throws

\alizephp\AlizePHPException

extractFeatures()

extractFeatures(string $param_string) : boolean

Creates raw features file from audio provided in constructor and stores audio in alizephp directory structure.

If a param string for the sfbcep command is not provided, the default of "-m -k 0.97 -p19 -n 24 -r 22 -e -D -A -F PCM16" will be used.

Parameters

string $param_string

OPTIONAL Parameter string for sfbcep command

Throws

\alizephp\AlizePHPException

Returns

boolean

normaliseEnergy()

normaliseEnergy(string $cfg_file_path) : boolean

Creates normalised features file from raw features file created in extractFeatures method.

If a path to a config file is not provided "cfg_files"->"normalise_features" option in settings file sets the path of the config file that will be used.

Parameters

string $cfg_file_path

OPTIONAL Path to a config file for Alize's NormFeat command

Throws

\alizephp\AlizePHPException

Returns

boolean

detectEnergy()

detectEnergy(string $cfg_file_path) : boolean

Creates label file from normalised energy file created in normaliseEnergy method.

If a path to a config file is not provided "cfg_files"->"detect_energy" option in settings file sets the path of the config file that will be used.

Parameters

string $cfg_file_path

OPTIONAL Path to a config file for Alize's EnergyDetector command

Throws

\alizephp\AlizePHPException

Returns

boolean

normaliseFeatures()

normaliseFeatures(string $cfg_file_path) : boolean

Creates a features file from raw features and label files created in extractFeatures and detectEnergy methods.

If a path to a config file is not provided "cfg_files"->"normalise_features" option in settings file sets the path of the config file that will be used.

Parameters

string $cfg_file_path

OPTIONAL Path to a config file for Alize's NormFeat command

Throws

\alizephp\AlizePHPException

Returns

boolean

ivExtractor()

ivExtractor(string $cfg_file_path) : boolean

Creates an i-vector representing the user's voice features. It needs the ouptu generated by the NormaliseFeatures and detectEnergy methods, as well as mixture (model) and matrix files, generated using ALIZE internal tools with multiple samples.

If a path to a config file is not provided "cfg_files"->"iv_extractor" option in settings file sets the path of the config file that will be used.

Parameters

string $cfg_file_path

OPTIONAL Path to a config file for Alize's IvExtractor command

Throws

\alizephp\AlizePHPException

Returns

boolean

ivTest()

ivTest(string $speaker_to_compare_to, string $cfg_file_path) : boolean

Test if the speaker's object is the same person as speaker with ID of $speaker_to_compare_to.

Buth speakers must have their i-vectors created and stored in the directory structure. If a path to a config file is not provided "cfg_files"->"iv_extractor" option in settings file sets the path of the config file that will be used.

Parameters

string $speaker_to_compare_to

ID of the speaker compared agains this objet's one

string $cfg_file_path

OPTIONAL Path to a config file for Alize's IvTest command

Throws

\alizephp\AlizePHPException

Returns

boolean —

true if botk speakers are the same person, false if not

cleanUserFiles()

cleanUserFiles() : bool

Deletes every existing file associated to a user. It would be equivalent to cascade delete a user from a database.

Returns

bool —

true if the method ends correctly, false if not

hasVector()

hasVector() : boolean

Checks if a user's i-vector is present, so this user's identity can be tested against another

Returns

boolean —

true if the i-vector for the user has been calculated, false otherwise

getConfig()

getConfig()

Loads configuration options into conf array

executeCommand()

executeCommand(string $comm) : string[]

Executes a given command and returns stdout, stderr and return value

Parameters

string $comm

Command to execute

Throws

\alizephp\AlizePHPException

Returns

string[] —

Array wit stdout, stderr and return value of the command, in indexes 0, 1 and 2 each

getBinPath()

getBinPath() : string

Returns path of bin directory, where binaries and libraries should be placed.

Bin path value can be set in "base_bin_dir" option of config file.

Returns

string —

Base bin path

getBaseDataDir()

getBaseDataDir() : string

Returns path of data directory, where pcm audio, features and labels should be placed.

Data path value can be set in "base_data_dir" option of config file.

Returns

string —

Base data dir

getBaseConfigDir()

getBaseConfigDir() : string

Returns path of configuration directory, where Alize and AlizePHP config files should be placed.

Config path value can be set in "base_conf_dir" option of config file.

Returns

string —

Base conf dir

getBackgroundNdxFileName()

getBackgroundNdxFileName() : string

Returns full path to Background ndx file

Returns

string

createIvExtractorFile()

createIvExtractorFile()

Creates the iv extractor file needed to extract a user's i-vector

createTrainModelFile()

createTrainModelFile()

Creates the train model file needed to extract a user's i-vector

createNdxFile()

createNdxFile()

Creates an ndx file with comparison id cases. In our approach, it simply outputs actual user as spk01

deletefeFile()

deletefeFile(string $file_path)

Checks if a file exists, and if so, deletes it

Parameters

string $file_path

Path to the file to delete