Skip to content

describe_voices async

describe_voices(
    *,
    config_overrides: Optional[AsyncPollyClientConfig] = None,
    engine: Optional[Engine] = None,
    language_code: Optional[LanguageCode] = None,
    include_additional_language_codes: Optional[IncludeAdditionalLanguageCodes] = None,
    next_token: Optional[NextToken] = None,
) -> DescribeVoicesOutput

Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account. Each voice speaks a specified language and is identified by an ID. A voice that Amazon Polly provides is either male or female, and its ID is the ASCII version of the voice name.

When synthesizing speech (SynthesizeSpeech), you provide the voice ID for the voice you want from the list of voices returned by DescribeVoices.

For example, your news reader application reads news in a specific language, and you want to give users the option to choose the voice. With the DescribeVoices operation, you can provide a list of available voices for users to choose from.

You can optionally specify a language code to filter the available voices. For example, if you specify en-US, the operation returns a list of all available US English voices.

The list includes custom voices in every status. For each voice, Origin indicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status is active. A voice in failed status stays in the list until you delete it.

For a custom voice, DescribeVoices returns Origin, Id, Name, Status, LanguageCode, LanguageName, SupportedEngines, and CreationTime. To get Arn, StatusReason, VoiceCreationData, and CustomerManagedEncryption, use GetVoice.

The LanguageCode and Engine filters apply to custom voices in the same way as to voices that Amazon Polly provides.

This operation requires permissions to perform the polly:DescribeVoices action.

Parameters:

  • engine (Optional[Engine], default: None ) –

    Specifies the engine (standard, neural, long-form or generative) used by Amazon Polly when processing input text for speech synthesis.

  • language_code (Optional[LanguageCode], default: None ) –

    The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned.

  • include_additional_language_codes (Optional[IncludeAdditionalLanguageCodes], default: None ) –

    Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify yes but not if you specify no.

  • next_token (Optional[NextToken], default: None ) –

    An opaque pagination token returned from the previous DescribeVoices operation. If present, this indicates where to continue the listing.

Raises:

Examples:

To describe available voices Returns the list of voices that are available for use when requesting speech synthesis. Displayed languages are those within the specified language code. If no language code is specified, voices for all available languages are displayed.

>>> await client.describe_voices(language_code='en-GB')
Source code in docs_src/capo_polly/_services/async_polly.py
async def describe_voices(
    self,
    *,
    config_overrides: Optional[AsyncPollyClientConfig] = None,
    engine: Optional["capo_polly.types.engine.Engine"] = None,
    language_code: Optional["capo_polly.types.language_code.LanguageCode"] = None,
    include_additional_language_codes: Optional[
        "capo_polly.types.include_additional_language_codes.IncludeAdditionalLanguageCodes"
    ] = None,
    next_token: Optional["capo_polly.types.next_token.NextToken"] = None,
) -> "capo_polly.types.describe_voices_output.DescribeVoicesOutput":
    """<p>Returns the list of voices: the voices that Amazon Polly provides and the custom voices in your account. Each voice speaks a specified language and is identified by an ID. A voice that Amazon Polly provides is either male or female, and its ID is the ASCII version of the voice name.</p> <p>When synthesizing speech (<code>SynthesizeSpeech</code>), you provide the voice ID for the voice you want from the list of voices returned by <code>DescribeVoices</code>.</p> <p>For example, your news reader application reads news in a specific language, and you want to give users the option to choose the voice. With the <code>DescribeVoices</code> operation, you can provide a list of available voices for users to choose from.</p> <p> You can optionally specify a language code to filter the available voices. For example, if you specify <code>en-US</code>, the operation returns a list of all available US English voices. </p> <p>The list includes custom voices in every status. For each voice, <code>Origin</code> indicates whether Amazon Polly provides the voice or you created it. You can use a custom voice for synthesis only when its status is <code>active</code>. A voice in <code>failed</code> status stays in the list until you delete it.</p> <p>For a custom voice, <code>DescribeVoices</code> returns <code>Origin</code>, <code>Id</code>, <code>Name</code>, <code>Status</code>, <code>LanguageCode</code>, <code>LanguageName</code>, <code>SupportedEngines</code>, and <code>CreationTime</code>. To get <code>Arn</code>, <code>StatusReason</code>, <code>VoiceCreationData</code>, and <code>CustomerManagedEncryption</code>, use <code>GetVoice</code>.</p> <p>The <code>LanguageCode</code> and <code>Engine</code> filters apply to custom voices in the same way as to voices that Amazon Polly provides.</p> <p>This operation requires permissions to perform the <code>polly:DescribeVoices</code> action.</p>

    Args:
        engine: <p>Specifies the engine (<code>standard</code>, <code>neural</code>, <code>long-form</code> or <code>generative</code>) used by Amazon Polly when processing input text for speech synthesis. </p>
        language_code: <p> The language identification tag (ISO 639 code for the language name-ISO 3166 country code) for filtering the list of voices returned. If you don't specify this optional parameter, all available voices are returned. </p>
        include_additional_language_codes: <p>Boolean value indicating whether to return any bilingual voices that use the specified language as an additional language. For instance, if you request all languages that use US English (es-US), and there is an Italian voice that speaks both Italian (it-IT) and US English, that voice will be included if you specify <code>yes</code> but not if you specify <code>no</code>.</p>
        next_token: <p>An opaque pagination token returned from the previous <code>DescribeVoices</code> operation. If present, this indicates where to continue the listing.</p>

    Raises:
        capo_polly.errors.invalid_next_token_exception.InvalidNextTokenException: <p>The NextToken is invalid. Verify that it's spelled correctly, and then try again.</p>
        capo_polly.errors.service_failure_exception.ServiceFailureException: <p>An unknown condition has caused a service failure.</p>
        capo_polly.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To describe available voices
        Returns the list of voices that are available for use when requesting speech synthesis. Displayed languages are those within the specified language code. If no language code is specified, voices for all available languages are displayed.

        >>> await client.describe_voices(language_code='en-GB')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_polly.types.describe_voices_input.DescribeVoicesInput]",
    ) -> AsyncOperationResponse[
        "capo_polly.types.describe_voices_output.DescribeVoicesOutput"
    ]:
        import capo_polly._operations.parrot_v1.describe_voices

        (
            output,
            http_response,
        ) = await capo_polly._operations.parrot_v1.describe_voices.async_describe_voices(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_polly.types.describe_voices_output.DescribeVoicesOutput",
    ) -> dict[str, Any]:
        import capo_polly.types.describe_voices_output

        return capo_polly.types.describe_voices_output.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("DescribeVoices", redact_output=_redact_output),
    )
    input_: capo_polly.types.describe_voices_input.DescribeVoicesInput = {}
    if engine is not None:
        input_["engine"] = engine
    if language_code is not None:
        input_["language_code"] = language_code
    if include_additional_language_codes is not None:
        input_["include_additional_language_codes"] = (
            include_additional_language_codes
        )
    if next_token is not None:
        input_["next_token"] = next_token

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output