Skip to main content

AWS Polly TTS

The AWS Polly TTS provider enables your agent to use AWS Polly's high-quality text-to-speech models for generating natural-sounding voice output.

Installation​

Install the AWS Poly-enabled VideoSDK Agents package:

pip install "videosdk-plugins-aws"

Importing​

from videosdk.plugins.aws import AWSPollyTTS

Authentication​

  • AWS Account: You have an active AWS account with permissions to access Amazon Polly.
  • Region Selection: You're operating in the US East (N. Virginia) (us-east-1) region, as model access is region-specific.
  • AWS Credentials: Your AWS credentials (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION) are configured, either through environment variables or your preferred credential management method.

Example Usage​

from videosdk.plugins.aws import AWSPollyTTS
from videosdk.agents import CascadingPipeline

# Initialize the AWS Polly TTS model
tts = AWSPollyTTS(
voice="Joanna",
engine="neural",
speed=1.2,
pitch=0.1,
)

# Add tts to cascading pipeline
pipeline = CascadingPipeline(tts=tts)
note

When using .env file for credentials, don't pass them as arguments to model instances or context objects. The SDK automatically reads environment variables, so omit api_key and other credential parameters from your code.

Configuration Options​

  • voice: (str) Voice ID for the TTS output (default: "Joanna").
  • engine: (str) Polly engine type: "standard" or "neural" (default: "neural").
  • region: (str) AWS region for Polly service (default: "us-east-1" or from AWS_DEFAULT_REGION).
  • aws_access_key_id: (str) AWS access key ID (optional; can be set via environment variable).
  • aws_secret_access_key: (str) AWS secret access key (optional; can be set via environment variable).
  • aws_session_token: (str) Optional AWS session token for temporary credentials.
  • speed: (float) Speech rate multiplier (e.g., 1.0 is normal speed, 1.5 is 50% faster).
  • pitch: (float) Pitch adjustment multiplier (e.g., 0.0 is normal, 0.2 raises pitch).

Additional Resources​

The following resources provide more information about using AWS Polly with VideoSDK Agents SDK.

Got a Question? Ask us on discord