Voice Capture - VoiceID
This component requires a minimum iOS13 version
Introduction
The Component The one handled in the current document is called Voice Component. This is responsible for capturing the user's voice and subsequently extracting the corresponding templates. Its main functionalities are the following:
Enter a certain number of phrases and then read each one in a step.
Internal microphone management.
Permission management.
Silence analysis.
Progress analysis.
Assistant in the capture processes.
Generation of templates with voice characteristics and scores.
In the section of Simplified Launch the steps required for the SDK's basic integration are detailed. This section adds the information for launching this component.
Dependencies
To avoid conflicts and compatibility issues, if you want to install the component in a project that contains an old version of the Facephi libraries (Widgets), these must be completely removed before installing the components of the SDKMobile.
CocoaPods
pod 'FPHISDKMainComponent', '~> $VERSION'To install the current component, the following entry must be included in the application's Podfile:
Once the dependencies are installed, the different functionalities of the component can be used.
SPM
The mandatory dependencies that must have been previously installed are:
To install the SelphID component, it must be included in the project's modules:
Permissions
In the client application where the components will be integrated, it is necessary to include the following element in the Info.plist:
Available controllers
Controller
Description
VoiceController
Main voice capture controller
Simplified Launch
Basic configuration
To launch the current component, an object must be created VoiceConfigurationData which will be the configuration of the component controller.
The basic configuration required is as follows:
The list of phrases to be shown to the user can be edited.
Receiving the result
The controllers will return the necessary information in SdkResult format.
Error handling
In the error section, we will have the common enumeration ErrorType:
VOC_CANCEL_BY_USER: The user has cancelled the process
VOC_CANCEL_LAUNCH: A general cancellation of the SDK has been carried out
VOC_COMPONENT_LICENSE_ERROR: The component license is not valid
VOC_EMPTY_LICENSE: The license string is empty
VOC_INITIALIZATION_ERROR: Initialization error
VOC_INTERNAL_LICENSE_ERROR: Internal license-related error
VOC_NO_DATA_ERROR: The input data is null
VOC_OPERATION_NOT_CREATED: There is no operation in progress
VOC_PERMISSION_DENIED: The user has denied the permissions
VOC_TIMEOUT: Timeout in the process
Successful execution reception - data
In the section of data, we will have the class VoiceResult.
The field data is variable and will depend on which component returned the result. In the case of this component, the returned fields are as follows:
audios
Contains a list of captured audios in ByteArray format.
tokenizedAudios
Contains the list of captured audios in Facephi Tokenized format.
Advanced information
This section expands on the component information.
Advanced component configuration
To configure the current component, once initialized, an object must be created
VoiceConfigurationData and passed as a parameter to SDKController during the component launch.
The next section will show the fields that are part of this class and what each of them is used for.
phrases
Indicates the phrase/phrases needed to capture.
vibrationEnabled
Indicates whether vibration is activated when the Widget finishes successfully.
showTutorial
Indicates whether the component activates the tutorial screen. In this view, it intuitively explains how the capture is performed.
extractionTimeout
Sets the maximum time allowed for the capture.
showDiagnostic
Show diagnostic screens at the end of the process
enableQualityCheck
Enables or disables audio quality checking. It is recommended to keep it always enabled.
showPreviousTip
Shows a screen before capture launch with information about the process to be performed and a launch button.
Component customization
Apart from the changes that can be made at the SDK level (which are explained in the document on SDK Customization), this specific component allows its interface to be modified.
Texts
The texts can be customized by overwriting the value of the following keys in a Localizable.strings. The keys containing the suffix _alt are the literals used in the accessibility labels needed for the functionality of voice over.
Name
Value
voice_component_success_records_message
%d/%d successful recordings
voice_component_read_message
Say out loud:
voice_component_speech_message
Speak clearly and close to the microphone
voice_component_speech_noisy_message
There is too much noise. Try to be in a quiet environment.
voice_component_success_message
Recording registered
voice_component_phrase_generic_error_message
Please repeat the phrase.
voice_component_phrase_long_silence_message
Speak for 2 seconds or more.
voice_component_phrase_long_reverberation_message
Too much echo. Try another environment.
voice_component_tip_title
Voice recognition
voice_component_tip_message
Speak clearly and loudly.\n\nMake sure you are in a quiet environment
voice_component_tip_button
START
voice_component_exit_alert_accept
Accept
voice_component_exit_alert_cancel
Cancel
voice_component_exit_alert_question
Are you sure you want to end the process?
Background voices have been detected. Make sure you are in a quiet environment
The recording has been very short.
voice_component_short_recorded_speech_message
The recording has been very short.
voice_component_quality_check_error_message
The audio quality is insufficient.
voice_component_close_button_alt
Close
voice_component_logo_alt
Logo
voice_component_tip_anim_alt
voice_component_timeout_title
Time exceeded
voice_component_timeout_desc
We could not identify you. Try again.
This way, if you want to modify, for example, the text “START” of the key voice_component_tip_button_message for the language is, you should go to the file Localizable.strings in the folder es.lproj if it exists (if not, it must be created), and there add:
If a message is not specified in the language file, it will be filled with the default message.
Animations
The animations to use are initialized similarly in the animations variable with a dictionary, having as value a string with the name of the animation found in xcassets that you want to use.
Last updated