Polly / Client / create_voice

create_voice

Polly.Client.create_voice(**kwargs)

Creates a custom voice from recordings of a speaker and returns it in pending status. Use GetVoice to check the status. When the status is active, you can use the voice ID in SynthesizeSpeech, StartSpeechSynthesisTask, and StartSpeechSynthesisStream.

The custom-voice-max-count service quota limits the number of custom voices in your account in each Region. If you reach the quota, the request fails with ServiceQuotaExceededException.

This operation requires permissions to perform the polly:CreateVoice action. You also need s3:GetObject permission on each recording that you specify by S3Url. If you specify a customer managed key, you also need kms:DescribeKey, kms:GenerateDataKey, and kms:Decrypt permissions on the key. If you specify Tags, you also need the polly:TagResource permission.

See also: AWS API Documentation

Request Syntax

response = client.create_voice(
    Name='string',
    LanguageCode='de-DE'|'en-US'|'es-US'|'fr-FR'|'hi-IN'|'it-IT'|'pt-BR',
    TermsAccepted=True|False,
    VoiceCreationData={
        'Recordings': [
            {
                'Format': 'wav'|'flac'|'ogg_vorbis'|'mp3',
                'Data': {
                    'S3Url': 'string',
                    'Bytes': b'bytes'
                }
            },
        ]
    },
    CustomerManagedEncryption={
        'KmsKeyArn': 'string',
        'EncryptionContext': {
            'string': 'string'
        }
    },
    Tags={
        'string': 'string'
    },
    ClientToken='string'
)
Parameters:
  • Name (string) –

    [REQUIRED]

    The name of the voice. Use the name to identify the voice in your application. The name can contain letters, digits, hyphens, and underscores, and can be up to 64 characters long. The name doesn’t have to be unique. The name isn’t the voice ID, which Amazon Polly assigns.

  • LanguageCode (string) –

    [REQUIRED]

    The language of the recordings, for example, en-US. Amazon Polly doesn’t detect the language from the recordings.

  • TermsAccepted (boolean) –

    [REQUIRED]

    Confirms the following two statements:

    • ”I confirm that I have obtained all necessary consents required under any applicable laws and regulations, including biometric privacy laws, from the owner of this voice to clone these voice samples.”

    • ”I confirm that I will not use the generated content for any illegal, fraudulent, or harmful purpose and reaffirm my obligation to abide by the AWS Service Terms, Biometric Notice and Consent Terms, AWS Responsible AI Policy, and AWS Acceptable Use Policy.”

    You can read the AWS Service Terms, the Biometric Notice and Consent Terms, the AWS Responsible AI Policy, and the AWS Acceptable Use Policy on the Amazon Web Services website.

    You must set this parameter to true to create a voice. Otherwise, the request fails with ValidationException.

  • VoiceCreationData (dict) –

    [REQUIRED]

    The recordings that Amazon Polly uses to create the voice.

    • Recordings (list) – [REQUIRED]

      The recordings of the speaker. Each recording specifies its audio format and its audio source.

      • (dict) –

        A recording of the speaker whose voice you want to create. The recording specifies its audio format and its audio source.

        • Format (string) – [REQUIRED]

          The audio format of the recording: wav, flac, ogg_vorbis, or mp3. The format must match the audio data.

        • Data (dict) – [REQUIRED]

          The audio source of the recording. Specify either an Amazon S3 object or the audio data.

          • S3Url (string) –

            The Amazon S3 URL of the audio object, in the form s3://bucket/key. You need s3:GetObject permission on the object.

          • Bytes (bytes) –

            The audio data, passed directly in the request. The data must be in the format that Format specifies and can be up to 5 MB. Amazon Polly doesn’t store the audio after it creates the voice, and doesn’t return this field in responses.

  • CustomerManagedEncryption (dict) –

    The customer managed key that you want Amazon Polly to encrypt the voice with. If you omit this parameter, Amazon Polly encrypts the voice with an Amazon Web Services owned key.

    • KmsKeyArn (string) – [REQUIRED]

      The Amazon Resource Name (ARN) of the key. The key must be a symmetric encryption key in the same Amazon Web Services Region as the voice. To create the voice, you need kms:DescribeKey, kms:GenerateDataKey, and kms:Decrypt permissions on the key. To synthesize speech with the voice, you need kms:Decrypt permission on the key.

    • EncryptionContext (dict) –

      The key-value pairs that Amazon Polly includes as the encryption context when it encrypts or decrypts the voice with the key. You can use these pairs in key policy conditions. Don’t use keys that start with aws:, which are reserved.

      • (string) –

        • (string) –

  • Tags (dict) –

    The tags that you apply to the voice to help you categorize and organize it. Each tag consists of a key and an optional value, both of which you define.

    • (string) –

      • (string) –

  • ClientToken (string) –

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request. If you don’t specify a client token, the Amazon Web Services SDKs generate one for you. If you retry a request that succeeded with the same client token and the same parameters, Amazon Polly returns the voice that the first request created and doesn’t create a second voice.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'Voice': {
        'Arn': 'string',
        'Gender': 'Female'|'Male',
        'Id': 'Aditi'|'Amy'|'Astrid'|'Bianca'|'Brian'|'Camila'|'Carla'|'Carmen'|'Celine'|'Chantal'|'Conchita'|'Cristiano'|'Dora'|'Emma'|'Enrique'|'Ewa'|'Filiz'|'Gabrielle'|'Geraint'|'Giorgio'|'Gwyneth'|'Hans'|'Ines'|'Ivy'|'Jacek'|'Jan'|'Joanna'|'Joey'|'Justin'|'Karl'|'Kendra'|'Kevin'|'Kimberly'|'Lea'|'Liv'|'Lotte'|'Lucia'|'Lupe'|'Mads'|'Maja'|'Marlene'|'Mathieu'|'Matthew'|'Maxim'|'Mia'|'Miguel'|'Mizuki'|'Naja'|'Nicole'|'Olivia'|'Penelope'|'Raveena'|'Ricardo'|'Ruben'|'Russell'|'Salli'|'Seoyeon'|'Takumi'|'Tatyana'|'Vicki'|'Vitoria'|'Zeina'|'Zhiyu'|'Aria'|'Ayanda'|'Arlet'|'Hannah'|'Arthur'|'Daniel'|'Liam'|'Pedro'|'Kajal'|'Hiujin'|'Laura'|'Elin'|'Ida'|'Suvi'|'Ola'|'Hala'|'Andres'|'Sergio'|'Remi'|'Adriano'|'Thiago'|'Ruth'|'Stephen'|'Kazuha'|'Tomoko'|'Niamh'|'Sofie'|'Lisa'|'Isabelle'|'Zayd'|'Danielle'|'Gregory'|'Burcu'|'Jitka'|'Sabrina'|'Jasmine'|'Jihye'|'Ambre'|'Beatrice'|'Florian'|'Lennart'|'Lorenzo'|'Tiffany'|'Arjun'|'Carlos'|'Carolina'|'Curtis'|'Hyunduk'|'Kenneth'|'Kiara'|'Leo'|'Nate'|'Tina',
        'LanguageCode': 'arb'|'cmn-CN'|'cy-GB'|'da-DK'|'de-DE'|'en-AU'|'en-GB'|'en-GB-WLS'|'en-IN'|'en-US'|'es-ES'|'es-MX'|'es-US'|'fr-CA'|'fr-FR'|'is-IS'|'it-IT'|'ja-JP'|'hi-IN'|'ko-KR'|'nb-NO'|'nl-NL'|'pl-PL'|'pt-BR'|'pt-PT'|'ro-RO'|'ru-RU'|'sv-SE'|'tr-TR'|'en-NZ'|'en-ZA'|'ca-ES'|'de-AT'|'yue-CN'|'ar-AE'|'fi-FI'|'en-IE'|'nl-BE'|'fr-BE'|'cs-CZ'|'de-CH'|'en-SG',
        'LanguageName': 'string',
        'Name': 'string',
        'Origin': 'aws'|'customer',
        'Status': 'pending'|'active'|'failed',
        'StatusReason': 'string',
        'AdditionalLanguageCodes': [
            'arb'|'cmn-CN'|'cy-GB'|'da-DK'|'de-DE'|'en-AU'|'en-GB'|'en-GB-WLS'|'en-IN'|'en-US'|'es-ES'|'es-MX'|'es-US'|'fr-CA'|'fr-FR'|'is-IS'|'it-IT'|'ja-JP'|'hi-IN'|'ko-KR'|'nb-NO'|'nl-NL'|'pl-PL'|'pt-BR'|'pt-PT'|'ro-RO'|'ru-RU'|'sv-SE'|'tr-TR'|'en-NZ'|'en-ZA'|'ca-ES'|'de-AT'|'yue-CN'|'ar-AE'|'fi-FI'|'en-IE'|'nl-BE'|'fr-BE'|'cs-CZ'|'de-CH'|'en-SG',
        ],
        'SupportedEngines': [
            'standard'|'neural'|'long-form'|'generative',
        ],
        'VoiceCreationData': {
            'Recordings': [
                {
                    'Format': 'wav'|'flac'|'ogg_vorbis'|'mp3',
                    'Data': {
                        'S3Url': 'string',
                        'Bytes': b'bytes'
                    }
                },
            ]
        },
        'CustomerManagedEncryption': {
            'KmsKeyArn': 'string',
            'EncryptionContext': {
                'string': 'string'
            }
        },
        'CreationTime': datetime(2015, 1, 1)
    }
}

Response Structure

  • (dict) –

    • Voice (dict) –

      The new voice, in pending status.

      • Arn (string) –

        The Amazon Resource Name (ARN) of a custom voice, in the form arn:partition:polly:region:account-id:voice/voice-id. CreateVoice and GetVoice return this field. Voices that Amazon Polly provides don’t have an ARN.

      • Gender (string) –

        The gender of the voice. Custom voices don’t include this field.

      • Id (string) –

        The voice ID that Amazon Polly assigns. You specify this ID when you call the SynthesizeSpeech operation. For a custom voice, Amazon Polly assigns an ID that consists of vc- followed by hexadecimal characters, for example, vc-9a8fa85dd3.

      • LanguageCode (string) –

        Language code of the voice.

      • LanguageName (string) –

        Human readable name of the language in English.

      • Name (string) –

        The name of the voice, for example, Salli or Kendra. The name is human-readable, and you might display it in your application. For a custom voice, this is the Name that you specified in CreateVoice.

      • Origin (string) –

        Indicates who provides the voice. The origin is one of the following:

        aws

        A voice that Amazon Polly provides.

        customer

        A custom voice that you created with CreateVoice.

      • Status (string) –

        The status of a custom voice. Voices that Amazon Polly provides don’t include this field. The status is one of the following:

        pending

        Amazon Polly is creating the voice.

        active

        The voice is ready for speech synthesis.

        failed

        Amazon Polly couldn’t create the voice. StatusReason describes why.

      • StatusReason (string) –

        Additional information about the status of a custom voice. When the status is failed, this field describes why Amazon Polly couldn’t create the voice.

      • AdditionalLanguageCodes (list) –

        Additional codes for languages available for the specified voice in addition to its default language.

        For example, the default language for Aditi is Indian English (en-IN) because it was first used for that language. Since Aditi is bilingual and fluent in both Indian English and Hindi, this parameter would show the code hi-IN.

        • (string) –

      • SupportedEngines (list) –

        Specifies which engines ( standard, neural, long-form or generative) are supported by a given voice.

        • (string) –

      • VoiceCreationData (dict) –

        The data from which you created the custom voice. CreateVoice and GetVoice return this field. The response doesn’t include the audio: a recording that Amazon Polly read from Amazon S3 includes its S3Url, and a recording that you passed as Bytes has no fields in Data.

        • Recordings (list) –

          The recordings of the speaker. Each recording specifies its audio format and its audio source.

          • (dict) –

            A recording of the speaker whose voice you want to create. The recording specifies its audio format and its audio source.

            • Format (string) –

              The audio format of the recording: wav, flac, ogg_vorbis, or mp3. The format must match the audio data.

            • Data (dict) –

              The audio source of the recording. Specify either an Amazon S3 object or the audio data.

              • S3Url (string) –

                The Amazon S3 URL of the audio object, in the form s3://bucket/key. You need s3:GetObject permission on the object.

              • Bytes (bytes) –

                The audio data, passed directly in the request. The data must be in the format that Format specifies and can be up to 5 MB. Amazon Polly doesn’t store the audio after it creates the voice, and doesn’t return this field in responses.

      • CustomerManagedEncryption (dict) –

        The customer managed key that encrypts your custom voice. CreateVoice and GetVoice return this field if you specified a key in CreateVoice.

        • KmsKeyArn (string) –

          The Amazon Resource Name (ARN) of the key. The key must be a symmetric encryption key in the same Amazon Web Services Region as the voice. To create the voice, you need kms:DescribeKey, kms:GenerateDataKey, and kms:Decrypt permissions on the key. To synthesize speech with the voice, you need kms:Decrypt permission on the key.

        • EncryptionContext (dict) –

          The key-value pairs that Amazon Polly includes as the encryption context when it encrypts or decrypts the voice with the key. You can use these pairs in key policy conditions. Don’t use keys that start with aws:, which are reserved.

          • (string) –

            • (string) –

      • CreationTime (datetime) –

        The date and time when you created the custom voice. Voices that Amazon Polly provides don’t include this field.

Exceptions