In this tutorial, we show you how to translate a Host’s speech into several different languages using Amazon Translate. You can translate the text to one of 15 languages (specified in the table shown belowin this tutorial. You can also specify the voice used by the Host by changing the voice ID. Instead of swapping out and translating large chunks of text, this exercise will show you how to translate text by changing a language code. Behind the scenes, this uses the Amazon Polly API to synthesize the speech from the text you provide.
You’ll learn about:
- AWS configuration
- Amazon Cognito identity pool IDs
- The Speech component
- How to play dynamic speech during runtime
- Integrating with Amazon Translate
Before you begin, you should have completed the following tasks and tutorials:
- Sign in to Amazon Sumerian with your AWS account
- Scripting Basics tutorial
- Using a Host and Speech Components
Step 1: Create a New Scene and Add Cognito Identity Pool ID
In this step, we create an Amazon Cognito identity pool ID (Amazon Cognito ID), create a scene, and add the Amazon Cognito ID to connect our scene to other AWS services. More specifically, we will create an AWS CloudFormation stack that has an Amazon Cognito Federated Identity pool that contains permissions for using functionality in your scene. We will also attach necessary IAM policies for this exercise.
Configure with AWS by Creating an AWS CloudFormation Stack
Create an AWS CloudFormation stack using the Amazon Cognito Setup Using AWS CloudFormation tutorial. Once the stack is created, navigate to Output and make a note of the Cognito Identity Pool ID. We’ll insert this later in the Sumerian scene.
Staying in the AWS Management Console, now open the IAM console.
Choose Roles, and then find the role you just created.
Open the new unauthenticated role. Choose Attach Policy, and then search for and add the AmazonTranscribeReadOnlyAccess policy and the TranslateFullAccess policy.
Create a New Sumerian Scene
Navigate to the Sumerian Dashboard. From the Dashboard, create a new, empty scene. Use any name you like.
Click the scene’s name, Language Translation. This is the root entity, located in the Entities panel on the left side of the interface.
In the Inspector panel on the right, provide your Cognito Identity Pool ID in the AWS configuration section.
Step 2: Set Up the Scene
In this step, we add a Sumerian Host and an empty entity.
Choose Import Asset at the top of the canvas.
Choose any Host from the asset library. Click Add in the lower-right corner. I will be using Cristine.
Navigate to the Assets panel. Under the Host asset pack, find the Host entity (in my scene, I will see Cristine next to the hexagon icon), and drag the entity into your scene. The screen should look like the following: