> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/android-sdk/componentes-modulos/captura-de-voz.md).

# Voice Capture - VoiceID

## Introduction <a href="#id-1-introduccion" id="id-1-introduccion"></a>

Voice capture is performed using the ***Voice Component***.

This component captures the user's voice and then extracts the corresponding templates. Its main processes are:

* Internal microphone and permissions management.
* Entry of a certain number of phrases, which are then read one at a time.
* Silence analysis.
* Progress analysis.
* Assistance during capture processes.
* Generation of templates containing voice characteristics and scores.

The [Simplified Launch](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/android-sdk/inicializacion/lanzamiento-simplificado.md) section describes the steps required for basic SDK integration. This section provides information on launching this component.

## Dependency <a href="#id-2-dependencia" id="id-2-dependencia"></a>

The component-specific dependency is:

```
implementation "com.facephi.androidsdk:voice_component:$version"
```

## Available controllers <a href="#id-3-controladores-disponibles" id="id-3-controladores-disponibles"></a>

<table data-header-hidden><thead><tr><th width="193.87109375"></th><th></th></tr></thead><tbody><tr><td><strong>Controller</strong></td><td><strong>Description</strong></td></tr><tr><td>VoiceController</td><td>Main voice capture controller</td></tr></tbody></table>

\
Simplified Launch
-----------------

Once the SDK has been initialized and a new operation has been created, you can launch the component. You can use any of its controllers to run its functionality.

Launching the capture:

```kotlin
val response = SDKController.launch(
    VoiceController(VoiceConfigurationData(...))
)
when (response) {
    is SdkResult.Error -> Napier.d("ERROR - ${response.error.name}")
    is SdkResult.Success -> response.data
}
```

## Basic Configuration <a href="#id-5-configuracion-basica" id="id-5-configuracion-basica"></a>

To launch this component, create a *VoiceConfigurationData* object, which contains the component controller's configuration.

The basic configuration required is as follows:

```kotlin
VoiceConfigurationData(
  phrases = arrayOf(
            "Your full name and address",
            "Your document number, including the letter",
        )
)
```

You can edit the list of phrases that will be shown to the user.

## Receiving the result <a href="#id-6-recepcion-del-resultado" id="id-6-recepcion-del-resultado"></a>

The launch returns the information in SdkResult format. You can distinguish between a successful and an unsuccessful launch:

```
when (response) {
    is SdkResult.Error -> Napier.d("ERROR - ${response.error}")
    is SdkResult.Success -> response.data
}
```

### Error handling <a href="#id-61-recepcion-de-errores" id="id-61-recepcion-de-errores"></a>

Errors are returned as a 'VoiceError' object.

List of errors:

* `ACTIVITY_RESULT_MSG_ERROR` (`VOC_502`): The activity result is incorrect
* `APPLICATION_CONTEXT_ERROR` (`VOC_503`): The required application context is null
* `CANCEL_BY_USER` (`VOC_000`): The user has canceled the process
* `CANCEL_LAUNCH` (`VOC_007`): The SDK has been canceled globally
* `COMPONENT_LICENSE_ERROR` (`VOC_002`): The component license is invalid
* `EMPTY_LICENSE` (`VOC_003`): The license string is empty
* `FETCH_DATA_ERROR` (`VOC_504`): Error fetching the result
* `FLOW_ERROR` (`VOC_510`): Error in the flow process
* `FLOW_TRACKING_ERROR` (`VOC_507`): Error in flow tracking
* `FLOW_VIDEO_RECORDING_ERROR` (`VOC_506`): Error recording flow video
* `INITIALIZATION_ERROR` (`VOC_004`): Initialization error
* `INTERNAL_ERROR` (`VOC_509`): Internal error
* `INTERNAL_LICENSE_ERROR` (`VOC_500`): Internal license-related error
* `MANAGER_NOT_INITIALIZED` (`VOC_505`): Managers are null
* `NO_DATA_ERROR` (`VOC_005`): Input data is null
* `OPERATION_NOT_CREATED` (`VOC_006`): No operation is in progress
* `PERMISSION_DENIED` (`VOC_501`): The user denied the permissions
* `TIMEOUT` (`VOC_001`): Process timeout
* `TRACKING_STEP_ERROR` (`VOC_508`): Error in the tracking step

### Successful result received - *data* <a href="#id-62-recepcion-del-resultado-correcto-data" id="id-62-recepcion-del-resultado-correcto-data"></a>

In the SdkResult.Success section - *data*, we will have the *VoiceResult*.

The fields returned in the result are as follows:

**audios**

Contains a list of captured audio recordings in ByteArray format.

**tokenizedAudios**

Contains the list of captured audio recordings in Facephi's tokenized format.

***

## Advanced information <a href="#id-7-informacion-avanzada" id="id-7-informacion-avanzada"></a>

This section provides additional information about the component.

### Advanced component configuration <a href="#id-71-configuracion-avanzada-del-componente" id="id-71-configuracion-avanzada-del-componente"></a>

To launch this component, create a *VoiceConfigurationData* object, which contains the component controller's configuration.

All the fields that are part of this class are described below.

* `phrases`: (`Array<String>`, required) Specifies the phrase or phrases required for capture.
* `vibrationEnabled`: (`Boolean`, default `true`) Indicates whether vibration is enabled when the widget finishes successfully.
* `showTutorial`: (`Boolean`, default `true`) Indicates whether the component displays the tutorial screen. This screen intuitively explains how to capture.
* `extractionTimeout`: (`Long`, default `60000` ms) Sets the maximum time allowed for capture.
* `showDiagnostic`: (`Boolean`, default `true`) Displays diagnostic screens at the end of the process.
* `enableQualityCheck`: (`Boolean`, default `true`) Enables or disables the audio quality check. It is recommended to keep it enabled at all times.
* `showPreviousTip`: (`Boolean`, default `true`) Displays a screen before capture starts, providing information about the process and a button to start it.

***

## Component customization <a href="#id-8-personalizacion-del-componente" id="id-8-personalizacion-del-componente"></a>

In addition to the changes that can be made at the SDK level (which are explained in the document on [SDK Customization](https://docs.facephi.com/docs.facephi-en/sdks/sdk-mobile/android-sdk/personalizacion.md)), this particular component also allows its interface to be modified.

### Text <a href="#id-81-textos" id="id-81-textos"></a>

Text can be customized by adding an XML resource file to the client application and overriding the default values.

```kotlin
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Previous Tip -->
    <string name="voice_widget_tip_message">Speak clearly and loudly.<br/><br/>Make sure you are in a quiet environment.</string>
    <string name="voice_widget_tip_message_alt">Speak clearly and loudly. Make sure you are in a quiet environment.</string>
    <string name="voice_widget_tip_title">Speech recognition</string>
    <string name="voice_widget_tip_button">Continue</string>
    <string name="voice_widget_tip_anim_alt">Animation in which a person appears holding the phone in front of their face and speaking directly to it. Before you begin, if you are using a screen reader, use headphones.</string>
    <!-- Process -->
    <string name="voice_widget_success_message">Recording captured</string>
    <string name="voice_widget_speech_message">Speak clearly and close to the microphone</string>
    <string name="voice_widget_speech_more_message">Keep talking</string>
    <string name="voice_widget_speech_empty_message" translatable="false"></string>
    <string name="voice_widget_read_message">Say out loud:</string>
    <string name="voice_widget_speech_noisy_message">There is too much background noise. Try moving to a quiet environment.</string>
    <string name="voice_widget_success_records_message">successful recordings</string>
    <string name="voice_widget_phrase_generic_error_message">Please repeat the phrase.</string>
    <string name="voice_widget_phrase_long_silence_message">Speak for 2 seconds or more.</string>
    <string name="voice_widget_phrase_long_reverberation_message">Too much echo. Try a different environment.</string>
    <string name="voice_widget_quality_check_error_message">Audio quality is insufficient.</string>
    <string name="voice_widget_multiple_speakers_error_message">Background voices detected. Make sure you are in a quiet environment.</string>
    <!-- Diagnostic -->
    <string name="voice_widget_timeout_title">Timeout</string>
    <string name="voice_widget_timeout_desc">We were unable to identify you. Please try again.</string>
    <string name="voice_widget_internal_error_title">There was a technical problem</string>
    <string name="voice_widget_internal_error_desc">We apologize. The recording could not be made.</string>
    <string name="voice_widget_exit_alert_accept">Accept</string>
    <string name="voice_widget_exit_alert_cancel">Cancel</string>
    <string name="voice_widget_exit_alert_question">Are you sure you want to finish the process?</string>
    <string name="voice_widget_back_button_alt">Back</string>
    <string name="voice_widget_close_button_alt">Close</string>
    <string name="voice_widget_logo_alt">Logo</string>

</resources>

```

```
                                                                                    |
```

### Animations <a href="#id-82-animaciones" id="id-82-animaciones"></a>

To modify the SDK animations (Lottie), include animations with the same names in the application's res/raw/ folder.

```
voice_anim_enroll_ko.json
voice_anim_enroll_ok.json
voice_anim_enroll_progress.json
voice_anim_intro.json
```
