Amazon Sumerian
User Guide

Amazon Sumerian Speech Component

The speech component assigns text to an entity for playback with Amazon Polly. You assign text to an entity, and play the audio output from Amazon Polly with a state machine or script. The scene calls Amazon Polly at runtime to generate the audio.

To use Amazon Polly during playback, the scene needs AWS credentials from Amazon Cognito Identity. Create an identity pool for your scene, and configure it under AWS configuration in the scene settings.


  • 3D audio – Adjust the volume of the speech audio based on the distance of the entity from the camera.

  • Voice – An Amazon Polly voice.

  • Volume – Volume of the speech audio.

  • Speech files – Drop text files here to add them to the component. Click to mark up a speech file with gestures.

  • Gesture map – A document that maps gestures to words. When you mark up a speech file, the editor uses this mapping to determine where to add gestures. You can modify the gesture map using text editor.

To trigger a speech during playback, use a state machine or script component on the same entity.

State Machine

To play a speech, add a state machine to the entity with the speech component. Add a state with AWS SDK ready and Start speech actions.

For more information, see AWS Feature State Machine Actions in Amazon Sumerian.


To play a speech, get a reference to the speech component from the context object. The component has a speeches array that contains the speeches attached to the component. Call play on a speech.

Sumerian calls Amazon Polly when you play a speech, so you must use the aws.sdkReady listener to ensure that your scene's AWS credentials are loaded before the call.

Example script – play a random speech

'use strict'; var setup = function(args, ctx) { sumerian.SystemBus.addListener('aws.sdkReady', () => { var speechComponent = ctx.entity.getComponent("speechComponent"); var speeches = speechComponent.speeches; var speech = speeches[Math.floor(Math.random() * speeches.length)];; }, true ); };

On this page: