Voice Capture - VoiceID
This component requires a minimum iOS version of iOS13
Introduction
The Component the one addressed in the current document is called Voice Component. This is responsible for capturing the user's voice and then extracting the corresponding templates. Its main functionalities are the following:
Input of a certain number of phrases to later read each one in a step.
Internal microphone management.
Permission management.
Analysis of silences.
Progress analysis.
Assistant in the capture processes.
Generation of templates with voice features and scores.
In the section of Simplified Launch the necessary steps for the basic integration of the SDK are detailed. In this section, information is added for the launch of 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), they 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 installed previously 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 file Info.plist:
Available controllers
Controller
Description
VoiceController
Main voice capture controller
Simplified Launch
Basic configuration
To launch the current component, an object VoiceConfigurationData must be created, which will be the configuration of the component controller.
The basic configuration needed for this is as follows:
The list of phrases that will be shown to the user can be edited.
Result reception
The controllers will return the necessary information in SdkResult format.
Error handling
In the error section, we will have the common enum ErrorType:
VOC_CANCEL_BY_USER: The user has canceled the process
VOC_CANCEL_LAUNCH: A general SDK cancellation has been performed
VOC_COMPONENT_LICENSE_ERROR: The component license is not correct
VOC_EMPTY_LICENSE: The license String is empty
VOC_INITIALIZATION_ERROR: Initialization error
VOC_INTERNAL_LICENSE_ERROR: Internal error related to the license
VOC_NO_DATA_ERROR: The input data are null
VOC_OPERATION_NOT_CREATED: There is no operation in progress
VOC_PERMISSION_DENIED: The user has denied the permissions
VOC_TIMEOUT: Timeout during the process
Successful execution receipt - data
In the 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:
audio files
Contains a list of captured audio recordings in ByteArray format.
tokenizedAudios
Contains the list of captured audio recordings 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 pass it as a parameter to SDKController during the component launch.
The following section will show the fields that are part of this class and what each one is used for.
phrases
Indicates the phrase or phrases needed for capture.
vibrationEnabled
Indicates whether vibration is activated when the Widget successfully finishes.
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 that capture can be performed.
showDiagnostic
Show diagnostic screens at the end of the process
enableQualityCheck
Enables or disables audio quality checking. It is recommended to always keep it enabled.
showPreviousTip
Displays a screen before starting the capture with information about the process to be carried out and a button to start it.
Component Customization
Besides the changes that can be made at SDK level (which are explained in the document of SDK Customization), this specific component allows its interface to be modified.
Texts
The texts can be customized by overriding 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 saved
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?
voice_component_multiple_speakers_error_message
Background voices have been detected. Make sure you are in a quiet environment
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
Timeout exceeded
voice_component_timeout_desc
We have not been able to identify you. Try again.
In 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 will have to 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