AWS SDK for Ruby
Developer Guide

Getting a List of Voices

This example uses the describe_voices method to get the list of US English voices in the us-west-2 region.

Choose Copy to save the code locally.

Create the file polly_describe_voices.rb.

Add the required gem.

Note

Version 2 of the AWS SDK for Ruby didn't have service-specific gems.

require 'aws-sdk-polly' # In v2: require 'aws-sdk'

Create an Amazon Polly client and call describe_voices for US English.

polly = Aws::Polly::Client.new resp = polly.describe_voices(language_code: 'en-US')

Display the name and gender of the voices.

resp.voices.each do |v| puts v.name puts ' ' + v.gender puts end

See the complete example on GitHub.