> ## Documentation Index
> Fetch the complete documentation index at: https://docs.api.rask.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Working with speakers and voices

> Learn how to add, modify, or remove speakers in your project, and how to change the voices assigned to them.

Once you are finished editing, use [generate project](/api-reference/project/generate_project) endpoint to apply changes to voiceover (re-dub project).

<Note>
  Minutes for re-dubbing are charged only for the modified and added segments, based on their combined length.

  For example, if you modified two segments (*text, timestamp, speaker, or speaker's voice assigned to segment*) that are 15 and 20 seconds long, and added a new segment that is 10 seconds long, their durations will be combined (15+20+10 = 45 seconds in total) before calculating the total minutes charged when regenerating the project.

  The combined duration in seconds is then rounded up to the closest full minute for charges, for example:

  * 0:01 to 0:59 = 1 minute
  * 1:01 to 1:29 = 1 minute
  * 1:30 to 1:59 = 2 minutes

  This calculation is performed every time when [generate project method](/api-reference/project/generate_project) is called.
</Note>

<Tabs>
  <Tab title="Change Speaker's voice">
    You can select from variety of voice options for speakers in your project. In projects with destination languages, that support [voice cloning](https://help.rask.ai/hc/what-is-voice-cloning-feature-rask-help-center), you can select between Instant Voice clone, [Custom voice clone](https://help.rask.ai/hc/what-is-custom-voice-clone-rask-help-center) and AI voice presets. In other languages, you can choose any available AI voice preset for your Speaker.

    <Steps>
      <Step title="Get available voice options for your project">
        Use your `project_id` and [get project voices](/api-reference/project/get_voices) endpoint to pull the list of all voices available for specified project

        From the successful response, identify and obtain the `voice_id` for the voices you wish to assign.
      </Step>

      <Step title="Change voice assigned to Speaker(s)">
        Use your `project_id` with the [Patch Project](/api-reference/project/patch_project) endpoint. Pass the voice array with key-value entries where:

        * **Key**: The speaker identifier (e.g., `SPEAKER_00`, `SPEAKER_01`, etc.).
        * **Value**: The corresponding `voice_id` you want to assign.

        <Info>
          Ensure that you pass **all speakers' voice assignments, including both modified and non-modified ones**.
          If a speaker’s voice assignment is not included:

          * The speaker will be removed if no segments are assigned to it.
          * The request will return an error if segments are assigned but no voice assignment is provided.
        </Info>
      </Step>
    </Steps>

    #### Can I create Custom Voice clone via API?

    Currently, creating a [Custom voice clone](https://help.rask.ai/hc/what-is-custom-voice-clone-rask-help-center) is only available through our web platform. Once you’ve created the clone in the platform, you can retrieve its `voice_id` using the API and assign it to a speaker.

    #### How do I distinguish between Instant Voice clone, Custom Voice clones, and AI voice presets?

    In languages where all these options are available, you can identify them based on the following attributes:

    1. **Instant Voice clone**

    Instant Voice Clone option always has the following attributes:

    ```
    "label": "Voice Clone",
    "sample_src": null,
    "gender": "auto"
    ```

    2. **Custom voice clone**

    If you have created [Custom voice clone](https://help.rask.ai/hc/what-is-custom-voice-clone-rask-help-center) in your platform, it will also be available for selection in supported languages. The parameters typically look like this:

    ```
    "label": "Your name",
    "sample_src": "https://sample_url",
    "gender": "auto"
    ```

    3. **AI voice presets**

    AI Voice Presets are available in all languages and always include a specified gender:

    ```
    "label": "Preset name",
    "sample_src": "https://sample_url",
    "gender": "(fe)male"
    ```
  </Tab>

  <Tab title="Change Speaker assigned to segment">
    You can change the Speaker(s) assigned to segment(s) by following these steps:

    <Steps>
      <Step title="Get segment_id">
        Get your project's transcription by using `project_id` and [get transcription endpoint](/api-reference/project/get_transcription) to obtain `segment_id` for the segment(s) you want to update.
      </Step>

      <Step title="Update Speaker assigned to segment">
        Use `segment_id` and [patch segments endpoint](/api-reference/project/patch_segment) to update the speaker assigned to the segment(s). Pass the new speaker identifier in the request body.

        ```
        "id":"a1058047-a83e-4739-b825-71e650643ed0",
        "speaker": "SPEAKER_01"
        ```

        <Info>
          Speaker identifier must be specified in `SPEAKER_XX` format (case-sensitive), where `XX` corresponds to Speaker's index, starting with `00` for 1st Speaker, and so on.
        </Info>
      </Step>
    </Steps>
  </Tab>

  <Tab title="Add Speaker">
    To add new Speaker to your project:

    <Steps>
      <Step title="Get segment_id">
        Get your project's transcription by using `project_id` and [get transcription endpoint](/api-reference/project/get_transcription) to obtain `segment_id` for the segment(s) you want to update.
      </Step>

      <Step title="Update Speaker assigned to segment">
        Use `segment_id` and [patch segments endpoint](/api-reference/project/patch_segment) to update the speaker assigned to the segment(s). Pass the new speaker identifier in the request body.

        ```
        "id":"a1058047-a83e-4739-b825-71e650643ed0",
        "speaker": "SPEAKER_01"
        ```

        <Info>
          Speaker identifier must be specified in `SPEAKER_XX` format (case-sensitive), where `XX` corresponds to Speaker's index, starting with `00` for 1st Speaker, and so on.
        </Info>
      </Step>

      <Step title="Change voice assigned to new Speaker">
        Follow instructions under **Change Speaker's voice** tab to modify voice that was automatically assigned to newly added Speaker.
      </Step>
    </Steps>
  </Tab>

  <Tab title="Remove Speaker">
    If you want to remove un-needed Speaker from your project:

    <Steps>
      <Step title="Speaker's assignment">
        Get your project's transcription by using `project_id` and [get transcription endpoint](/api-reference/project/get_transcription) and verify that no segments are assigned to unused Speaker.
      </Step>

      <Step title="Remove Speaker">
        Use your `project_id` with the [Patch Project](/api-reference/project/patch_project) endpoint. Pass the voice array with key-value entries where:

        * **Key**: The speaker identifier (e.g., `SPEAKER_00`, `SPEAKER_01`, etc.).
        * **Value**: The corresponding `voice_id` you want to assign.

        <Info>
          Ensure that you pass **all speakers' voice assignments that you want to keep** and **exclude ones you want to remove**.
        </Info>
      </Step>
    </Steps>
  </Tab>
</Tabs>
